aboutsummaryrefslogtreecommitdiff
path: root/claude-rules/knowledge-base.md
diff options
context:
space:
mode:
Diffstat (limited to 'claude-rules/knowledge-base.md')
-rw-r--r--claude-rules/knowledge-base.md29
1 files changed, 25 insertions, 4 deletions
diff --git a/claude-rules/knowledge-base.md b/claude-rules/knowledge-base.md
index 5658498..146a5e4 100644
--- a/claude-rules/knowledge-base.md
+++ b/claude-rules/knowledge-base.md
@@ -2,7 +2,7 @@
Applies to: `**/*`
-Craig's org-roam knowledge base is the shared, cross-project store for durable agent knowledge. It lives at `~/org/roam/` — a git repo (origin `git@cjennings.net:roam.git`), auto-synced on Craig's machines by the `roam-sync` systemd timer. Per-project harness memory stays the fast capture layer; durable facts get promoted here.
+Craig's org-roam knowledge base is the shared, cross-project store for durable agent knowledge. It lives at `~/org/roam/` — a git repo (origin `cjennings@cjennings.net:git/roam.git`), auto-synced on Craig's machines by the `roam-sync` systemd timer. Per-project harness memory stays the fast capture layer; durable facts get promoted here.
## Reading (any project)
@@ -22,13 +22,15 @@ Pull before querying (`git -C ~/org/roam pull --ff-only`); skip silently if offl
Classify the project before any write. The source of truth is the work-root denylist below — never inference from remotes, names, or task content:
- **Work** — project root is, or sits under, a denylisted root. No KB write, ever. Record durable facts per that project's own conventions.
-- **Personal** — project root sits under `~/code/`, `~/projects/`, or `~/.emacs.d` and is not denylisted. KB writes allowed.
+- **Personal** — project root sits under `~/code/`, `~/projects/`, `~/.emacs.d`, or `~/.dotfiles` and is not denylisted. KB writes allowed.
- **Unknown** — anything else. No KB write.
Work-root denylist (confirmed by Craig, 2026-06-10): `~/projects/work`
**Refusal contract** (work and unknown alike): state the classification, name the durable fact in a one-line redacted summary, and say where it was or wasn't written — so Craig can re-route it deliberately instead of losing it silently.
+**Scope of the denylist — durable KB-node writes only.** The work-denylist governs one thing: promoting a durable fact into a new `agents/` node. It is a confidentiality guard so work-confidential material doesn't land in the personal cross-machine store. It is *not* a general "don't touch roam from a work project" boundary. Roam is a *shared resource*, not another project's product scope. Reading it (any project) and *tidying the shared roam inbox* — processing, routing, and filing the capture items in `~/org/roam/inbox.org`, e.g. via inbox-zero — are allowed from any project session, work included; that is housekeeping on a shared resource, not a durable-fact write. Only the durable-node promotion stays work-denylisted. Do not park roam-inbox tidying as a cross-project boundary crossing (a sentry inbox-zero pass did exactly that on 2026-07-19 — the error this note closes).
+
A write is one node per fact, under `agents/`, roam-valid so Craig's org-roam indexes it:
```
@@ -43,7 +45,26 @@ A write is one node per fact, under `agents/`, roam-valid so Craig's org-roam in
<the fact, with [[id:...]] links to related nodes>
```
-Pull before writing, commit and push after (`git -C ~/org/roam add -A && git commit && git push`) — same session discipline as any repo. Never edit Craig's hand-authored nodes; link to them. This write autonomy is scoped to the KB alone — it is not permission to send email, comment on tickets, or post to any public or external channel.
+Pull before writing (`git -C ~/org/roam pull --ff-only`, read-only). Then acquire the roam-write lock, write the node, and trigger roam-sync to commit and push — roam-sync stays the roam repo's only committer (the 2026-06-24 one-git-owner rule). The tree is chronically dirty from live captures, so an agent's own `git add -A && commit` could sweep an in-flight capture into a stray commit; edit-plus-trigger avoids that. Never edit Craig's hand-authored nodes; link to them. This write autonomy is scoped to the KB alone — it is not permission to send email, comment on tickets, or post to any public or external channel.
+
+The write block, with the lock and the trigger:
+
+```sh
+# Acquire the roam-write lock so a concurrent sentry pass or inbox writer can't
+# race this write. Callers pass a name; agent-lock owns the path (tmpfs).
+if [ -x .ai/scripts/agent-lock ]; then
+ if ! .ai/scripts/agent-lock acquire roam-write --wait; then
+ # Busy after the bounded wait — surface and stop, don't write unlocked.
+ echo "roam-write lock held by another writer; try again shortly" >&2
+ exit 1
+ fi
+fi
+# ... write ~/org/roam/agents/<ts>-<slug>.org ...
+systemctl --user start roam-sync.service # roam-sync commits + pushes
+[ -x .ai/scripts/agent-lock ] && .ai/scripts/agent-lock release roam-write
+```
+
+Degrade gracefully when `agent-lock` isn't installed (an older checkout mid-sync): the guard above is skipped and the write proceeds unlocked — today's behavior. Only a *present* helper reporting the lock busy after its bounded wait stops the write; an *absent* helper never blocks it.
## What goes in, what stays out
@@ -53,7 +74,7 @@ Pull before writing, commit and push after (`git -C ~/org/roam add -A && git com
## Capture, then promote
-Harness memory (`~/.claude/projects/<enc>/memory/`) remains the per-project capture layer: fast, automatic, allowed to be at-risk. At wrap-up (or a task audit, or an explicit prompt), promote facts that meet the inclusion bar into the KB as nodes. The wrap-up workflow asks; answer it honestly — promotion discipline is what keeps the capture layer from silting up.
+Harness memory (`~/.claude/projects/<enc>/memory/`) remains the per-project capture layer: fast, automatic, allowed to be at-risk. An agent running without harness memory (a non-Claude runtime) captures into its session log instead and promotes from there — the promotion discipline is the same. At wrap-up (or a task audit, or an explicit prompt), promote facts that meet the inclusion bar into the KB as nodes. The wrap-up workflow asks; answer it honestly — promotion discipline is what keeps the capture layer from silting up.
## Inventory