Historical snapshot: this plan describes the original wiki-memory MVP slice. The current implementation direction starts from memory-substrate naming and a governed memory core.
Implement the smallest end-to-end slice that validates the architecture without collapsing back into an ad hoc wiki tool.
Phase 1 must prove:
- the five-object semantic core works in code
- repo ingest can create stable objects
- query can build a useful context pack
- agent work can crystallize back into the system
- structural lint can validate basic integrity
Build only these user-visible capabilities:
wiki.ingest(mode=repo)wiki.query(mode=context)wiki.query(mode=expand)wiki.crystallize(mode=activity)wiki.crystallize(mode=knowledge)wiki.crystallize(mode=work_item)wiki.lint(mode=structure)wiki.lint(mode=audit)
Do not build in phase 1:
- PDF ingest
- web ingest
- vector search
- graph DB
- semantic lint
- UI
- multi-user behavior
Order matters. Build from semantic core outward.
Implement stable schemas for:
SourceNodeKnowledgeActivityWorkItemEvidenceRefContextPackWikiPatchAuditEvent
Requirements:
- stable
id - explicit status fields
- timestamp fields
- typed payloads where required
Implement file-backed repositories for:
- objects
- patches
- audit log
Storage rules:
- one object per JSON file
- append-only JSONL for audit
- no markdown as source of truth
Implement:
- patch model
- patch applier
- audit append on mutation
Required patch operations in phase 1:
create_objectupdate_objectchange_statusarchive_object
Implement repo ingest pipeline:
- register repo source
- normalize repo payload
- extract candidate nodes
- extract candidate knowledge
- emit initial activity
- apply patch
Phase 1 repo ingest may use lightweight heuristics first, with Tree-sitter integration kept behind the repo adapter boundary.
Tree-sitter use in phase 1:
- file language detection
- symbol extraction for supported languages
- basic API/module discovery
Do not overfit early extraction quality. The goal is stable structure, not perfect repo understanding.
Implement two-step query flow:
context: build a useful startingContextPackexpand: retrieve deeper content around selected objects or sources
Phase 1 query ranking inputs:
- related nodes
- active knowledge
- recent activities
- active work items
- source references
No embedding or graph dependency required in phase 1.
Implement write-back flow:
- record
Activity - produce
Knowledge - produce
WorkItem
Crystallization rule:
- only persist reusable outputs
- do not dump raw chain-of-thought or transient chat text into the core
Implement integrity checks for:
- missing referenced object ids
- broken evidence references
- invalid statuses
- duplicate ids
- invalid projection links
Implement markdown projection for:
- sources
- nodes
- knowledge
- activities
- work items
Projection is derived, so generation can stay simple in phase 1.
src/wiki_memory/
domain/
objects/
protocols/
services/
application/
ingest/
query/
crystallize/
lint/
infrastructure/
repositories/
storage/
adapters/
repo/
projections/
markdown/
interfaces/
mcp/
application.ingest.serviceadapters.repo.adapter
application.query.servicedomain.services.context_builder
application.crystallize.servicedomain.services.crystallizer
application.lint.servicedomain.services.structure_lint
Phase 1 is complete when all of the following are true:
- A repo path can be ingested into
Source,Node, candidateKnowledge, and initialActivity. wiki.query(mode=context)returns a coherentContextPack.wiki.query(mode=expand)can retrieve more detail around a selected object or source.wiki.crystallizecan write back anActivity,Knowledge, orWorkItem.- All mutations go through
WikiPatchand produceAuditEvent. - Structural lint detects broken references and invalid core object states.
- Markdown pages can be regenerated from the object store.
After this slice is stable, expand in this order:
- improve repo adapter quality
- add semantic lint
- add web ingest
- add PDF ingest
- add lexical and vector retrieval enhancements