ZAKON #14 — BookStack Auto-Sync Protocol
ZAKON #14 — BookStack Auto-Sync Protocol
Svaki docs/ fajl koji se kreira ili mijenja MORA biti syncan u BookStack.
Date: 2026-02-24
Origin: Documentation was being created in project docs/ dirs but never reaching BookStack — agents marked tasks done without syncing. Wiki drifted from codebase reality.
Rule
After ANY Write or Edit to a .md file inside a project's docs/ directory:
- Check sync map —
~/system/config/bookstack-sync-map.json— is this file/project mapped? - If NOT mapped — add the file to the sync map first, then run sync
- Run sync —
node ~/system/tools/bookstack-sync.js - THEN mark task done — sync MUST complete before task is considered complete
Sync Map
Location: ~/system/config/bookstack-sync-map.json
Structure:
{
"projects": {
"<project-name>": {
"shelf_id": 123,
"docs_path": "~/ALAI/<path>/docs/",
"book_id": 456
}
}
}
If a project doesn't have a BookStack shelf yet, create one before adding docs.
What Triggers This Rule
| Condition | Sync Required? |
|---|---|
New .md file created in docs/ |
YES |
Existing .md file in docs/ modified |
YES |
.md outside docs/ (e.g. README.md, CLAUDE.md) |
NO |
Non-.md files (code, config, JSON) |
NO |
Temp files in /tmp/ |
NO |
| GOTCHA files | NO |
MC task lifecycle — every task
File-sync scope above and task-lifecycle documentation are separate controls. For every real Mission Control task:
- Link one canonical
https://docs.alai.no/...page totasks.bookstack_url. - Before work, add
<!-- ALAI-MC:<id>:BEFORE -->;mc.js start/resumemust verify it by API. - After work, update the same page and add
<!-- ALAI-MC:<id>:AFTER -->. mc.js ready/doneverifies the AFTER marker and requires APIupdated_atnewer than the baseline captured before work.- API failure is UNKNOWN/BLOCKED. A URL in outcome text and
--forceare not proof.
Agent Checklist
When an agent task involves documentation:
[ ] Wrote/edited .md files in docs/
[ ] Checked bookstack-sync-map.json for this project
[ ] Added new files to sync map (if needed)
[ ] Ran: node ~/system/tools/bookstack-sync.js
[ ] Confirmed sync output shows no errors
[ ] THEN: marked MC task as done
Anti-Patterns (NEVER do these)
- "Dokumentacija je gotova" without running sync — wiki doesn't know that
- Skipping sync because "it's just a draft" — drafts belong in BookStack too
- Adding files to sync map without a valid shelf/book ID — verify IDs first
- Running sync and ignoring errors — fix errors before marking done
Enforcement
- Rule: This document (behavioral standard)
- Scope: All agents that create or modify docs/ content
- Config:
~/system/config/bookstack-sync-map.json - Tool:
node ~/system/tools/bookstack-sync.js - Hook: Post-tool hook watches for Write/Edit on
*/docs/*.mdpaths and emits reminder
Ljestvica (ZAKON #1)
This is a RULE + TOOL fix (2 layers):
- Rule: This document (behavioral standard)
- Tool:
bookstack-sync.js(deterministic sync execution)
No comments to display
No comments to display