@rackrot/pi-wiki2.0.0
A human-readable wiki built from coding-agent sessions, inside the pi-memory Obsidian vault, as an Open Knowledge Format bundle
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@rackrot/pi-wiki
A human-readable wiki distilled from coding-agent sessions, kept in the same Obsidian vault and git repo as @rackrot/pi-memory. The wiki folder is an Open Knowledge Format v0.3 bundle.
Status: ingest works on demand (/wiki-drain or pi-wiki drain) or on a systemd timer (wiki.schedule).
Config
Key wiki in the rackrot config (/rackrot-config wiki):
| Key | Default | |
|---|---|---|
enabled |
false |
Queue finished sessions on shutdown |
name |
"Wiki" |
Folder under memory.root. A plain folder name; global config only |
model |
none | Concrete provider/model (no alias). Never falls back to the session model |
maxPagesPerIngest |
10 |
A larger proposal returns needs-review and is not applied |
maxCharsPerRun |
120000 |
Transcript characters ingested per drain; the rest stays queued |
schedule |
manual |
manual, daily, weekly or monthly: how often the timer runs a drain |
scheduleTime |
03:00 |
Local HH:MM of the daily, weekly and monthly runs |
scheduleDay |
mon |
sun–sat; the weekly run |
scheduleDayOfMonth |
1 |
1–28; the monthly run |
The vault root is memory.root. Run /wiki-init to create the folder.
Schedule
pi-wiki timer install (or /wiki-timer install) writes ~/.config/systemd/user/pi-wiki-drain.service and .timer from the schedule settings (OnCalendar, e.g. Mon *-*-* 03:00:00, Persistent=true, working directory the vault) and runs systemctl --user daemon-reload and enable --now pi-wiki-drain.timer; the service runs pi-wiki drain, so it needs wiki.model and the usual lease applies. timer remove undoes it. Install refuses while schedule is manual, and re-run it after changing the schedule. Unlike pi-memory, sessions never start a drain themselves. pi-wiki status shows the schedule and whether the timer is installed.
Vault layout
<memory.root>/
Agent/ pi-memory's notes; the wiki never writes here
Wiki/ OKF bundle root
index.md generated: okf_version, title, description, links to every page
log.md generated: `## YYYY-MM-DD` newest first, Creation/Update/Deprecation bullets
Wiki.base starter Obsidian Bases views; written once, never overwritten
sources/ one `source` page per session
topics/ entities/
.pi-wiki/ state.json (ingested sessions), queue.json (git-ignored); outside the bundle
Pages are typed concepts with title, description, tags, sources (stable ids cited in the body as [^id] footnotes), generated, status, updated, confidence. Own keys are prefixed x-pi-wiki-. A human verified entry or any unknown key is never touched; an agent rewrite only moves generated.at, so the page drops back to unverified by OKF's trust rules.
Writes are validated in code and applied all-or-nothing (applyProposal): paths must be <sources|topics|entities>/<slug>.md; links are relative and must resolve; footnotes need a source; sources may only cite known sessions; secrets are refused.
Ingest and drain
Shutdown only queues a session. Nothing calls a model until you ask:
/wiki-drainin pi, orpi-wiki drainin a shell, ingests queued sessions oldest first withwiki.model. It stops oncemaxCharsPerRuntranscript characters are spent (the first session always runs) and leaves the rest queued.- Per session: the transcript (user and assistant prose, tool calls dropped; secrets replaced by
[redacted]before the model sees it), the existing page list, and pi-memory's digest of the session if one exists (read-only) go into ONE model call. The reply is validated and applied byapplyProposal. A rejected reply is retried once with the reasons; if still rejected the session is recorded as failed in.pi-wiki/failed.json, nothing is written and it leaves the queue. Sessions with fewer than 3 user messages are skipped. - A model error (network, limits) stops the drain and leaves the session queued.
- Shutdown queues a session only if its file exists (pi writes it with the first message;
--no-sessionhas none) and records the host. A drain on another host leaves items written elsewhere queued; a missing file on the same host is recorded as failed and dropped. - A proposal over
maxPagesPerIngestis saved to.pi-wiki/review/<session>.jsoninstead of applied. - A lease (
.pi-wiki/lease.json, 10 minute expiry) stops two drains running at once. Re-running after a crash is safe.
Validation: the ingest reply is requested against a schema (IngestReply, sent as a submit tool and in the prompt), and applyProposal still rejects a proposal in code with reasons for the retry, now also when a page's frontmatter would not be valid OKF v0.3 (checked against the schema in pi-core; problems a page already had do not block an update). wiki lint reports schema violations as okf-schema warnings and a source without resource as the source-resource error. .pi-wiki/state.json, queue.json, failed.json and the lease are checked against schemas; a corrupt state.json raises instead of resetting, since an empty state would ingest every session again.
CLI
pi-wiki <command> (needs memory.root; drain also needs wiki.model):
| Command | Does |
|---|---|
init |
Same as /wiki-init |
drain [--dry-run] |
Ingest the queue. --dry-run lists sessions and writes nothing |
status |
Queue length, failed sessions, review items |
review [list|show|apply|reject <session>] |
Handle proposals that were over the page limit |
lint |
Print findings; exit status 1 if any is an error |
timer install|remove |
The systemd timer that runs drain on wiki.schedule |
Obsidian requirements
Turn off Settings > Files and links > "Use [[Wikilinks]]" and set "New link format" to "Relative path to file". The wiki uses relative Markdown links only; /abs links resolve from the vault root in Obsidian, not the wiki root.
Not yet implemented
- Lint (stale pages, orphans, broken links, deprecated chains)
- Index/log pagination for large wikis