Skip to content

feat(topic-memory): add end-to-end topic memory - #1490

Merged
Teingi merged 51 commits into
oceanbase:masterfrom
frf12:review/powe-97-r13-4189638b
Sep 8, 2026
Merged

Teingi merged 51 commits into
oceanbase:masterfrom
frf12:review/powe-97-r13-4189638b

Conversation

@frf12

@frf12 frf12 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Which issue or RFC does this PR close?

Implements the Topic Memory RFC introduced in #1417.

Rationale for this change

PowerContext captures detailed Sources, but long-running agents also need durable, scoped knowledge that can be evolved, searched, and reused across sessions. Topic Memory turns accepted Sources into long-lived Topic Artifacts while preserving evidence lineage, Scope isolation, publication consistency, and bounded model/resource use.

This change implements that lifecycle end to end rather than exposing an isolated storage or UI layer: Source capture raises durable processing intent, background workers generate and atomically publish Topic revisions, retrieval makes the active projection available to agents, and operators can inspect the same published state from the Dashboard.

What changes are included in this PR?

  • Add the topic-memory Artifact family, Markdown chunking, immutable revisions, evidence lineage, current-head projections, and SQLite/OceanBase lexical plus optional vector/hybrid indexes.
  • Persist processing Pending state, Cursors, frozen automatic waves, Leases, fencing generations, retries, and per-binding scheduling. Source capture and Pending updates share one transaction; publication validates Lease, Cursor generation, and Topic head compare-and-swap guards in one short transaction.
  • Add the bounded generation pipeline for Probe, planning, CREATE/UPDATE/NOOP evolution, related-topic coordination, and conflict-safe retries. Model calls run outside database transactions, provider input/output is budgeted, and server-owned identities and evidence are never delegated to model output.
  • Expose scoped flush, search, and exact-get operations through OpenAPI, generated clients, HTTP, MCP capabilities, and the Codex project-context skill. Prepared context can include retrieved Topic Memory without weakening existing Scope or authorization boundaries.
  • Add the read-only /topics Dashboard with Scope selection, search, sorting, pagination, list/detail views, source and publication explanations, localized navigation, responsive layouts, and stale-response protection. The page does not create, edit, or delete Topic Memory.
  • Add configuration, readiness, deployment-role, troubleshooting, and bilingual RFC/documentation updates. Optional retrieval channels activate only when their complete configuration and indexes are ready.
  • Add repository, runtime, API, browser, and product-chain coverage for persistence semantics, generation, atomic publication, retrieval bounds, credential isolation, and a real local Codex-to-Dashboard workflow.

Are there any user-facing changes?

  • Agents can call search_topic_memory and get_topic_memory to reuse current Topic knowledge for the active Scope. Operators can request a flush through POST /v1/topic-memory/flush.
  • The Dashboard now includes a read-only Topics page. Results remain Scope-isolated and expose current publication metadata and evidence without providing mutation controls.
  • Topic processing can run with the API process or the supported background deployment role. Invalid model budgets, incomplete vector configuration, or unsupported scheduler combinations fail readiness instead of silently degrading processing.
  • Database initialization adds the Topic Memory processing, publication, projection, and index structures. Existing Artifact families and unfiltered prepared-context behavior remain supported.

How was this change tested?

Local validation covered the complete feature branch at 4189638ba6851b2686c0bb94ce5138fb5e70663e. These are local results, not a claim that remote CI has passed.

  • make test: 1263 passed, 11 skipped.
  • make check: passed, including manifest, lock, formatting, lint, and type checks.
  • make contract-test: 30 passed.
  • make build: passed.
  • Focused Topic Memory product-chain suite: 15 passed.
  • Real local acceptance passed from Codex Source capture through background generation, search/exact retrieval, prepared context, and the /topics Dashboard.
  • Python 3.11 and 3.13 credential-isolation acceptance passed; browser requests were verified not to receive the generation or embedding provider credentials.
  • Cumulative git diff --check passed.

Known validation limitations:

  • Remote CI is pending.
  • Live OceanBase/SeekDB and a real external embedding provider were not available for the final acceptance run; their dialect, configuration, fail-closed, and adapter contracts are covered by local tests.

AI usage statement

OpenAI Codex assisted with implementation, review-driven fixes, regression tests, documentation, and local product acceptance. The results above come from executed tests and real local PowerContext/Codex/browser processes; AI assistance is not a substitute for maintainer review or CI.

frf12 added 30 commits September 3, 2026 02:45
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
@CLAassistant

CLAassistant commented Sep 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Teingi

Teingi commented Sep 7, 2026

Copy link
Copy Markdown
Member

resolve conflicts

@frf12 frf12 changed the title POWE-72: add end-to-end Topic Memory feat(topic-memory): add end-to-end topic memory Sep 7, 2026
Co-authored-by: multica-agent <github@multica.ai>
@frf12
frf12 force-pushed the review/powe-97-r13-4189638b branch from e8daf49 to c68a335 Compare September 7, 2026 16:06
frf12 and others added 7 commits September 8, 2026 01:11
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
…ries

Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Comment thread src/powercontext/builtin/persistence/topic_memory.py
Comment thread src/powercontext/builtin/runtime/artifact_processing.py Outdated
Comment thread src/powercontext/builtin/runtime/composition.py
Comment thread src/powercontext/builtin/persistence/sqlite/topic_memory_index.py
Comment thread src/powercontext/builtin/runtime/topic_memory_processing.py Outdated
@Teingi

Teingi commented Sep 8, 2026

Copy link
Copy Markdown
Member

resolve conflicts

@Teingi Teingi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teingi
Teingi merged commit b2ce8ba into oceanbase:master Sep 8, 2026
17 checks passed
frf12 added a commit to frf12/powercontext that referenced this pull request Sep 13, 2026
docs/superpowers/ is declared in .gitignore as local agent artifacts
(rule added in oceanbase#1323), but this brainstorming working spec was tracked
before that and slipped into upstream via oceanbase#1490, then got touched again
by oceanbase#1512. Its content (RFC 1417 persistence milestone design) is already
covered by docs/en/rfcs/1417_topic_memory.md and
docs/zh/rfcs/1417_topic_memory.md.
PsiACE pushed a commit that referenced this pull request Sep 13, 2026
docs/superpowers/ is declared in .gitignore as local agent artifacts
(rule added in #1323), but this brainstorming working spec was tracked
before that and slipped into upstream via #1490, then got touched again
by #1512. Its content (RFC 1417 persistence milestone design) is already
covered by docs/en/rfcs/1417_topic_memory.md and
docs/zh/rfcs/1417_topic_memory.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants