Skip to main content

Installation

Full installation guide for all supported agents.

Requirements

RequirementVersion
Node.js≥ 22.5
Claude CodeAny recent version
Gemini CLIAny recent version (for Gemini setup)
OpenAI CodexAny recent version (for Codex setup)
opencodeAny recent version (for opencode setup)

Marketplace install (Claude Code / Codex)

The fastest path for Claude Code and Codex CLI users. Add the marketplace once per machine, then install:

# Claude Code
claude plugin marketplace add joeblackwaslike/agent-marketplace
claude plugin install lessons-learned@agent-marketplace

# Codex CLI
codex plugin marketplace add joeblackwaslike/agent-marketplace
codex plugin install lessons-learned@agent-marketplace

The marketplace add step registers the marketplace source — it only needs to run once. After that, plugin install resolves directly.

For Gemini CLI, opencode, and Cursor, use the manual setup below.


Manual install (clone and wire)

git clone https://github.com/joeblackwaslike/lessons-learned.git ~/lessons-learned
cd ~/lessons-learned
npm ci

npm ci installs Node.js dependencies and registers Husky pre-commit hooks.


Platform setup

1. Add hooks to settings

Edit ~/.claude/settings.json:

{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear|compact",
"hooks": [
{
"type": "command",
"command": "node \"/absolute/path/to/lessons-learned/hooks/session-start-reset.mjs\""
},
{
"type": "command",
"command": "node \"/absolute/path/to/lessons-learned/hooks/session-start-lesson-protocol.mjs\""
}
]
},
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "node \"/absolute/path/to/lessons-learned/hooks/session-start-scan.mjs\"",
"timeout": 5
}
]
}
],
"PreToolUse": [
{
"matcher": "Read|Edit|Write|Bash|Glob",
"hooks": [
{
"type": "command",
"command": "node \"/absolute/path/to/lessons-learned/hooks/pretooluse-lesson-inject.mjs\"",
"timeout": 5
}
]
}
],
"SubagentStart": [
{
"matcher": ".+",
"hooks": [
{
"type": "command",
"command": "node \"/absolute/path/to/lessons-learned/hooks/subagent-start-lesson-protocol.mjs\"",
"timeout": 5
}
]
}
]
}
}

Replace /absolute/path/to/lessons-learned with your actual clone path (e.g. /Users/alice/lessons-learned).

Find your clone path
echo $(pwd) # run from inside the repo

2. Restart Claude Code

Hook changes in settings.json take effect on the next session. Restart Claude Code or start a new session.

3. Verify

echo '{"tool_name":"Bash","tool_input":{"command":"pytest tests/"},"session_id":"x"}' | \
node ~/lessons-learned/hooks/pretooluse-lesson-inject.mjs

You should see JSON output with hookSpecificOutput.additionalContext. An empty {} means no lesson matched.


Tool name mapping

Each agent platform uses different tool names. The plugin normalizes them to the canonical set before matching against the lesson store:

CanonicalClaude CodeGemini CLICodexopencode
BashBashrun_shell_commandshellBash
ReadReadread_fileread_fileRead
EditEditreplace_in_fileapply_patchEdit
WriteWritewrite_filewrite_fileWrite
GlobGlobfind_filesfind_filesGlob

Upgrading

cd ~/lessons-learned
git pull
npm ci
node scripts/lessons.mjs build # rebuild manifest after any update

Uninstalling

  1. Remove the hooks entries from ~/.claude/settings.json (or the equivalent file for your agent).
  2. Delete the repo: rm -rf ~/lessons-learned

Your session logs are unaffected — the plugin only reads them, never writes to them.