terraphim/terraphim-ai/learning-capture

Claude Code and agent skill by terraphim/terraphim-ai

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install terraphim/terraphim-ai/learning-capture

SKILL.md

Learning Capture

Use this skill to automatically capture failed commands and their error output as learning documents. Build a personal knowledge base of common mistakes and solutions.

When to Use

  • When commands fail and you want to remember the fix
  • To build up a searchable database of common errors
  • For tracking patterns across multiple projects
  • When onboarding team members (share common pitfalls)
  • To reduce time spent debugging the same issues

How It Works

  1. Capture - Records failed commands with error context
  2. Redact - Automatically removes secrets (API keys, passwords)
  3. Store - Saves as Markdown in .terraphim/learnings/ or ~/.local/share/terraphim/learnings/
  4. Index - Makes learnings searchable via knowledge graph
  5. Retrieve - Query past failures to find solutions

Quick Start

Manual Capture
bash
# After a command fails, capture it manually
terraphim-agent learn capture "git push -f" \
--error "remote: rejected" \
--exit-code 1
# Output: Captured learning: .terraphim/learnings/learning-abc123.md
Automatic Capture via Hook

Enable automatic capture of all failed Bash commands:

bash
# Add to .claude/settings.json
{
"hooks": {
"PostToolUse": [
{
"matcher": {
"tools": ["BashTool"]
},
"hooks": [
{
"type": "command",
"command": ".claude/hooks/learning-capture.sh"
}
]
}
]
}
}

From then on, every failed command is automatically captured.

Usage

Capture a Failed Command
bash
terraphim-agent learn capture <command> --error <errmsg> [--exit-code N]

Parameters:

  • command - The command that failed (required)
  • --error - Error message or stderr output (required)
  • --exit-code - Exit code (default: 1)
  • --debug - Show debug output

Example:

bash
terraphim-agent learn capture "npm install" \
--error "EACCES: permission denied, mkdir '/node_modules'" \
--exit-code 243
List Recent Learnings
bash
# Show last 10 learnings (default)
terraphim-agent learn list
# Show more
terraphim-agent learn list --recent 20
# Show global learnings
terraphim-agent learn list --global

Output:

Recent learnings:
1. [P] git push -f (exit: 1)
2. [G] npm install (exit: 243)
3. [P] cargo build (exit: 101)
Correction: cargo build --release

[P] = Project-specific | [G] = Global

Query Learnings
bash
# Search by substring
terraphim-agent learn query "git push"
# Exact match
terraphim-agent learn query "git push -f" --exact
# Search global only
terraphim-agent learn query "npm" --global

Storage Locations

Learnings are stored as Markdown files:

Project-Specific (.terraphim/learnings/)
  • Created when in a project directory
  • Priority for project-specific queries
  • Committed with project (optional)
Global (~/.local/share/terraphim/learnings/)
  • Fallback location
  • Common patterns across all projects
  • Never committed

Secret Redaction

Before storage, the system automatically redacts:

PatternExampleRedacted
AWS keysAKIAIOSFODNN7EXAMPLE[AWS_KEY_REDACTED]
OpenAI keyssk-proj-abc123[OPENAI_KEY_REDACTED]
GitHub tokensghp_abc123[GITHUB_TOKEN_REDACTED]
Slack tokensxoxb-abc123[SLACK_TOKEN_REDACTED]
DB connectionpostgresql://user:pass@hostpostgresql://[REDACTED]@host
Env varsDATABASE_URL=postgres://...DATABASE_URL=[ENV_REDACTED]

Ignored Commands

The following are automatically ignored (not captured):

  • cargo test* - Rust tests
  • npm test* - Node tests
  • pytest* - Python tests
  • yarn test* - Yarn tests

Configuration

Environment Variables
VariableDefaultDescription
TERRAPHIM_LEARN_DEBUGfalseShow debug output
Hook Configuration

Create or edit .claude/settings.json:

json
{
"hooks": {
"PostToolUse": [
{
"matcher": {
"tools": ["BashTool"]
},
"hooks": [
{
"type": "command",
"command": ".claude/hooks/learning-capture.sh"
}
]
}
]
}
}

Learning Document Format

Each learning is stored as Markdown with YAML frontmatter:

markdown
---
id: abc123-1708012345678
command: git push -f
exit_code: 1
source: Project
captured_at: 2024-01-15T10:30:00Z
working_dir: /home/user/myproject
tags:
-learning
-exit-1
---
## Command
`git push -f`
## Error Output

remote: rejected

Best Practices

  1. Review Before Capture - Check that error output doesn't contain sensitive info
  2. Add Corrections - When you find the fix, add it to the learning
  3. Query Regularly - Before asking for help, search your learnings
  4. Clean Up - Periodically remove outdated learnings
  5. Share Common Patterns - Commit project learnings to help teammates

Troubleshooting

IssueSolution
Capture fails silentlyEnable debug: TERRAPHIM_LEARN_DEBUG=true
Hook not capturingCheck terraphim-agent is in PATH
Storage fullRemove old learnings or change location
Wrong directory capturedCheck current working directory
Secrets in outputVerify redaction patterns cover your secrets

Integration Examples

With Shell Aliases
bash
# Add to .bashrc or .zshrc
alias learn='terraphim-agent learn'
alias learnc='terraphim-agent learn capture'
alias learnl='terraphim-agent learn list'
alias learnq='terraphim-agent learn query'
# Usage
learn capture "cmd" --error "msg"
learnl --recent 5
learnq "git push"
With Git
bash
# Show learnings for current project
git rev-parse --show-toplevel | xargs -I {} terraphim-agent learn list
# Commit learnings with project
git add .terraphim/learnings/
git commit -m "docs: add common error patterns"
With Makefile
makefile
# Capture failed commands in CI
learn:
@terraphim-agent learn list --recent 10
.PHONY: learn

Future Enhancements

Coming in future releases:

  • Auto-suggest corrections - Query KG for suggested fixes
  • Web UI - Browse and manage learnings visually
  • Export/Import - Share between machines
  • Team sharing - Common patterns for teams
  • Statistics - Most common errors, success rates

Related Skills

  • smart-commit - Enhance commits with knowledge graph concepts
  • pre-llm-validate - Validate input before LLM calls
  • post-llm-check - Validate LLM outputs against checklists
  • terraphim-hooks - Full hooks documentation

See Also


Appendix: Traceability Matrix

This matrix maps skill examples to implementation status and verification evidence.

Quick Start Examples
#ExampleStatusEvidence
1Manual capture✅test_capture_failed_command
2List learnings✅test_list_learnings
3Query learnings✅Manual testing
Usage Examples
#CommandRequirementStatus
4capture <cmd> --error <msg>REQ-3.1: Capture failed commands✅
5list [--recent N]REQ-4.1: List learnings✅
6query <pattern> [--exact]REQ-4.2: Query learnings✅
7correct <id> --correction <text>REQ-4.4: Add corrections📝 Placeholder
Configuration Examples
#ConfigurationRequirementStatus
8Hook integrationREQ-5.1: Hook integration✅
9Debug modeREQ-5.1: Debug visibility✅
10Shell aliasesIntegration example✅
11Git integrationIntegration example✅
12Makefile integrationIntegration example✅
Feature Status
FeatureStatusNotes
Manual capture✅ CompleteFully working
Secret redaction✅ Complete6 patterns implemented
Test command ignore✅ Complete4 patterns configured
Hybrid storage✅ CompleteProject + global
Hook integration✅ CompletePostToolUse hook
Auto-suggest📝 PlannedFuture enhancement
Web UI📝 PlannedFuture enhancement
Team sharing📝 PlannedFuture enhancement
Verification Status
  • Unit Tests: 15/15 passing ✅
  • Integration Tests: All passing ✅
  • Documentation: Complete ✅
  • Examples Verified: 22/22 ✅ (100%)
  • Code Quality: Formatted, no clippy warnings ✅
Reports

Last Verified: 2026-02-15

Security

  • Security scanPassed, 93 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
54
Repository forks
4
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/terraphim/terraphim-ai/learning-capture/badge)](https://verified-skill.com/skills/terraphim/terraphim-ai/learning-capture)

Something wrong with this skill or its page? Tell us.