Skip to main content

The Automation Layer

KMGraph runs a layer of automation that fires without explicit commands. This page explains what that automation consists of, when each piece fires, and how the parts work together.

Three components

The automation layer has three components that work at different points in the development workflow:

ComponentWhenWhat it does
HooksAt Claude Code lifecycle events (SessionStart, PostToolUse, Stop, Notification)Runs shell scripts that provide context, prompt for captures, or enforce quality gates
SkillsWhen natural-language patterns match in conversationSurfaces suggestions and pre-fills command context
AgentsWhen a command delegates heavy-lift workRuns isolated sub-processes that do not crowd the main context

How they connect

Skills and their trigger keywords

Skills listen for natural-language signals. They never execute commands automatically — they surface suggestions.

SkillExample trigger phrases
lesson-capture"figured it out", "solved it", "the fix was", "turns out the issue was"
kg-recall"have we done this before", "did we solve this", "what was the pattern for"
session-wrap"I'm wrapping up", "stopping for the day", context limit approaching
adr-guide"I'm thinking of using", "should we use X or Y", "architectural decision"
capture-router"capture that", "remember that", "save that", "let's document this"
doc-update-router"update the docs", "update the changelog", "update the session summary"
stuck-work-escalation3+ failed attempts on same problem, 30+ min without resolution, "still blocked", "tried everything"
docs-impact-scan"push to origin", "push and merge", "open PR", "create PR", "finishing up", "ready to push"
sidebar-updateDoc file moved or renamed, git mv docs/..., "move [doc]", "rename [doc]"

Hooks and their lifecycle events

Hook scriptFires onDefault
hooks-master.sh (router)All eventsEnabled
session-end-prompt.shStopPrompts for session summary
post-tool-lesson-check.shPostToolUsePrompts for lesson capture after certain tools
platform-file-change-check.shPostToolUseDetects changes to CLAUDE.md / AGENTS.md
plan-mirror.shPostToolUseMirrors plan files from ~/.claude/plans/ to docs/plans/
pre-commit-knowledge-gate.shPreToolUse (git commit)Prompts for knowledge capture before commit
notification-dispatch.shNotificationSends webhook (opt-in — requires webhookUrl)

The capture-router: type detection from content signals

The capture-router skill auto-detects the correct capture destination from what the user describes. When a user says "capture that" or "remember that", the skill reads the content signals to route:

Content signalCaptured as
"I fixed a bug..." / "the solution was..."Lesson (category: debugging)
"We decided to use..." / "the trade-off is..."ADR
"Every time I see X, I should Y..."Pattern (category: patterns)
"Today I worked on..." / "this session..."Session summary

The router presents a single confirmation before writing. No silent writes.

Disabling automation

Any hook or skill can be disabled independently. See:

  • Customize hooks — disable individual hook scripts or all hooks
  • Skills cannot be fully disabled but can be ignored; they only surface suggestions