kg-workflow
A side-effect radar for your codebase.
Every time you ask Claude to build or change a feature, kg-workflow runs a pre-flight check first — and warns you what else that change will touch before a single line is edited.
Built on understand-anything and Entire.
The problem it solves
You ask for a "small change." Claude edits the file. Three other features quietly break, because nobody flagged that 8 things depended on that function — or that this code was already deprecated, or that you decided not to do this exact thing two weeks ago.
kg-workflow stops that. Before any substantive change, it answers three questions in parallel:
| Question | Agent | Source |
|---|
| What is this code supposed to do? (intent, contract, how much you're allowed to touch) | kg-ssot-check | SSOT KG |
| What depends on it? (the blast radius — the actual side-effect signal) | kg-impl-check | Impl KG |
| Did we already decide something about this? | kg-history-check | Entire history |
A dispatcher fans those three out, merges the answers, and hands Claude a short briefing. If the change is risky, you get a warning naming the exact files, nodes, and decisions at stake — not a vague "this might affect things."
Quick start
cd your-repo
/kg-init # one-time bootstrap
/clear # so the agents register in the session
Then just work normally. Ask for a feature. The pre-flight runs automatically.
What you get from /kg-init
| Artifact | What it is |
|---|
Impl KG — .understand-anything/knowledge-graph.json | What the code IS. Built by understand-anything and auto-updated on every git commit (kg-init enables --auto-update), so the blast-radius data never goes stale. |
SSOT KG — .understand-anything-ssot/knowledge-graph.json | What the code SHOULD BE. Seeded once from the Impl KG with intent fields: status, acceptance, contract, rationale_ref, touch_budget. |
Entire tracking — .entire/ | Local prompt/decision history. Auto-enabled if the entire CLI is present. |
| The agent fleet | kg-context-dispatch (orchestrator) + the three checkers above. |
| Auto-fire hooks | A UserPromptSubmit hook nudges Claude to run the dispatch on every real prompt; a SessionStart hook runs the SSOT drift report so divergence between the frozen SSOT and the auto-updating Impl surfaces on its own. Both self-skip when there's nothing to do. |
| Scripts | scripts/ssot_seed.py (deterministic re-seed) and scripts/ssot_diff.py (drift report). |
How the pre-flight runs
User prompt: "add a retry to the upload handler"
│
▼
Hook fires → main Claude calls kg-context-dispatch
│
▼
kg-context-dispatch (classify the prompt → extract topic hints)
│
▼ fan out IN PARALLEL — one message, three agents
├───────────────────────┬───────────────────────┐
▼ ▼ ▼
kg-ssot-check kg-impl-check kg-history-check
"what SHOULD "what depends "did we decide
it do?" on it?" this already?"
status, acceptance, matching nodes + prior prompts,
contract, DEPENDENTS ◄── the decisions,
touch_budget side-effect signal sessions
│ │ │
└───────────────────────┴───────────────────────┘
│
▼
kg-context-dispatch (merge + compute side_effect_warning)
│
▼
Main Claude gets a compact JSON briefing as authoritative context.
If side_effect_warning = true → it shows you the warning BEFORE editing.
Because the three checkers run in one parallel message, wall-clock time is max(3), not sum(3).
When you get a warning
kg-context-dispatch raises side_effect_warning: true when:
- The work would breach a node's
touch_budget (SSOT says "don't change more than X here").
- An affected node has > 3 dependents and the change is behavioral — i.e. real blast radius (Impl).
- An in-scope SSOT node is
deprecated or in drift.
- A prior Entire decision contradicts what the prompt proposes.
Every warning cites specific node IDs, file paths, and decision IDs. The point is to make the side effect concrete and actionable, so you can decide before the edit — not debug after.
Why it's cheap
Sub-agents have isolated context windows. Your main session only pays for:
- one dispatcher prompt (~500 tokens), and
- one compact JSON briefing back (~1.5–3k tokens, capped).