Skip to content

feat(pi): add Topic Memory read tools - #1608

Merged
Teingi merged 1 commit into
oceanbase:masterfrom
wutongyuonce:feat/pi-topic-memory-read
Sep 15, 2026
Merged

Teingi merged 1 commit into
oceanbase:masterfrom
wutongyuonce:feat/pi-topic-memory-read

Conversation

@wutongyuonce

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #1607.

This is a follow-up to the capability-alignment direction in #1338. Topic Memory query support was not explicitly enumerated as a #1338 Pi gap, so this PR does not claim to implement an item listed in that issue.

Rationale for this change

PowerContext already exposes read-only Topic Memory APIs, but Pi cannot query them through native pc_* tools. Pi can receive Topic Memory indirectly through bounded prepare_context, but it cannot explicitly search current Topic Memory heads or inspect one exact Topic Memory revision with its direct Source evidence.

Design and implementation

The implementation follows Issue #1607's design without scope expansion:

  • register pc_topic_search for focused queries over current Topic Memory heads;
  • register pc_topic_get for exact Topic Memory Artifact references returned by search;
  • keep limit runtime-normalized to the Server contract range 1–20 with default 10;
  • keep retrieval-mode selection deployment-owned by the Server; Pi exposes no FTS/vector/hybrid control;
  • route both tools through the existing registerOperationTool and invokeScopedOperation path;
  • preserve current workspace-to-Scope resolution and Scope injection;
  • keep both operations read-only, so they do not request durable-write confirmation;
  • mark returned Topic Memory as untrusted historical evidence, not an instruction source;
  • add the dedicated topic_memory_read capability without changing the profile capability sets;
  • update the Pi package guidance, project-context skill, bilingual integration docs, and generated capability docs.

The final design is intentionally limited to querying existing Topic Memory. It does not add Topic Memory creation, update, deletion, retirement, approval, generation, or flush controls.

Validation

  • Pi package pnpm test: 13 files, 89 tests passed, including real Pi CLI package loading
  • Pi package pnpm run typecheck
  • uv run --frozen python -m pytest tests/test_integration_manifest.py -q: 26 passed
  • uv run --frozen python scripts/generate_integration_manifest_docs.py --check
  • uv run --frozen ty check
  • git diff --check
  • independent read-only review by Codex GPT-5.6 Luna with medium reasoning: no remaining actionable findings

The implementation was tested against the latest origin/master available when the branch was created.

AI usage statement

OpenAI Codex with GPT-5.6 Sol was used for design, implementation, and verification. A separate OpenAI Codex task using GPT-5.6 Luna with medium reasoning performed the independent read-only review and the requested remediation loop.

@Teingi
Teingi merged commit 13518e4 into oceanbase:master Sep 15, 2026
18 checks passed
@wutongyuonce
wutongyuonce deleted the feat/pi-topic-memory-read branch September 15, 2026 10:33
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.

feat(pi): expose Topic Memory read tools

1 participant