kb-init
Creates a new knowledge base: interviews the user for purpose, zones, types and curation, scaffolds the tree, registers it, and wires the maintenance cron jobs. Use when the user wants a fresh base ('create a work base', 'set me up a knowledge base', 'kb init personal'), including during bootstrap when none exists yet. Do NOT use when a knowledge tree already exists on disk — registering that in place is kb-adopt, and transforming another KB's content into a base is kb-import.
- License 许可
- MIT
- 所属仓库
- AlmogBaku/aos
- 最近更新
- 2026-11-15
- Stars
- ★ 5
- Forks
- 2
01 前言 Front Matter
- name
- kb-init
- metadata
- { "aos": { "origin": "kb@0.8.3" } }
- description
- Creates a new knowledge base: interviews the user for purpose, zones, types and curation, scaffolds the tree, registers it, and wires the maintenance cron jobs. Use when the user wants a fresh base ('create a work base', 'set me up a knowledge base', 'kb init personal'), including during bootstrap when none exists yet. Do NOT use when a knowledge tree already exists on disk — registering that in place is kb-adopt, and transforming another KB's content into a base is kb-import.
02 资源文件 9
- 参考文档templates/AGENTS.md5.8 KB
- 参考文档templates/base.README.md1.7 KB
- 参考文档templates/base.yml1.6 KB
- 其他templates/gitattributes977 B
- 参考文档templates/index.md405 B
- 参考文档templates/state.yml322 B
- 参考文档templates/zones/_raw.AGENTS.md1.0 KB
- 参考文档templates/zones/entities.AGENTS.md605 B
- 参考文档templates/zones/profile.AGENTS.md391 B
03 SKILL.md 正文
init
Init is not done until the cron jobs exist (or their degraded run-cards do). An unscheduled base means an undrained queue and an unenforced contract, which is worse than no base at all.
1. The structure interview
Ask once, design once — the user is never bothered about structure again. Afterwards the
agent operates autonomously inside the frozen zone set, and a zone change is an
owner-approved .kb/base.yml edit.
- Name, path (default
~/<name>-base), remote (optional), audience (privatedefault, orshared), sync (rebase-5minormanual). rebase-5minrequires a remote, and nothing enforces that — stop and get one if the user wants it.kb init --sync rebase-5minwith no--remotesucceeds, and the resulting cron then reportssynced (no remote)and exits 0 every five minutes forever, syncing nothing. No remote yet? Choosemanualand switch later.- Purpose — one paragraph. It is the rubric for both routing and recall. Write it well.
- Theme → zones and types. An engineering base wants different zones and types than a
family or self base. Start from the template defaults and adjust with the user.
Anything they say about what belongs where is routing gold: it becomes
purposeprose androuting.keywords. - Curation — on a shared base, who reviews what agents propose?
selfmeans each person curates their own captures (the default, and right for most teams);designatednames one curator who drains everyone's. Private bases are alwaysself.
2. Scaffold
kb init <name> --path <path> --audience <a> --sync <s> --purpose "<p>" \
[--remote <url>] [--curation designated --curator <principal-id>] [--default]
The tool clones a template repo by default (read-only, unauthenticated, no fork) and drops
the clone's own history before rendering; --template <url> points at a different one, and
--templates <local-dir> skips the network entirely, which is also the automatic fallback
when a clone fails for any reason — announced, never silent, never blocking.
It renders the templates, git-inits, registers the base in <HOME>/aos/upstream/tests/.sandbox/aos-home/.aos/kb-registry.yaml
(creating it if absent), and commits. On a machine with no identity yet it saves a typed
--principal to <HOME>/aos/upstream/tests/.sandbox/aos-home/.aos/kb-principal.yml — never AOS_PRINCIPAL_ID; with one saved,
a typed flag authors this init only and the file is left alone (kb config set principal.id= changes it). A write verb with no resolvable identity — neither flag nor
file — errors, naming the file. Read-only verbs (kb lint, kb find, etc.) need no
identity. It does not touch the repo's git identity: the user's own identity authors
every write and the acting agent is recorded as committer.
Then apply the interview's zone and type adjustments with kb config set (for example
kb config set 'zones.decisions={kind: wiki}'), which commits each change itself, and create
the matching directories. Show the user the diff. A hand-edit of .kb/base.yml also works
but leaves the tree uncommitted, which lint reports as a finding — so follow one with
kb commit --verb config --path .kb/base.yml --summary "<what changed>".
3. Cron jobs
Three jobs, and init is not finished until all three exist. The harness cheat-sheet's mapping.cron
gives the exact command for this harness; what does not vary is what to schedule:
| id | when | runs | as | environment |
|---|---|---|---|---|
nightly-promote |
30 23 * * * |
the archiver agent, prompt agents/archiver/promote.md |
agent job | AOS_AGENT=agent:archiver |
weekly-maintain |
0 7 * * 6 |
the archiver agent, prompt agents/archiver/lint.md |
agent job | AOS_AGENT=agent:archiver |
sync |
*/5 * * * * |
kb sync --all |
exec job — no model wakes up | AOS_AGENT=agent:archiver, AOS_HOME=<HOME>/aos/upstream/tests/.sandbox/aos-home |
The environment column is not optional, and it is the column people drop. A cheat-sheet
puts it in the job's own env, a wrapper script, or an export before the command — whichever
your harness supports; what matters is that the job carries it. Every one of these fails
quietly: the job runs, the work happens, and the damage surfaces days later.
Two things silently break if you skip them, and each fails quietly rather than loudly:
AOS_AGENT=agent:archiverin both archiver jobs. It defaults toagent:main, which holds no write grant onentities/** concepts/** projects/** index.md— so a job that looks like it worked commits every promotion as the wrong subject, and the next weekly lint reports each one as a grants-audit critical.- The single-owner rule: each of these runs in exactly one harness, so check none of them already exists before creating it.
No cron on this harness? Then all three degrade to manual run-cards: write down the
command and the trigger for each ("run kb sync --all when you finish a session"; "ask the
archiver to promote overnight"), and tell the user, because nothing will run them otherwise.
4. Verify
kb lint must report zero Critical and zero Findings on the fresh tree (Info lines are
fine — they are observations, not defects). Report back: the tree, the grants, the registry
entry, and the cron jobs or their degraded modes.
04 同仓库更多 Skills
wt-update
Updates an existing commitment when the user reports progress: completion, a new deadline, a stall, or abandonment. Use when the user says "I did that", "finished X", "still waiting on Y", "push that to next week", "I started it", or "forget it, I'm not doing X". Finds the matching open action, applies the change, and routes any knowledge the report carries to the knowledge base. Do NOT use to file a new commitment (that is wt-capture) or to find time for one (wt-schedule).
wt-steward
Maintains an existing commitments backlog: overdue, about to expire, stalled, and repeatedly-rescheduled commitments, and someday items gone cold. Use when the nightly cron job fires or the user asks to review or tidy their backlog ('review my backlog', 'what's gone stale on my list'). Does not capture or schedule new work — that happens when the user speaks, through wt-capture and wt-schedule.
wt-schedule
Estimates a commitment, links it to its project, and blocks time for it on the user's calendar. Use when the user asks to find time for something — "when can I do this?", "find me two hours for the CFP", "block time for that tomorrow", "I want to work on it today" — and immediately after wt-capture files a commitment that needs real hours. Do NOT use for a commitment that needs only a deadline or a reminder, and do NOT use to change what the user committed to — that is wt-update.
wt-capture
Records something the user has said they must do themselves: classifies the commitment as next, waiting, someday or trivial, writes it as an action page in their commitments base, and hands off to wt-schedule when it needs real hours. Use when the user commits to work of their own — "I need to find time to…", "I have to…", "remind me to…", "help me remember…", "put that on my list", "I should … at some point". Do NOT use when the user asks the assistant to do the work ("write the CFP", "research X", "email Sam") — that is a request to act now, not a commitment to track. Do NOT use for thoughts, facts or notes carrying no commitment; those are knowledge and belong to kb-capture.
work-tracker
Answers questions about the user's own commitments by querying their commitments base, explains the four statuses (next, waiting, someday, done), routes a request to the right work-tracker skill, and states who may change what without asking. Use when the user asks what they should be working on, what is overdue, what they are waiting on, or how their task tracking works, and no narrower work-tracker skill matches. Do NOT use to file a commitment the user just made (that is wt-capture), to find time for one (wt-schedule), or to report progress on one (wt-update).
kb
Explains how the user's knowledge bases are laid out and which kb skill handles a given job — the tree, the one queue, expiry, links, base health, maintenance. Use when the user asks how their knowledge base works, what state a base is in, why something was or was not kept, or wants base maintenance run, and no narrower kb skill matches. Do NOT use to file something the user just said (that is kb-capture), to answer a question from stored knowledge (that is kb-recall), or to pick a destination base for a write already in hand (that is kb-route).