Files
obsidian-vault/wiki/wiki-ingest-process.md
T

101 lines
3.1 KiB
Markdown

---
source: raw/wiki-ingest-prompt.md
content_hash: f751c64c7b2b2fa39b9606303ac00f5069315c5688b7858b1c79c5d23db66f9b
namespace: work
last_synced: 2026-05-28
confidence: 0.9
tags: [wiki, ingest, agent, prompt]
---
# Wiki Ingest Process
The agent prompt that maintains `~/obsidian/wiki/` as a synthesised
knowledge base over external project files exposed via symlinks in
`~/obsidian/raw/`. Run locally by `claude -p` (the launchd job
`run-wiki-ingest.sh` at 22:00) — not via API, because file-system
writes require a local Claude Code session. See
[[personal-os-architecture]] for where this fits in the broader system.
## Discovery loop
For every file in `~/obsidian/raw/`:
1. Read the file (skip if the symlink target is missing).
2. Compute SHA256 with `shasum -a 256`.
3. Look for a wiki page whose frontmatter has `source: raw/<filename>`.
4. If a page exists and its `content_hash` already matches, skip.
5. Otherwise enqueue for synthesis.
If nothing changed, the agent prints
"Wiki is up to date. Nothing to ingest." and exits.
## Synthesis rules
- Wiki pages are named by **topic**, not source filename
(e.g. `personal-os-schema.md`, not `schema.md`).
- Output is a **synthesis**, never a verbatim copy. Extract facts,
decisions, and structure. Hard cap of 800 words per page; split
into linked pages if the topic is larger.
- Use `[[double brackets]]` for cross-references between wiki pages.
## Page format
Frontmatter is the source of truth for incremental ingestion:
```yaml
source: raw/<filename>
content_hash: <sha256>
namespace: work
last_synced: <YYYY-MM-DD>
confidence: 0.8
tags: [tag1, tag2]
```
Body has a title, synthesis prose, a `## Key Points` list, and a
`## Related` line of `[[wiki-links]]`.
## Confidence ladder
- **1.0** — reserved for human-written notes in `work/`, `personal/`,
`family/`. The agent must never edit these files.
- **0.9** — highly structured / authoritative source (e.g. a schema).
- **0.8** — clear single source. Default.
- **0.6** — inferred or partial content.
## Hard rules
- Never copy source files verbatim — always synthesise.
- Never edit any file with `confidence: 1.0`.
- Never process files in `namespace: family` unless explicitly told.
- Always update `content_hash` and `last_synced` after writing a page.
- Skip broken symlinks; do not create a wiki page for them.
## Reporting
After the run, the agent emits a summary:
```
Wiki Ingest — <date>
Processed: N files
Created: N new pages
Updated: N pages
Skipped: N (unchanged)
Pages updated:
- wiki/<filename> (source: raw/<source>)
```
## Key Points
- Hash-based incremental: re-runs are cheap when nothing changed.
- Topic-named pages decouple the wiki from source-file naming.
- Frontmatter `source` + `content_hash` is the ingestion contract;
the [[personal-os-schema]] mirrors the same idea in `wiki_pages`.
- Human-edited (confidence 1.0) pages are immutable to the agent —
the trust boundary between synthesis and curated knowledge.
- Local-only execution: writes to `~/obsidian/` need a real FS,
so the job runs under launchd via `claude -p`, not the API.
## Related
[[personal-os-architecture]] [[personal-os-schema]]