Skip to main content

Commands Reference

Version: 0.3.9-beta | All commands use the /kmgraph: prefix in Claude Code. Other platforms access equivalent functionality through kg_* MCP tools — see INSTALL.md for details.

KMGraph session-summary demo — snapshot of captured lessons and open plans

Essential

CommandDescriptionKey flags
/kmgraph:initInitialize a new knowledge graph with wizard-based setup
/kmgraph:statusDisplay active KG health, file counts, and warnings--minimal, --json
/kmgraph:recallFull-text search across lessons, ADRs, KG entries, sessions, and MEMORY.md--scope=all|active|personal-only, --user, --project, --named=<kg>, --format=detailed|paths
/kmgraph:capture-lessonGuided interview to document a problem solved, pattern discovered, or bug fixed--user, --project, --named=<kg>

Examples:

/kmgraph:init
/kmgraph:status
/kmgraph:recall "database timeout"
/kmgraph:recall "auth patterns" --scope=all
/kmgraph:capture-lesson

Capture & Document

CommandDescriptionKey flags
/kmgraph:capture-lessonDocument lessons learned with git metadata, duplicate detection, and optional KG extraction--user, --project, --named=<kg>
/kmgraph:create-adrCreate Architecture Decision Records with auto-numbering and index update--user, --project, --named=<kg>
/kmgraph:session-summarySummarize the active session; supports lightweight mid-session snapshot mode--auto, --snapshot, --snapshot --git, --user, --project, --named=<kg>
/kmgraph:extract-chatExport Claude and Gemini chat logs to dated markdown files--today, --date=YYYY-MM-DD, --after=, --before=, --project=, -claude, -gemini, --output-dir=
/kmgraph:handoffGenerate a multi-file handoff package (START-HERE, DOCUMENTATION-MAP, OPEN-ISSUES, etc.)--output-dir=, --skip-sessions
/kmgraph:rules-captureDetect and route a behavioral correction to rules.md or me.md (project or personal scope)

Examples:

/kmgraph:create-adr "Use PostgreSQL for primary database"
/kmgraph:session-summary --snapshot
/kmgraph:extract-chat --today
/kmgraph:extract-chat -claude --after=2026-04-01
/kmgraph:handoff --output-dir=./backup/

Search & Recall

CommandDescriptionKey flags
/kmgraph:recallSearch all project memory systems; automatically includes personal KG when registered--scope=all|active|personal-only, --user, --project, --named=<kg>, --format=detailed|paths
/kmgraph:statusHigh-level KG overview: file counts, last sync, MEMORY.md warnings--minimal, --json
/kmgraph:update-graphExtract structured patterns from lessons and sync to knowledge graph entries--lesson=<file>, --auto, --interactive
/kmgraph:sync-allRun the full sync pipeline: extract → update → MEMORY.md → plan → GitHub--auto, --dry-run, --user, --project, --named=<kg>

Examples:

/kmgraph:recall "workflow patterns" --scope=personal-only
/kmgraph:recall "auth patterns" --user
/kmgraph:update-graph --auto
/kmgraph:update-graph --lesson=Pattern_Discovery.md
/kmgraph:sync-all --dry-run
/kmgraph:sync-all --user

Session Management

CommandDescriptionKey flags
/kmgraph:session-summaryCreate or append a session summary; snapshot mode skips the review gate--auto, --snapshot, --user, --project, --named=<kg>
/kmgraph:archive-memoryMove stale MEMORY.md entries (default: >90 days) to MEMORY-archive.md--auto, --dry-run, --threshold=<days>
/kmgraph:restore-memoryRestore archived entries back into active MEMORY.md--id=<N>, --list, --dry-run
/kmgraph:sync-allOrchestrate full knowledge sync in one command--auto, --dry-run

Examples:

/kmgraph:session-summary --auto
/kmgraph:archive-memory --dry-run
/kmgraph:archive-memory --threshold=180
/kmgraph:restore-memory "Git Pre-Commit"
/kmgraph:restore-memory --list

Configuration

CommandDescriptionKey flags
/kmgraph:initCreate a new KG with wizard; optionally backfills from existing project context
/kmgraph:init-personal-kgCreate a personal KG at ~/.kmgraph/ for cross-project lessons
/kmgraph:add-categoryAdd a new category directory and KG entry file to an existing knowledge graph--prefix <p>, --git ignore|commit
/kmgraph:listList all configured knowledge graphs from ~/.claude/kg-config.json--names-only, --json
/kmgraph:switchChange the active knowledge graph--force
/kmgraph:config-sanitizationInstall a pre-commit hook for sensitive-data detection with interactive pattern wizard
/kmgraph:check-sensitiveScan active KG files for emails, API keys, and internal URLs before sharing--fix-suggestions
/kmgraph:update-docUpdate plugin or project documentation with standards validation and diff preview--user-facing
/kmgraph:setup-platformDetect installed AI tools and configure KMGraph integrations per platform

Examples:

/kmgraph:init-personal-kg
/kmgraph:add-category security
/kmgraph:add-category ml-ops --prefix ml- --git ignore
/kmgraph:switch ai-research
/kmgraph:check-sensitive
/kmgraph:update-doc COMMAND-GUIDE.md --user-facing

Advanced

CommandDescriptionKey flags
/kmgraph:start-issue-trackingStructured issue tracking: documentation templates, implementation plan, and Git branch
/kmgraph:meta-issueTrack complex multi-attempt problems with attempt folders and root-cause evolution--add-attempt <N> "<desc>", --update-understanding "<text>", --status
/kmgraph:update-issue-planSync KG extraction with active plans and post a progress comment to GitHub Issues--auto, --pr=<N>
/kmgraph:link-issueManually link an existing lesson or ADR to a GitHub Issue with bidirectional references--issue <N>, --pr <N>
/kmgraph:handoffGenerate a full handoff package before transitions, context resets, or onboarding--output-dir=, --skip-sessions

Examples:

/kmgraph:start-issue-tracking "CLI flag parsing fails on quoted args"
/kmgraph:meta-issue "Authentication Redesign"
/kmgraph:meta-issue --add-attempt 002 "OAuth2 with JWT"
/kmgraph:meta-issue --status
/kmgraph:update-issue-plan --pr=42
/kmgraph:link-issue docs/lessons-learned/process/my-lesson.md --issue 42

Advanced Flags

These flags appear across multiple commands and share consistent behavior.

FlagCommandsBehavior
--autoupdate-graph, session-summary, sync-all, update-issue-plan, archive-memorySkip confirmation prompts; silent/non-interactive mode. Safe for use when called from another command.
--dry-runsync-all, archive-memory, restore-memoryPreview changes without writing any files. Useful for verifying scope before committing.
--snapshotsession-summaryLightweight mid-session capture. Appends to today's session file without a review gate. Used automatically by capture-lesson, create-adr, and start-issue-tracking when the user opts in.
--targetKgMCP tools (kg_capture, kg_search)Target a specific knowledge graph by name instead of the currently active KG.
--delegateAdvanced usageSignals that execution should be handed off to the agent layer rather than handled inline. Applies to thin-dispatcher commands that route to agents/.
--usersession-summary, create-adr, capture-lesson, recall, sync-allRoute capture or search to the personal KG (~/.kmgraph/). Bypasses kg_capture; writes directly via the Write tool. Natural-language equivalent: "user level" / "for the user".
--projectsession-summary, create-adr, capture-lesson, recall, sync-allRoute to the current project's KG. Temporarily switches the active KG if it differs, then restores after capture. Natural-language equivalent: "for this project" / "project level".
--named=<kg>session-summary, create-adr, capture-lesson, recall, sync-allRoute to a specific named KG from kg-config.json. No KG switch. Natural-language equivalent: naming the KG directly (e.g., "career-ops").