Skip to content

kb-add writes assertions to the KB root instead of content/assertions/ #816

Description

@williamthorsen

Problem

kb-add resolves --folder relative to the KB root rather than the content tree, so assertions land at <kb-root>/<folder>/ instead of under content/assertions/, their correct location. The misplaced note sits outside the organized content/ tree, and the helper returns ok: true with no warning. Recovery is manual each time (mv under content/, then remove the stray top-level directories).

Recurring: observed at least three times in seven days (01KTW9SSCYZ8REMZV65191K6RC, 01KV9NG9Z75XPNX0MAZEJG5Z4Q, 01KVD3KZDZN4X9FGMSV3EYHK45; recorded as events in the codeassembly KB).

kb-add only ever writes assertions (it hardcodes recordType: assertion), yet it makes the caller name the assertions/ archetype segment in --folder. The sibling writer capture-event owns its archetype directory (content/events/); kb-add does not own content/assertions/, so an assertion can be misfiled into any sibling subtree.

Context

  • kb-add is the assertion writer; capture-event is the separate, append-only event writer and already owns content/events/.
  • content/assertions/ and content/events/ are the canonical archetype homes under the KB's content/ tree.
  • Root-layout KBs (notes at the vault root) are out of support; content/ is the enforced structure.

Proposed solution

Make kb-add own its archetype root:

  • kb-add writes under content/assertions/. --folder is the topic subpath beneath that root, not the archetype (--folder tools/rovodevcontent/assertions/tools/rovodev/). The assertions/ segment is supplied by the tool, mirroring its hardcoded recordType: assertion.
  • Two guards refuse a malformed --folder rather than silently misfiling the note: one that escapes the assertions root (e.g. ../events/x), and one that re-names the assertions/ segment.
  • capture-event already writes events to content/events/ and needs no change; kb-edit takes no --folder and edits notes in place, so it is unaffected.

Acceptance criteria

Must have

  • kb-add writes assertions under content/assertions/, interpreting --folder as the topic subpath (--folder tools/rovodevcontent/assertions/tools/rovodev/); omitting --folder writes directly under content/assertions/.
  • A --folder that escapes the assertions root (e.g. ../events/x) is refused.
  • A --folder beginning with the archetype segment (assertions/) is refused, with a message directing the caller to omit it.
  • capture-event and kb-edit are confirmed unaffected (capture-event already writes to content/events/; kb-edit takes no --folder).
  • New and modified behavior is covered by tests.
  • kb-add's SKILL.md documents the new --folder semantics, with no remaining reference to writing relative to or defaulting to the KB root.

Metadata

Metadata

Labels

bugSomething isn't workingscope:kb

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions