From 6d9617a44fd7701287bc663125d3938beed611c1 Mon Sep 17 00:00:00 2001 From: safishamsi Date: Wed, 24 Jun 2026 11:50:07 +0100 Subject: [PATCH] feat: zero-config work-memory adoption via skill + git hooks (#1441) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the self-improving loop "just work" once graphify is installed: - Skill: the query reference now tells the agent to read graphify-out/reflections/LESSONS.md at the start of graph work (start from preferred sources, skip known dead ends, see prior corrections) and to record --outcome useful|dead_end|corrected (+ --correction) on save-result. - Hooks: the post-commit and post-checkout rebuild bodies now auto-run reflect after _rebuild_code — best-effort, only when graphify-out/memory/ holds saved outcomes, and never fails the hook — so LESSONS.md refreshes on every rebuild without a manual `graphify reflect`. Regenerated the per-host references/query.md and re-blessed expected/; all five skillgen guards pass (check, audit-coverage, schema-singleton, monolith-roundtrip, always-on-roundtrip). Verified end-to-end: install hook, save-result --outcome, commit a code change -> hook rebuilds and writes LESSONS.md with the outcome. Full suite 2383 passed; ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + graphify/hooks.py | 22 +++++++++++++++++++ graphify/skills/agents/references/query.md | 8 +++++++ graphify/skills/amp/references/query.md | 8 +++++++ graphify/skills/claude/references/query.md | 8 +++++++ graphify/skills/claw/references/query.md | 8 +++++++ graphify/skills/codex/references/query.md | 8 +++++++ graphify/skills/copilot/references/query.md | 8 +++++++ graphify/skills/droid/references/query.md | 8 +++++++ graphify/skills/kilo/references/query.md | 8 +++++++ graphify/skills/kiro/references/query.md | 8 +++++++ graphify/skills/opencode/references/query.md | 8 +++++++ graphify/skills/pi/references/query.md | 8 +++++++ graphify/skills/trae/references/query.md | 8 +++++++ graphify/skills/vscode/references/query.md | 8 +++++++ graphify/skills/windows/references/query.md | 8 +++++++ ...hify__skills__agents__references__query.md | 8 +++++++ ...raphify__skills__amp__references__query.md | 8 +++++++ ...hify__skills__claude__references__query.md | 8 +++++++ ...aphify__skills__claw__references__query.md | 8 +++++++ ...phify__skills__codex__references__query.md | 8 +++++++ ...ify__skills__copilot__references__query.md | 8 +++++++ ...phify__skills__droid__references__query.md | 8 +++++++ ...aphify__skills__kilo__references__query.md | 8 +++++++ ...aphify__skills__kiro__references__query.md | 8 +++++++ ...fy__skills__opencode__references__query.md | 8 +++++++ ...graphify__skills__pi__references__query.md | 8 +++++++ ...aphify__skills__trae__references__query.md | 8 +++++++ ...hify__skills__vscode__references__query.md | 8 +++++++ ...ify__skills__windows__references__query.md | 8 +++++++ .../fragments/references/query/default.md | 8 +++++++ 31 files changed, 255 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8516c00..22d9f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Full release notes with details on each version: [GitHub Releases](https://githu ## Unreleased +- Feat: the work-memory loop is now zero-config for agents (#1441). The skill's query reference instructs the agent to read `graphify-out/reflections/LESSONS.md` at the start of graph work (start from preferred sources, skip known dead ends) and to record an `--outcome useful|dead_end|corrected` on `save-result`; the git post-commit/post-checkout hooks now auto-run `reflect` after each rebuild — best-effort and only when saved outcomes exist — so `LESSONS.md` stays current without a manual `graphify reflect`. - Feat: a first deterministic slice of self-improving "work memory" (#1441). `graphify save-result` gains optional `--outcome useful|dead_end|corrected` and `--correction TEXT` flags that record how a saved Q&A turned out — written to the memory doc's frontmatter and an `## Outcome` body section so the signal both stays machine-readable and round-trips into the graph on the next semantic re-extraction. A new `graphify reflect` command then scans `graphify-out/memory/` and writes a deterministic `graphify-out/reflections/LESSONS.md` an agent can load at the start of the next session — grouped by community when a `graph.json` is present, flat otherwise. Source nodes are scored, not counted: each citation is a signed, time-decayed value (`useful` positive, `dead_end`/`corrected` negative, configurable half-life via `--half-life-days`, default 30), so a fresh dead end outweighs a months-old useful. A node is only promoted to "preferred" once corroborated by ≥`--min-corroboration` distinct results (default 2) — one save can't mint a trusted lesson; the rest render as "tentative", and nodes with both positive and negative signals render once as "contested" with a recency-wins verdict. Source nodes are matched to the graph by label or id, and citations whose node no longer exists are dropped so stale lessons don't linger. Deterministic, no LLM; bare `graphify save-result` and all existing behavior are unchanged. - Fix: `graphify update` now prunes a function/symbol removed from a still-present file without needing `--force`. The build already dropped the stale node (#1116), but the shrink-guard then refused to write the smaller graph ("new graph has N nodes but existing has M … Refusing to overwrite"), so the deletion silently never persisted unless you passed `--force` — leaving stale nodes (and the work-memory node-existence gate) lagging until a forced rebuild. The guard is now file-aware: a net shrink is allowed when every lost node belongs to a file re-extracted this run (or deleted), and still refused when a node disappears from a file that was *not* touched (the failed/partial-extraction case it exists to catch). - Fix: `validate_extraction` and `build_from_json` no longer crash on a non-hashable node `id` or edge `source`/`target` (e.g. a list emitted by a malformed LLM extraction) — previously a single bad node raised `TypeError: unhashable type` and aborted the entire build of an otherwise-complete corpus. The validator now reports the bad id/endpoint as an error string (its documented contract), and the build skips the malformed entry with a stderr warning while keeping every well-formed node/edge; non-dict nodes are still left to raise so shape diagnostics are unchanged (#1447, thanks @dschwartzi). diff --git a/graphify/hooks.py b/graphify/hooks.py index c4ff455..c85c48f 100644 --- a/graphify/hooks.py +++ b/graphify/hooks.py @@ -106,6 +106,17 @@ try: if _txt: _root = Path(_txt) _rebuild_code(_root, changed_paths=changed, force=_force) + # Refresh the work-memory lessons doc when saved Q&A outcomes exist + # (best-effort; never fails the hook). + try: + _md = (_root / _out) / 'memory' + if _md.is_dir() and any(_md.glob('*.md')): + from graphify.reflect import reflect as _reflect + _gj = (_root / _out) / 'graph.json' + _reflect(memory_dir=_md, out_path=(_root / _out) / 'reflections' / 'LESSONS.md', + graph_path=_gj if _gj.exists() else None) + except Exception: + pass except TimeoutError as exc: print(f'[graphify hook] {exc}') sys.exit(1) @@ -136,6 +147,17 @@ try: if _txt: _root = Path(_txt) _rebuild_code(_root, force=_force) + # Refresh the work-memory lessons doc when saved Q&A outcomes exist + # (best-effort; never fails the hook). + try: + _md = (_root / _out) / 'memory' + if _md.is_dir() and any(_md.glob('*.md')): + from graphify.reflect import reflect as _reflect + _gj = (_root / _out) / 'graph.json' + _reflect(memory_dir=_md, out_path=(_root / _out) / 'reflections' / 'LESSONS.md', + graph_path=_gj if _gj.exists() else None) + except Exception: + pass except TimeoutError as exc: print(f'[graphify] {exc}') sys.exit(1) diff --git a/graphify/skills/agents/references/query.md b/graphify/skills/agents/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/agents/references/query.md +++ b/graphify/skills/agents/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/amp/references/query.md b/graphify/skills/amp/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/amp/references/query.md +++ b/graphify/skills/amp/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/claude/references/query.md b/graphify/skills/claude/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/claude/references/query.md +++ b/graphify/skills/claude/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/claw/references/query.md b/graphify/skills/claw/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/claw/references/query.md +++ b/graphify/skills/claw/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/codex/references/query.md b/graphify/skills/codex/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/codex/references/query.md +++ b/graphify/skills/codex/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/copilot/references/query.md b/graphify/skills/copilot/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/copilot/references/query.md +++ b/graphify/skills/copilot/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/droid/references/query.md b/graphify/skills/droid/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/droid/references/query.md +++ b/graphify/skills/droid/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/kilo/references/query.md b/graphify/skills/kilo/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/kilo/references/query.md +++ b/graphify/skills/kilo/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/kiro/references/query.md b/graphify/skills/kiro/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/kiro/references/query.md +++ b/graphify/skills/kiro/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/opencode/references/query.md b/graphify/skills/opencode/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/opencode/references/query.md +++ b/graphify/skills/opencode/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/pi/references/query.md b/graphify/skills/pi/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/pi/references/query.md +++ b/graphify/skills/pi/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/trae/references/query.md b/graphify/skills/trae/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/trae/references/query.md +++ b/graphify/skills/trae/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/vscode/references/query.md b/graphify/skills/vscode/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/vscode/references/query.md +++ b/graphify/skills/vscode/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/graphify/skills/windows/references/query.md b/graphify/skills/windows/references/query.md index 3ed5f65..47e17b0 100644 --- a/graphify/skills/windows/references/query.md +++ b/graphify/skills/windows/references/query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__agents__references__query.md b/tools/skillgen/expected/graphify__skills__agents__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__agents__references__query.md +++ b/tools/skillgen/expected/graphify__skills__agents__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__amp__references__query.md b/tools/skillgen/expected/graphify__skills__amp__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__amp__references__query.md +++ b/tools/skillgen/expected/graphify__skills__amp__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__claude__references__query.md b/tools/skillgen/expected/graphify__skills__claude__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__claude__references__query.md +++ b/tools/skillgen/expected/graphify__skills__claude__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__claw__references__query.md b/tools/skillgen/expected/graphify__skills__claw__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__claw__references__query.md +++ b/tools/skillgen/expected/graphify__skills__claw__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__codex__references__query.md b/tools/skillgen/expected/graphify__skills__codex__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__codex__references__query.md +++ b/tools/skillgen/expected/graphify__skills__codex__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__copilot__references__query.md b/tools/skillgen/expected/graphify__skills__copilot__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__copilot__references__query.md +++ b/tools/skillgen/expected/graphify__skills__copilot__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__droid__references__query.md b/tools/skillgen/expected/graphify__skills__droid__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__droid__references__query.md +++ b/tools/skillgen/expected/graphify__skills__droid__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__kilo__references__query.md b/tools/skillgen/expected/graphify__skills__kilo__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__kilo__references__query.md +++ b/tools/skillgen/expected/graphify__skills__kilo__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__kiro__references__query.md b/tools/skillgen/expected/graphify__skills__kiro__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__kiro__references__query.md +++ b/tools/skillgen/expected/graphify__skills__kiro__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__opencode__references__query.md b/tools/skillgen/expected/graphify__skills__opencode__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__opencode__references__query.md +++ b/tools/skillgen/expected/graphify__skills__opencode__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__pi__references__query.md b/tools/skillgen/expected/graphify__skills__pi__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__pi__references__query.md +++ b/tools/skillgen/expected/graphify__skills__pi__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__trae__references__query.md b/tools/skillgen/expected/graphify__skills__trae__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__trae__references__query.md +++ b/tools/skillgen/expected/graphify__skills__trae__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__vscode__references__query.md b/tools/skillgen/expected/graphify__skills__vscode__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__vscode__references__query.md +++ b/tools/skillgen/expected/graphify__skills__vscode__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/expected/graphify__skills__windows__references__query.md b/tools/skillgen/expected/graphify__skills__windows__references__query.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/expected/graphify__skills__windows__references__query.md +++ b/tools/skillgen/expected/graphify__skills__windows__references__query.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path diff --git a/tools/skillgen/fragments/references/query/default.md b/tools/skillgen/fragments/references/query/default.md index 3ed5f65..47e17b0 100644 --- a/tools/skillgen/fragments/references/query/default.md +++ b/tools/skillgen/fragments/references/query/default.md @@ -173,6 +173,14 @@ $(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINA Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, if `graphify-out/reflections/LESSONS.md` exists, read it first: it lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. That file is regenerated automatically by the git post-commit hook after each rebuild (or run `graphify reflect` to refresh it on demand). + --- ## For /graphify path