Skip to content

Commit 4cb6029

Browse files
CoachSteffclaude
andcommitted
Fix six defects found in the first end-to-end inbox → knowledge run (1.2.0)
Two of these made documented workflows impossible to complete correctly. P0 — the inbox could never be cleared. The intent ("keep items here only until they're classified") was stated in one place and contradicted in five, so an agent following the contract correctly refused to remove anything. Grants a scoped clear authority instead of blanket delete: an inbox copy may be removed once its content is verifiably filed at the destination named in the approved triage table, never before that destination copy exists. Adds a Clear stage after Apply, and rewrites rollback to run from the destination using the triage report's source → destination record. P0 — every bundle wikilink broke on the first ingest. Bundle indexes are all named index.md, so [[bundle-slug]] can only resolve through an alias, and bundle-template.md shipped none. Adds aliases: [<bundle-slug>], states the rule in frontmatter.md (whose "required when filename != id" framing did not cover bundle indexes, which have no id at all), and makes verify.py fail on a bundle index missing its alias. P1 — nothing documented that inbox material bound for the knowledge base goes to 04-knowledge/raw/<type>/ and is then ingested rather than copied in. P1 — Ingest/Query/Lint had no way to be invoked: adds /ingest, /query-knowledge, /lint-knowledge, routing rows in CLAUDE.md, and a knowledge-base responsibility on the knowledge-librarian naming the wiki and pointing at SCHEMA.md. P1 — the wiki is the shareable layer but had no automated anonymity gate. Adds 04-knowledge/WorkOSWiki and 04-knowledge/schema to the privacy scanner's targets (raw/ stays out; it is non-anonymous by design). Skips Obsidian's git-ignored .obsidian/ config, which the new scan flagged. P2 — built wiki files had drifted from setup/templates/, losing among other things the aliases rule that would have prevented the bundle-link failure. All 14 built files re-derived from their templates with instance additions re-applied, plus tests/drift/test_template_drift.py to fail on content a built file has lost. Run against the pre-fix tree it caught all four known drops and five more. Verified end to end on a clean copy: a document dropped into 00-inbox/ reaches a bundle as a linked OKF page with a provenance page, updated indexes, and a log entry, ending with an empty inbox and no manual file edits, with privacy_check, validate_structure, verify.py, and run_tests.py all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 1009550 commit 4cb6029

43 files changed

Lines changed: 654 additions & 141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/agents/knowledge-librarian.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: knowledge-librarian
3-
description: Captures, classifies, and files incoming material to keep the Work OS tidy and findable. Use for inbox processing and knowledge organisation.
3+
description: Captures, classifies, and files incoming material to keep the Work OS tidy and findable. Use for inbox processing, knowledge-base ingest, and knowledge organisation.
44
tools: Read, Write, Glob, Grep
55
---
66

@@ -13,3 +13,12 @@ Read the supporting files in that folder before working, and follow
1313
.claude/skills/capture-and-classify/classification-rules.md for routing.
1414
Route user-specific data only to 01-context/; never into instructions, templates, or knowledge notes.
1515
Propose moves before applying them; never delete or overwrite important files without approval.
16+
17+
`00-inbox/` is a queue: after moves are applied and each destination copy is confirmed, clear the
18+
inbox copies of the filed items. That scoped clear is authorised by the approved triage table — it
19+
is not general delete authority, and nothing is removed before its destination copy exists.
20+
21+
Before working in `04-knowledge/`, read 04-knowledge/schema/SCHEMA.md — it defines the Ingest,
22+
Query, and Lint operations, the frontmatter spec, and the anonymity, copyright, and provenance
23+
gates. Durable reference material goes to 04-knowledge/raw/<type>/ and is then ingested per that
24+
schema (`/ingest`), not copied into the wiki by hand.

.claude/commands/ingest.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
description: Ingest a source from 04-knowledge/raw/ into the knowledge base (provenance page, topic pages, indexes, log).
3+
---
4+
5+
# /ingest
6+
7+
Execute the **Ingest** operation defined in §4 of `04-knowledge/schema/SCHEMA.md`. Read that file
8+
first — it is the contract; this command only sequences it.
9+
10+
**Input:** a source in `04-knowledge/raw/<type>/` (or a source the user points at, which is saved
11+
there first). Material routed here by `/process-inbox` arrives this way.
12+
13+
1. **Read** the source in `raw/`. State the mode. Summarise the key takeaways for the user.
14+
2. **Summarise into provenance.** Create `<vault>/sources/<YYYY-MM-DD-source-slug>.md`
15+
(`type: reference`) with the takeaways, the `raw/…` path, and the original link/date. Its
16+
filename is dated, so it needs `aliases: [<id>]`.
17+
3. **Fold into topic pages.** Create or update `concept` / `reference` / `howto` pages in the right
18+
`<vault>/<topic>/` bundle, from `04-knowledge/schema/page-template.md`. Add `[[wikilinks]]`; bump
19+
each touched page's `updated:`.
20+
4. **Update indexes.** The bundle's `index.md` (from `04-knowledge/schema/bundle-template.md`
21+
bump `version:`, and a new bundle index must carry `aliases: [<bundle-slug>]` or the master
22+
catalog's link to it breaks), then the vault's `index.md`.
23+
5. **Log it.** Append one entry to `<vault>/log.md`: date, source, pages touched, notable findings.
24+
25+
**Gates (all four apply):** anonymity — generalise real names, companies, clients, emails, and
26+
locations; personal specifics go to `01-context/`, never into the wiki. Copyright — summarise, never
27+
paste raw text. Provenance — every non-obvious claim carries a `source:`. No side effects without
28+
approval.
29+
30+
**Finish by verifying:**
31+
32+
```bash
33+
python3 setup/verify.py 04-knowledge <VAULT> && python3 scripts/privacy_check.py --quiet
34+
```

.claude/commands/lint-knowledge.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description: Run the knowledge base health check and write a dated lint report.
3+
---
4+
5+
# /lint-knowledge
6+
7+
Execute the **Lint** operation defined in §6 of `04-knowledge/schema/SCHEMA.md`. Run it during the
8+
weekly review, or on request.
9+
10+
Scan the vault for:
11+
- **Contradictions** — claims that conflict between pages.
12+
- **Orphans** — pages with no incoming `[[wikilinks]]`.
13+
- **Missing concepts** — ids referenced in `[[links]]` with no page.
14+
- **Stale claims** — a page whose `updated:` predates a newer source on the same topic.
15+
- **Low-confidence items**`confidence: low` pages needing follow-up.
16+
- **Anonymity leaks** — any real name, company, client, email, or location that slipped in.
17+
- **Index drift** — bundle `entries:` or the master `index.md` out of sync with disk.
18+
- **Missing aliases** — dated pages (filename ≠ `id`), and bundle `index.md` files missing
19+
`aliases: [<bundle-slug>]`.
20+
21+
Write findings to `04-knowledge/_lint/lint-<YYYY-MM-DD>.md` and append a one-line summary to the
22+
vault's `log.md`. **Propose** fixes; do not auto-fix contradictions or delete pages without approval.
23+
24+
The mechanical checks back this up and should be run alongside it:
25+
26+
```bash
27+
python3 setup/verify.py 04-knowledge <VAULT> && python3 scripts/privacy_check.py --quiet
28+
```

.claude/commands/process-inbox.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@ description: Triage everything in 00-inbox and route it to the right folders.
44

55
# /process-inbox
66

7-
Process `00-inbox/` end to end.
7+
Process `00-inbox/` end to end. The inbox is a queue: a run ends with every filed item cleared out
8+
of it, and only flagged items left behind.
89

910
1. For each inbox item, apply the `capture-and-classify` skill:
1011
- determine type and destination via `classification-rules.md`;
1112
- route any personal data to the personal zone (`01-context/`);
13+
- route durable reference material to `04-knowledge/raw/<type>/`, to be **ingested** per
14+
`04-knowledge/schema/SCHEMA.md` (run `/ingest`) rather than copied into `04-knowledge/`;
1215
- detect duplicates.
1316
2. Present a triage table (item → destination → filename → flags) and **ask for approval** before
1417
moving anything.
15-
3. After approval, apply moves; never delete or overwrite without explicit confirmation.
16-
4. Report what changed and what remains in the inbox.
18+
3. After approval, apply the moves and record source → destination in the triage report.
19+
4. Clear the inbox: remove the `00-inbox/` copy of each item whose destination is named in the
20+
approved table and whose destination copy is confirmed to exist. Nothing is removed before its
21+
destination copy exists; flagged or unconfirmed items stay. Any other deletion or overwrite
22+
still requires explicit confirmation.
23+
5. Report what changed and what remains in the inbox (flagged items only, ideally none).
1724

1825
Delegates heavy triage to the `knowledge-librarian` agent when the inbox is large.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Answer a question from the knowledge base, cited with wikilinks, and offer to save the answer.
3+
---
4+
5+
# /query-knowledge
6+
7+
Execute the **Query** operation defined in §5 of `04-knowledge/schema/SCHEMA.md`.
8+
9+
1. **Read the vault's `index.md` first** to navigate. Do not brute-force-load every page.
10+
2. Open only the relevant pages; synthesise an answer.
11+
3. **Cite** with `[[wikilinks]]`, and where a claim rests on a source, its `raw/…` or
12+
`<vault>/sources/…` provenance. Tag claims `[fact | interpretation | assumption]` and state
13+
confidence.
14+
4. If the answer is novel and worth keeping, **offer to save it** as a new page (and log it) — that
15+
is how the base compounds. Say plainly when the base does not cover the question, rather than
16+
filling the gap from general knowledge without marking it.

.claude/skills/capture-and-classify/SKILL.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,31 @@ named consistently, and checked for user-specific data.
2121
4. Check for **duplicates**; if a near-match exists, propose a merge instead of a new file.
2222
5. **Propose** the move (source → destination, new name). Do not overwrite or delete without
2323
approval.
24-
6. After approval, apply the move and report what changed.
24+
6. After approval, apply the move and record source → destination in the triage report. Durable
25+
reference material goes to `04-knowledge/raw/<type>/` and is then **ingested** per
26+
`04-knowledge/schema/SCHEMA.md`, not merely copied in.
27+
7. **Clear** the `00-inbox/` copy of each item whose destination copy is confirmed to exist, so the
28+
inbox stays a queue. Leave flagged and unconfirmed items in place. Report what changed.
2529

2630
## Outputs
2731
A triage decision per item: type, destination path, filename, personal-zone routing note,
28-
duplicate/merge note.
32+
duplicate/merge note, and whether the inbox copy was cleared.
2933

3034
## Context dependencies
3135
- Never copy personal data out of `01-context/`.
3236

3337
## Prohibited actions
34-
- Deleting or overwriting important files without approval.
38+
- Deleting or overwriting important files without approval. Clearing an inbox copy is the one
39+
scoped exception: it is authorised once the item's content is verifiably filed at the destination
40+
named in the approved triage table, and never before that destination copy exists. See
41+
`08-workflows/capture-and-classify/approval-policy.md`.
3542
- Placing user-specific data outside `01-context/`.
3643

3744
## Quality checklist
3845
- [ ] Correct type and destination, justified by the rules.
3946
- [ ] Consistent, dated filename.
4047
- [ ] Personal data routed to the personal zone (`01-context/`).
48+
- [ ] Knowledge-bound material ingested per the schema, not just copied into `04-knowledge/`.
4149
- [ ] Duplicates detected and flagged.
4250
- [ ] Move proposed before applied.
51+
- [ ] Inbox cleared of everything filed; only flagged items remain.

.claude/skills/capture-and-classify/classification-rules.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,34 @@ still unclear, leave it in `00-inbox/` and ask.
55

66
| If the item is... | Destination |
77
|---|---|
8-
| Raw, unprocessed capture not yet triaged | `00-inbox/` (stays until classified) |
8+
| Raw, unprocessed capture not yet triaged | `00-inbox/` (a queue — cleared once filed; see below) |
99
| User-specific: profile, priorities, clients, private examples, terminology | `01-context/` (git-ignored) |
1010
| Fictional persona/sample data for demos | `01-context/demo/` |
1111
| An ongoing responsibility with no end date | `02-areas/` |
1212
| Work with a defined outcome and completion point | `03-projects/` (active / waiting / archive) |
13-
| Durable reference knowledge or research notes | `04-knowledge/` |
13+
| Durable reference knowledge or research notes | `04-knowledge/raw/<type>/`, then **ingested** per `04-knowledge/schema/SCHEMA.md` |
1414
| A reusable, anonymous document/agenda/template | `05-templates/` |
1515
| A decision worth remembering, with rationale | `06-decisions/` |
1616
| A portable agent specification | `07-agents/` |
1717
| A multi-step process definition | `08-workflows/` |
1818
| A finished or draft deliverable for others | `09-outputs/` (drafts / final) |
1919
| Completed or stale material to retain but retire | `10-archive/` |
2020

21+
## Inbox lifecycle
22+
`00-inbox/` is a queue, not a store: an item lands, is classified, is filed at an approved
23+
destination, and its inbox copy is then **cleared**. Removal is authorised once the content is
24+
verifiably filed at the destination named in the approved triage table, and never before that
25+
destination copy exists. An item whose destination is unclear stays in `00-inbox/` and is flagged.
26+
See `08-workflows/capture-and-classify/approval-policy.md`.
27+
28+
## Filing to the knowledge base means Ingest, not a file move
29+
"Durable reference knowledge" does **not** mean dropping a file into `04-knowledge/`. The source
30+
document goes into `04-knowledge/raw/<type>/` — the immutable, git-ignored archive of source
31+
material — and is then processed by the five-step **Ingest** in
32+
`04-knowledge/schema/SCHEMA.md` (`/ingest`): a dated provenance page under the wiki's `sources/`,
33+
one or more topic pages, updated bundle and master indexes, and a `log.md` entry. The file move
34+
alone leaves the knowledge base unchanged.
35+
2136
## Personal data goes in the personal zone
2237
Personal context — a real name, company, client, email, location, or personal preference — belongs
2338
under `01-context/` (git-ignored), the home for your own data. Keep it out of the *shareable

00-inbox/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,33 @@
33
Unprocessed capture. Anything new and un-triaged lands here first, then gets routed by the
44
`capture-and-classify` skill / `/process-inbox` command.
55

6-
- Keep items here only until they're classified.
6+
## Lifecycle — this is a queue, not a store
7+
8+
An inbox item exists in order to be filed and then to leave. One triage run takes an item through
9+
four steps:
10+
11+
1. **Land** — the item is dropped here, un-triaged.
12+
2. **Classify**`/process-inbox` proposes a destination for every item (the triage table).
13+
3. **Apply** — after approval, the item's content is written to that destination.
14+
4. **Clear** — once the content is verifiably filed at the destination named in the approved
15+
triage table, the `00-inbox/` copy is removed. Nothing is removed before its destination copy
16+
exists.
17+
18+
An item whose destination is unclear is **not** removed: it stays here and is flagged for the next
19+
run. A healthy inbox is therefore empty, or holds only flagged items.
20+
21+
Step 4 is authorised by this lifecycle — it is not a general licence to delete. It covers only an
22+
inbox copy whose destination copy has been confirmed to exist. See
23+
[`../08-workflows/capture-and-classify/approval-policy.md`](../08-workflows/capture-and-classify/approval-policy.md).
24+
25+
## Rules
26+
727
- If an item contains user-specific data, it must be routed to `01-context/`, never to an
828
anonymous folder.
29+
- Durable reference material is routed to `04-knowledge/raw/<type>/` and then **ingested** per
30+
[`../04-knowledge/schema/SCHEMA.md`](../04-knowledge/schema/SCHEMA.md) — filing it there means
31+
running Ingest, not copying a file in.
932
- Naming: `YYYY-MM-DD-short-kebab-title.md`.
33+
- The contents of this folder are git-ignored (only this README is tracked). Inbox material often
34+
comes from elsewhere — recorded-session transcripts, exports, other people's data — so it stays
35+
out of the shareable template by default.

04-knowledge/CLAUDE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ This folder is an **LLM Wiki** (Andrej Karpathy's pattern) whose pages follow th
44
**Open Knowledge Format (OKF)**. It has three layers:
55

66
- `raw/` — immutable primary material you or agents drop in (web clips, PDFs, files, data).
7-
- `WorkOSWiki/` — the anonymous, LLM-maintained knowledge pages. This is the shareable layer.
7+
- `WorkOSWiki/` — the anonymous, LLM-maintained knowledge pages. This is the shareable layer, and the
8+
folder you open as an Obsidian vault.
89
- `schema/` — how the base is structured and operated.
910

1011
**Before you Ingest, Query, or Lint this knowledge base, read
11-
[`schema/SCHEMA.md`](schema/SCHEMA.md).** It defines the operations, the page format, the
12-
naming rules, and the anonymity and no-side-effects-by-default gates.
12+
[`schema/SCHEMA.md`](schema/SCHEMA.md).** It defines the operations, the page format, the naming
13+
rules, and the anonymity and no-side-effects-by-default gates. In Claude Code the three
14+
operations are `/ingest`, `/query-knowledge`, and `/lint-knowledge`.
1315

1416
Two hard rules:
1517

1618
1. **`WorkOSWiki/` is anonymous.** No real names, companies, clients, emails, or locations in wiki
17-
pages. Personal specifics belong in `01-context/` (see the root `CLAUDE.md`). `raw/` is the
18-
only non-anonymous layer and is git-ignored.
19+
pages. Personal specifics belong outside the wiki, in the private context folder (in a Work OS,
20+
`01-context/` — see the root `CLAUDE.md`). `raw/` is the only non-anonymous layer and is git-ignored.
1921
2. **No external side effects by default.** Do not contact external integrations or perform
2022
external side effects without explicit approval; prefer dry-run, and use only fictional or
2123
public sources for seed content.

04-knowledge/README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
# 04-knowledge
22

33
Durable reference knowledge, run as an **LLM Wiki** (Karpathy's pattern) with pages in the
4-
**Open Knowledge Format (OKF)**. Things you'd rather not re-derive later live here as a knowledge
5-
graph that compounds over time, instead of being re-discovered on every question.
4+
**Open Knowledge Format (OKF)**. Things you'd rather not re-derive later matter here: knowledge
5+
lives here as a graph that compounds over time, instead of being re-discovered on every question.
66

77
## The three layers
88

99
| Layer | What it holds | Editable? | Anonymous? |
1010
|---|---|---|---|
1111
| `raw/` | Primary material you or agents find — web clips, PDFs, files, datasets. | Read-only | No — git-ignored |
12-
| `WorkOSWiki/` | LLM-maintained OKF pages, organised into topic bundles, with `index.md` + `log.md`. | LLM-maintained | **Yes** |
12+
| `WorkOSWiki/` | LLM-maintained OKF pages, in topic bundles, with `index.md` + `log.md`. | LLM-maintained | **Yes** |
1313
| `schema/` | The operating model, page format, and rules. | Rarely | Yes |
1414

15-
The rest of the tooling (agents, commands) reads [`schema/SCHEMA.md`](schema/SCHEMA.md) to know how
16-
to operate the base. A short auto-loaded [`CLAUDE.md`](CLAUDE.md) points there.
15+
Tooling reads [`schema/SCHEMA.md`](schema/SCHEMA.md) to operate the base; a short auto-loaded
16+
[`CLAUDE.md`](CLAUDE.md) points there. The three operations are also exposed as commands:
17+
`/ingest`, `/query-knowledge`, and `/lint-knowledge`.
1718

1819
## How it runs — three operations
1920

2021
- **Ingest** — a new source in `raw/` is summarised into `WorkOSWiki/sources/` and folded into the
2122
relevant topic pages, updating the indexes and the log.
22-
- **Query** — questions are answered from `WorkOSWiki/index.md` first, cited with `[[wikilinks]]`, and
23-
good answers are saved back as pages so knowledge compounds.
23+
- **Query** — questions are answered from `WorkOSWiki/index.md` first, cited with `[[wikilinks]]`,
24+
and good answers are saved back as pages so knowledge compounds.
2425
- **Lint** — a periodic health check for contradictions, orphans, stale claims, and missing pages.
2526

2627
See [`schema/SCHEMA.md`](schema/SCHEMA.md) for the exact procedures.
2728

2829
## Open in Obsidian
2930

30-
Use `WorkOSWiki/` as the UI: **open `04-knowledge/WorkOSWiki/` as your Obsidian vault** (not `04-knowledge/`).
31-
That keeps the private, git-ignored `raw/` layer out of Obsidian's index and gives a clean graph of
32-
just the knowledge pages. `[[wikilinks]]`, `tags:`, and `related:` all work as Obsidian links;
33-
dated source pages carry `aliases:` so their `[[id]]` links resolve. Obsidian's `.obsidian/` config
34-
is git-ignored via `WorkOSWiki/.gitignore`.
31+
**Open `04-knowledge/WorkOSWiki/` as your Obsidian vault** (not `04-knowledge/`). That keeps
32+
the private, git-ignored `raw/` layer out of Obsidian's index and gives a clean graph of just the
33+
knowledge pages. The vault name in Obsidian is the folder name (`WorkOSWiki`). `[[wikilinks]]`, `tags:`, and
34+
`related:` all work as Obsidian links; dated source pages and bundle indexes carry `aliases:` so
35+
their links resolve. Obsidian's `.obsidian/` config is git-ignored via `WorkOSWiki/.gitignore`.
3536

3637
## Anonymity
3738

38-
`WorkOSWiki/` notes are **anonymous references**. Any real name, company, client, email, or location
39-
belongs in `01-context/`, never in `WorkOSWiki/`, `schema/`, or templates. `raw/`
40-
may contain personal or copyrighted material, so it is git-ignored and never shared; wiki pages
41-
*summarise and cite* raw material, they never reproduce it verbatim.
39+
`WorkOSWiki/` notes are **anonymous references**. Real names, companies, clients, emails, or
40+
locations belong outside the wiki, in the private context folder (in a Work OS, `01-context/`),
41+
never in `WorkOSWiki/`, `schema/`, or templates. `raw/` may contain personal or copyrighted material, so it is git-ignored and never
42+
shared; wiki pages *summarise and cite* raw material, they never reproduce it verbatim.
4243

4344
## Not part of the wiki
4445

0 commit comments

Comments
 (0)