Skip to content

feat(research): document format standard and agent memory - #257

Merged
BerryUIKI merged 4 commits into
mainfrom
feature/research-context-tools
Nov 7, 2026
Merged

BerryUIKI merged 4 commits into
mainfrom
feature/research-context-tools

Conversation

@BerryUIKI

Copy link
Copy Markdown
Owner

Summary

Implements the agreed document-format and agent-memory standards.

Document format

  • Research document bodies are Markdown by default (format may be text).
  • Migration 0005_research_documents_metadata adds kind (note/web/pdf/agent), format, summary, and archived_at.
  • Deletion now archives (archived_at); purge_research_document permanently removes an archived document and cascades its sources/notes. Archived documents are excluded from lists, search, and agent context.
  • The editor gains a Preview toggle rendering sanitized Markdown (react-markdown + rehype-sanitize), with raw HTML skipped and links shown as text.

Agent memory

  • Context now includes the workspace ID and up to five recent research-document summaries (400 chars each), alongside recent completed tasks, within a roughly 4,000-character budget.
  • New read-only tools: search_research (ids, titles, excerpts) and get_research_document (content capped at 8,000 chars).
  • ResearchOutput accepts validated citations (document/task id + title, max 20, invalid entries dropped); the task detail lists them.
  • docs/AGENT_MEMORY.md documents layers, budget, tools, citations, write policy, retention, and security.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --workspace - repository, service, context, tool, and citation tests
  • pnpm typecheck
  • eslint on changed files
  • node node_modules/vitest/vitest.mjs run --pool=forks - 16 files, 72 tests
  • pnpm build - main chunk ~414 KB (Markdown renderer); artifact chunk remains ~1 KB

- add kind/format/summary/archived_at via migration 0005
- archive documents by default and purge explicitly with cascaded sources/notes
- include recent document summaries in agent context with a 4k-character budget
- add search_research and get_research_document tools
- accept validated citations in research output
- cover repository, service, context, tools, and runtime tests
- render sanitized Markdown with raw HTML skipped and links as text
- add an editor preview toggle and document kind labels
- show stored citations in the task detail view
- add tests for preview rendering and citation parsing
- add docs/AGENT_MEMORY.md covering memory layers, context budget, tools, citations, and write policy
- document Markdown/metadata/soft-delete conventions in DATA_MODEL.md
- update AGENT_PROTOCOL, ARCHITECTURE, CLAUDE.md, roadmap, and changelog
EmptyContextProvider keeps the task's workspace id, not the task id.
@BerryUIKI
BerryUIKI merged commit 32d4872 into main Nov 7, 2026
4 checks passed
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.

1 participant