Summary
Explore a self-improving "work memory" layer on top of graphify's knowledge graph — inspired by #1401 and Perplexity's "Brain" (a context graph of the agent's work that, on a schedule, reviews itself and "learns to do the work better": remembering what worked/failed, what corrections were made, and which sources were dead ends).
The interesting part: graphify already ships most of the substrate this needs. This issue proposes a concrete, scoped first slice so a contributor can pick it up. PR / design input welcome.
What graphify already has (the substrate)
| Capability |
Today in graphify |
| Context graph |
the knowledge graph |
| Auto-loadable LLM wiki |
graphify export wiki → wiki/index.md + per-community/per-node pages (the skill already tells agents to navigate it) |
| Provenance / "show your work" |
every node & edge carries source_file / source_location |
| Incremental refresh |
graphify update, watch, git hooks |
| Usage feedback loop |
save_query_result / graphify save-result → graphify-out/memory/ re-ingested into the graph on the next build (graphify/ingest.py) |
The gap (what "self-improving memory" adds)
- Memory of the work, not just the corpus. graphify graphs your code/docs; this would also capture sessions, outcomes, and corrections — "this query/answer was useful," "this source was a dead end," "the user corrected X."
- A scheduled reflection pass. A
graphify reflect-style step (cron/overnight) that reviews the accumulated work-memory + graph and synthesizes durable lessons back into the wiki/graph — the actual "self-improving" piece.
- A corrections/mistakes loop — reweight or prune memory from dead ends and corrections so future retrieval improves.
Layer split (why this is mostly thin glue + one new step)
graphify is the memory substrate (graph + wiki + provenance + feedback ingestion); the autonomous loop is largely agent orchestration on top. Much is feasible with today's primitives:
- Feasible now: record session outcomes/corrections as memory docs (extend
save-result with an outcome/correction field), then cron a graphify update to fold them in.
- The novel piece worth building: a
graphify reflect step that reads the work-memory + graph and writes a synthesized "lessons / preferred sources / known-dead-ends" wiki page the agent loads next session.
Proposed first slice (scoped for a PR)
- Extend
save_query_result / save-result to record an optional outcome signal (useful / dead_end / corrected, plus the correction text) in the memory doc's frontmatter.
- Add a minimal
graphify reflect command that scans graphify-out/memory/, aggregates outcomes by topic/community, and writes a wiki/_LESSONS.md (or a reflections/ doc) summarizing "what worked / preferred sources / dead ends" — deterministic first (no LLM), LLM-synthesis optional behind a backend flag.
- Tests + a worked example showing a second session benefiting from the first.
Out of scope (for the first slice)
- Fully autonomous overnight scheduling (leave to the user's cron / the agent host).
- Per-user preference memory (this is work memory, per the Brain framing).
Acceptance criteria
save-result can persist an outcome/correction; it round-trips into the graph.
graphify reflect produces a deterministic lessons artifact the agent can load.
- No change to existing default behavior; full suite +
skillgen-check green.
Filed from the discussion in #1401. This is exploratory — happy to refine scope with whoever picks it up.
Summary
Explore a self-improving "work memory" layer on top of graphify's knowledge graph — inspired by #1401 and Perplexity's "Brain" (a context graph of the agent's work that, on a schedule, reviews itself and "learns to do the work better": remembering what worked/failed, what corrections were made, and which sources were dead ends).
The interesting part: graphify already ships most of the substrate this needs. This issue proposes a concrete, scoped first slice so a contributor can pick it up. PR / design input welcome.
What graphify already has (the substrate)
graphify export wiki→wiki/index.md+ per-community/per-node pages (the skill already tells agents to navigate it)source_file/source_locationgraphify update,watch, git hookssave_query_result/graphify save-result→graphify-out/memory/re-ingested into the graph on the next build (graphify/ingest.py)The gap (what "self-improving memory" adds)
graphify reflect-style step (cron/overnight) that reviews the accumulated work-memory + graph and synthesizes durable lessons back into the wiki/graph — the actual "self-improving" piece.Layer split (why this is mostly thin glue + one new step)
graphify is the memory substrate (graph + wiki + provenance + feedback ingestion); the autonomous loop is largely agent orchestration on top. Much is feasible with today's primitives:
save-resultwith an outcome/correction field), then cron agraphify updateto fold them in.graphify reflectstep that reads the work-memory + graph and writes a synthesized "lessons / preferred sources / known-dead-ends" wiki page the agent loads next session.Proposed first slice (scoped for a PR)
save_query_result/save-resultto record an optional outcome signal (useful/dead_end/corrected, plus the correction text) in the memory doc's frontmatter.graphify reflectcommand that scansgraphify-out/memory/, aggregates outcomes by topic/community, and writes awiki/_LESSONS.md(or areflections/doc) summarizing "what worked / preferred sources / dead ends" — deterministic first (no LLM), LLM-synthesis optional behind a backend flag.Out of scope (for the first slice)
Acceptance criteria
save-resultcan persist an outcome/correction; it round-trips into the graph.graphify reflectproduces a deterministic lessons artifact the agent can load.skillgen-checkgreen.Filed from the discussion in #1401. This is exploratory — happy to refine scope with whoever picks it up.