@latysh-development/monolith 0.0.0-stage → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/dist/brief/cli.d.ts +30 -0
  4. package/dist/brief/cli.d.ts.map +1 -0
  5. package/dist/brief/cli.js +85 -0
  6. package/dist/brief/collect.d.ts +17 -0
  7. package/dist/brief/collect.d.ts.map +1 -0
  8. package/dist/brief/collect.js +302 -0
  9. package/dist/brief/config.d.ts +40 -0
  10. package/dist/brief/config.d.ts.map +1 -0
  11. package/dist/brief/config.js +85 -0
  12. package/dist/brief/constants.d.ts +10 -0
  13. package/dist/brief/constants.d.ts.map +1 -0
  14. package/dist/brief/constants.js +9 -0
  15. package/dist/brief/docs.d.ts +53 -0
  16. package/dist/brief/docs.d.ts.map +1 -0
  17. package/dist/brief/docs.js +229 -0
  18. package/dist/brief/freshness.d.ts +104 -0
  19. package/dist/brief/freshness.d.ts.map +1 -0
  20. package/dist/brief/freshness.js +263 -0
  21. package/dist/brief/git-signals.d.ts +17 -0
  22. package/dist/brief/git-signals.d.ts.map +1 -0
  23. package/dist/brief/git-signals.js +101 -0
  24. package/dist/brief/index.d.ts +11 -0
  25. package/dist/brief/index.d.ts.map +1 -0
  26. package/dist/brief/index.js +5 -0
  27. package/dist/brief/reconcile.d.ts +75 -0
  28. package/dist/brief/reconcile.d.ts.map +1 -0
  29. package/dist/brief/reconcile.js +259 -0
  30. package/dist/brief/render.d.ts +60 -0
  31. package/dist/brief/render.d.ts.map +1 -0
  32. package/dist/brief/render.js +407 -0
  33. package/dist/brief/sanitize.d.ts +38 -0
  34. package/dist/brief/sanitize.d.ts.map +1 -0
  35. package/dist/brief/sanitize.js +48 -0
  36. package/dist/brief/selectors.d.ts +36 -0
  37. package/dist/brief/selectors.d.ts.map +1 -0
  38. package/dist/brief/selectors.js +75 -0
  39. package/dist/brief/story.d.ts +18 -0
  40. package/dist/brief/story.d.ts.map +1 -0
  41. package/dist/brief/story.js +59 -0
  42. package/dist/brief/types.d.ts +110 -0
  43. package/dist/brief/types.d.ts.map +1 -0
  44. package/dist/brief/types.js +11 -0
  45. package/dist/cli/index.d.ts +3 -0
  46. package/dist/cli/index.d.ts.map +1 -0
  47. package/dist/cli/index.js +166 -0
  48. package/dist/cli/init-args.d.ts +16 -0
  49. package/dist/cli/init-args.d.ts.map +1 -0
  50. package/dist/cli/init-args.js +24 -0
  51. package/dist/cli/ui-args.d.ts +23 -0
  52. package/dist/cli/ui-args.d.ts.map +1 -0
  53. package/dist/cli/ui-args.js +66 -0
  54. package/dist/cli/ui.d.ts +40 -0
  55. package/dist/cli/ui.d.ts.map +1 -0
  56. package/dist/cli/ui.js +180 -0
  57. package/dist/coordinatorium/checkpoint.d.ts +44 -0
  58. package/dist/coordinatorium/checkpoint.d.ts.map +1 -0
  59. package/dist/coordinatorium/checkpoint.js +124 -0
  60. package/dist/coordinatorium/cli.d.ts +39 -0
  61. package/dist/coordinatorium/cli.d.ts.map +1 -0
  62. package/dist/coordinatorium/cli.js +203 -0
  63. package/dist/coordinatorium/errors.d.ts +112 -0
  64. package/dist/coordinatorium/errors.d.ts.map +1 -0
  65. package/dist/coordinatorium/errors.js +145 -0
  66. package/dist/coordinatorium/index.d.ts +11 -0
  67. package/dist/coordinatorium/index.d.ts.map +1 -0
  68. package/dist/coordinatorium/index.js +5 -0
  69. package/dist/coordinatorium/lock.d.ts +187 -0
  70. package/dist/coordinatorium/lock.d.ts.map +1 -0
  71. package/dist/coordinatorium/lock.js +659 -0
  72. package/dist/coordinatorium/mission.d.ts +32 -0
  73. package/dist/coordinatorium/mission.d.ts.map +1 -0
  74. package/dist/coordinatorium/mission.js +87 -0
  75. package/dist/coordinatorium/state-keeper.d.ts +115 -0
  76. package/dist/coordinatorium/state-keeper.d.ts.map +1 -0
  77. package/dist/coordinatorium/state-keeper.js +396 -0
  78. package/dist/coordinatorium/types.d.ts +69 -0
  79. package/dist/coordinatorium/types.d.ts.map +1 -0
  80. package/dist/coordinatorium/types.js +27 -0
  81. package/dist/durable/assess.d.ts +105 -0
  82. package/dist/durable/assess.d.ts.map +1 -0
  83. package/dist/durable/assess.js +239 -0
  84. package/dist/durable/canonical.d.ts +25 -0
  85. package/dist/durable/canonical.d.ts.map +1 -0
  86. package/dist/durable/canonical.js +78 -0
  87. package/dist/durable/cli.d.ts +37 -0
  88. package/dist/durable/cli.d.ts.map +1 -0
  89. package/dist/durable/cli.js +141 -0
  90. package/dist/durable/errors.d.ts +188 -0
  91. package/dist/durable/errors.d.ts.map +1 -0
  92. package/dist/durable/errors.js +317 -0
  93. package/dist/durable/fs-store.d.ts +233 -0
  94. package/dist/durable/fs-store.d.ts.map +1 -0
  95. package/dist/durable/fs-store.js +1393 -0
  96. package/dist/durable/index.d.ts +20 -0
  97. package/dist/durable/index.d.ts.map +1 -0
  98. package/dist/durable/index.js +13 -0
  99. package/dist/durable/log.d.ts +33 -0
  100. package/dist/durable/log.d.ts.map +1 -0
  101. package/dist/durable/log.js +157 -0
  102. package/dist/durable/memory-store.d.ts +51 -0
  103. package/dist/durable/memory-store.d.ts.map +1 -0
  104. package/dist/durable/memory-store.js +302 -0
  105. package/dist/durable/projection.d.ts +35 -0
  106. package/dist/durable/projection.d.ts.map +1 -0
  107. package/dist/durable/projection.js +328 -0
  108. package/dist/durable/prune-check.d.ts +17 -0
  109. package/dist/durable/prune-check.d.ts.map +1 -0
  110. package/dist/durable/prune-check.js +45 -0
  111. package/dist/durable/register.d.ts +100 -0
  112. package/dist/durable/register.d.ts.map +1 -0
  113. package/dist/durable/register.js +532 -0
  114. package/dist/durable/retention.d.ts +49 -0
  115. package/dist/durable/retention.d.ts.map +1 -0
  116. package/dist/durable/retention.js +59 -0
  117. package/dist/durable/runtime.d.ts +497 -0
  118. package/dist/durable/runtime.d.ts.map +1 -0
  119. package/dist/durable/runtime.js +1271 -0
  120. package/dist/durable/seams.d.ts +40 -0
  121. package/dist/durable/seams.d.ts.map +1 -0
  122. package/dist/durable/seams.js +21 -0
  123. package/dist/durable/testing.d.ts +11 -0
  124. package/dist/durable/testing.d.ts.map +1 -0
  125. package/dist/durable/testing.js +25 -0
  126. package/dist/durable/types.d.ts +442 -0
  127. package/dist/durable/types.d.ts.map +1 -0
  128. package/dist/durable/types.js +75 -0
  129. package/dist/graph/builder.d.ts +11 -0
  130. package/dist/graph/builder.d.ts.map +1 -0
  131. package/dist/graph/builder.js +153 -0
  132. package/dist/graph/identity.d.ts +37 -0
  133. package/dist/graph/identity.d.ts.map +1 -0
  134. package/dist/graph/identity.js +46 -0
  135. package/dist/graph/index.d.ts +7 -0
  136. package/dist/graph/index.d.ts.map +1 -0
  137. package/dist/graph/index.js +3 -0
  138. package/dist/graph/resolver.d.ts +41 -0
  139. package/dist/graph/resolver.d.ts.map +1 -0
  140. package/dist/graph/resolver.js +36 -0
  141. package/dist/graph/types.d.ts +42 -0
  142. package/dist/graph/types.d.ts.map +1 -0
  143. package/dist/graph/types.js +1 -0
  144. package/dist/http/index.d.ts +5 -0
  145. package/dist/http/index.d.ts.map +1 -0
  146. package/dist/http/index.js +2 -0
  147. package/dist/http/server.d.ts +76 -0
  148. package/dist/http/server.d.ts.map +1 -0
  149. package/dist/http/server.js +195 -0
  150. package/dist/http/ui-assets.d.ts +22 -0
  151. package/dist/http/ui-assets.d.ts.map +1 -0
  152. package/dist/http/ui-assets.js +100 -0
  153. package/dist/index.d.ts +31 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +26 -0
  156. package/dist/init/index.d.ts +12 -0
  157. package/dist/init/index.d.ts.map +1 -0
  158. package/dist/init/index.js +90 -0
  159. package/dist/init/prompts.d.ts +3 -0
  160. package/dist/init/prompts.d.ts.map +1 -0
  161. package/dist/init/prompts.js +47 -0
  162. package/dist/init/scaffold.d.ts +25 -0
  163. package/dist/init/scaffold.d.ts.map +1 -0
  164. package/dist/init/scaffold.js +204 -0
  165. package/dist/init/types.d.ts +14 -0
  166. package/dist/init/types.d.ts.map +1 -0
  167. package/dist/init/types.js +1 -0
  168. package/dist/readmodel/dashboard.d.ts +40 -0
  169. package/dist/readmodel/dashboard.d.ts.map +1 -0
  170. package/dist/readmodel/dashboard.js +236 -0
  171. package/dist/readmodel/index.d.ts +3 -0
  172. package/dist/readmodel/index.d.ts.map +1 -0
  173. package/dist/readmodel/index.js +1 -0
  174. package/dist/readmodel/types.d.ts +104 -0
  175. package/dist/readmodel/types.d.ts.map +1 -0
  176. package/dist/readmodel/types.js +15 -0
  177. package/dist/root/index.d.ts +179 -0
  178. package/dist/root/index.d.ts.map +1 -0
  179. package/dist/root/index.js +418 -0
  180. package/dist/root/safe-write.d.ts +268 -0
  181. package/dist/root/safe-write.d.ts.map +1 -0
  182. package/dist/root/safe-write.js +966 -0
  183. package/dist/root/write-artifacts.d.ts +20 -0
  184. package/dist/root/write-artifacts.d.ts.map +1 -0
  185. package/dist/root/write-artifacts.js +42 -0
  186. package/dist/scriptorium/compile.d.ts +4 -0
  187. package/dist/scriptorium/compile.d.ts.map +1 -0
  188. package/dist/scriptorium/compile.js +185 -0
  189. package/dist/scriptorium/frontmatter.d.ts +13 -0
  190. package/dist/scriptorium/frontmatter.d.ts.map +1 -0
  191. package/dist/scriptorium/frontmatter.js +90 -0
  192. package/dist/scriptorium/index.d.ts +3 -0
  193. package/dist/scriptorium/index.d.ts.map +1 -0
  194. package/dist/scriptorium/index.js +1 -0
  195. package/dist/scriptorium/markdown.d.ts +31 -0
  196. package/dist/scriptorium/markdown.d.ts.map +1 -0
  197. package/dist/scriptorium/markdown.js +88 -0
  198. package/dist/scriptorium/types.d.ts +78 -0
  199. package/dist/scriptorium/types.d.ts.map +1 -0
  200. package/dist/scriptorium/types.js +1 -0
  201. package/dist/types/enforcement.d.ts +11 -0
  202. package/dist/types/enforcement.d.ts.map +1 -0
  203. package/dist/types/enforcement.js +1 -0
  204. package/dist/types/integrity.d.ts +33 -0
  205. package/dist/types/integrity.d.ts.map +1 -0
  206. package/dist/types/integrity.js +1 -0
  207. package/dist/types/project-definition.d.ts +30 -0
  208. package/dist/types/project-definition.d.ts.map +1 -0
  209. package/dist/types/project-definition.js +1 -0
  210. package/dist/ui/assets/cosmic-glass-bg-Dwx47zPu.webp +0 -0
  211. package/dist/ui/assets/index-C4NhMaq7.js +28 -0
  212. package/dist/ui/assets/index-DMZ7ZvZY.css +1 -0
  213. package/dist/ui/index.html +13 -0
  214. package/dist/validate/index.d.ts +6 -0
  215. package/dist/validate/index.d.ts.map +1 -0
  216. package/dist/validate/index.js +214 -0
  217. package/dist/version.d.ts +2 -0
  218. package/dist/version.d.ts.map +1 -0
  219. package/dist/version.js +1 -0
  220. package/package.json +67 -4
  221. package/templates/.gitkeep +0 -0
  222. package/templates/default-instance/instruction/.cursorrules +53 -0
  223. package/templates/default-instance/instruction/.windsurfrules +53 -0
  224. package/templates/default-instance/instruction/CLAUDE.md +53 -0
  225. package/templates/default-instance/monolith/context/boot/HANDOFF.md +49 -0
  226. package/templates/default-instance/monolith/context/boot/WORK_SESSION.md +30 -0
  227. package/templates/default-instance/monolith/context/execution/current-state.md +30 -0
  228. package/templates/default-instance/monolith/context/maps/dependency-map.md +38 -0
  229. package/templates/default-instance/monolith/context/maps/project-map.md +85 -0
  230. package/templates/default-instance/monolith/context/maps/roadmap-index.md +41 -0
  231. package/templates/default-instance/monolith/context/maps/routing-map.md +147 -0
  232. package/templates/default-instance/monolith/context/maps/semantic-map.md +73 -0
  233. package/templates/default-instance/monolith/context/models/model-registry.md +37 -0
  234. package/templates/default-instance/monolith/context/models/privacy-classification.md +35 -0
  235. package/templates/default-instance/monolith/context/templates/plan-template.md +56 -0
  236. package/templates/default-instance/monolith/governance/README.md +29 -0
  237. package/templates/default-instance/monolith/governance/RULE_SCHEMA.md +58 -0
  238. package/templates/default-instance/monolith/learning/INDEX.md +48 -0
  239. package/templates/default-instance/monolith/learning/injection-map.md +49 -0
  240. package/templates/default-instance/monolith/learning/taxonomy.md +30 -0
  241. package/templates/default-instance/monolith/memory/errors/README.md +26 -0
  242. package/templates/default-instance/monolith/memory/errors/SCHEMA.md +47 -0
  243. package/templates/default-instance/monolith/memory/errors/TAXONOMY.md +27 -0
  244. package/templates/default-instance/monolith/memory/long-term/architecture-principles.md +31 -0
  245. package/templates/default-instance/monolith/memory/long-term/decisions.md +36 -0
  246. package/templates/default-instance/monolith/memory/long-term/execution-history.md +20 -0
  247. package/templates/default-instance/monolith/memory/long-term/tech-debt.md +25 -0
  248. package/templates/default-instance/monolith/memory/working/active.md +41 -0
  249. package/templates/default-instance/monolith/memory/working/governance-result.md +0 -0
  250. package/templates/default-instance/monolith/memory/working/integrity-result.md +0 -0
  251. package/templates/default-instance/monolith/memory/working/story-index.md +28 -0
  252. package/templates/default-instance/monolith/protocols/boot/boot-sequence.md +59 -0
  253. package/templates/default-instance/monolith/protocols/cognition/cognitive-modes.md +90 -0
  254. package/templates/default-instance/monolith/protocols/cognition/dry-run.md +56 -0
  255. package/templates/default-instance/monolith/protocols/cognition/execution-trace-format.md +52 -0
  256. package/templates/default-instance/monolith/protocols/cognition/semantic-planning.md +51 -0
  257. package/templates/default-instance/monolith/protocols/execution/hybrid-execution.md +37 -0
  258. package/templates/default-instance/monolith/protocols/execution/local-llm-governance.md +42 -0
  259. package/templates/default-instance/monolith/protocols/governance/command-policy.md +51 -0
  260. package/templates/default-instance/monolith/protocols/governance/core-invariants.md +40 -0
  261. package/templates/default-instance/monolith/protocols/governance/memory-governance.md +54 -0
  262. package/templates/default-instance/monolith/protocols/governance/metadata-schema.md +62 -0
  263. package/templates/default-instance/monolith/protocols/governance/skills.md +53 -0
  264. package/templates/default-instance/monolith/protocols/governance/work-session.md +46 -0
  265. package/templates/default-instance/monolith/skills/INDEX.md +28 -0
  266. package/templates/default-instance/monolith/skills/current-status/SKILL.md +47 -0
  267. package/templates/default-instance/monolith/skills/finalize-story/SKILL.md +86 -0
  268. package/templates/default-instance/monolith/skills/global-status/SKILL.md +56 -0
  269. package/templates/default-instance/monolith/skills/self-improvement/SKILL.md +77 -0
  270. package/templates/default-instance/monolith/state.json +11 -0
  271. package/templates/default-instance/monolith/tests/INDEX.md +57 -0
  272. package/templates/default-instance/monolith/tests/scenarios/architecture-review.md +32 -0
  273. package/templates/default-instance/monolith/tests/scenarios/debug-failure.md +32 -0
  274. package/templates/default-instance/monolith/tests/scenarios/dry-run-activation.md +33 -0
  275. package/templates/default-instance/monolith/tests/scenarios/execution-trace-verification.md +31 -0
  276. package/templates/default-instance/monolith/tests/scenarios/finalize-story.md +35 -0
  277. package/templates/default-instance/monolith/tests/scenarios/implement-feature.md +36 -0
  278. package/templates/default-instance/monolith/tests/scenarios/local-llm-delegation.md +31 -0
  279. package/templates/default-instance/monolith/tests/scenarios/planning-request.md +32 -0
  280. package/templates/default-instance/monolith/tests/scenarios/sensitive-context-task.md +30 -0
  281. package/templates/default-instance/monolith/tests/scenarios/validator-verification.md +33 -0
  282. package/templates/default-instance/monolith/tests/validation/expected-behavior.md +70 -0
  283. package/templates/default-instance/monolith/tests/validators/INDEX.md +17 -0
  284. package/templates/default-instance/monolith/tests/validators/delegation-semantics.md +22 -0
  285. package/templates/default-instance/monolith/tests/validators/mode-consistency.md +25 -0
  286. package/templates/default-instance/monolith/tests/validators/privacy-routing.md +23 -0
  287. package/templates/default-instance/monolith/tests/validators/protocol-references.md +27 -0
  288. package/templates/default-instance/monolith/tests/validators/routing-integrity.md +30 -0
  289. package/templates/default-instance/projectroot/AGENTS.md +107 -0
  290. package/templates/default-instance/projectroot/monolith.config.json +32 -0
  291. package/templates/default-instance/projectroot/project.definition.mjs.template +41 -0
@@ -0,0 +1,28 @@
1
+ ---
2
+ type: memory
3
+ id: memory-working-story-index
4
+ category: working
5
+ topology_role: root
6
+ authority: authoritative
7
+ related_protocols:
8
+ - memory-governance
9
+ ---
10
+
11
+ # Story Index
12
+
13
+ ## Purpose
14
+
15
+ Fast navigation index for implementation history.
16
+
17
+ Use this when you need to know:
18
+
19
+ - where a feature was implemented
20
+ - which story changed a module
21
+ - why a decision was made
22
+
23
+ ---
24
+
25
+ # Stories
26
+
27
+ <!-- Stories are added here as they are finalized via the finalize-story skill. -->
28
+ <!-- Format: ## Phase N — Phase Name / ### STORY X.Y — Story Name -->
@@ -0,0 +1,59 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-boot-sequence
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ applies_to:
8
+ - all
9
+ topology_role: node
10
+ ---
11
+
12
+ # AI Assistant Boot Sequence
13
+
14
+ Required context recovery order for any AI assistant entering this repository.
15
+
16
+ Follow this sequence STRICTLY.
17
+
18
+ ---
19
+
20
+ # Fast Recovery Mode (Preferred)
21
+
22
+ For quick session recovery, read in order:
23
+
24
+ 1. `AGENTS.md`
25
+ 2. `{{MONOLITH_ROOT}}/context/maps/project-map.md`
26
+ 3. `{{MONOLITH_ROOT}}/context/maps/routing-map.md` — classify task type
27
+ 4. `{{MONOLITH_ROOT}}/memory/working/active.md`
28
+ 5. `{{MONOLITH_ROOT}}/context/maps/roadmap-index.md`
29
+ 6. `{{MONOLITH_ROOT}}/protocols/governance/memory-governance.md`
30
+ 7. Relevant skill from `{{MONOLITH_ROOT}}/skills/` (resolved via routing-map Table 2)
31
+ 8. `{{MONOLITH_ROOT}}/learning/injection-map.md` — load relevant lesson categories
32
+ 9. `{{MONOLITH_ROOT}}/protocols/cognition/cognitive-modes.md` — apply behavioral constraints
33
+
34
+ ---
35
+
36
+ # Full Recovery Mode
37
+
38
+ When context is lost or session is starting cold:
39
+
40
+ 1. Read AGENTS.md
41
+ 2. Read `{{MONOLITH_ROOT}}/context/maps/project-map.md`
42
+ 3. Read `{{MONOLITH_ROOT}}/context/maps/routing-map.md`
43
+ 4. Read `{{MONOLITH_ROOT}}/memory/working/active.md`
44
+ 5. Read `{{MONOLITH_ROOT}}/context/maps/roadmap-index.md`
45
+ 6. Read `{{MONOLITH_ROOT}}/context/boot/HANDOFF.md` — session transfer
46
+ 7. Read `{{MONOLITH_ROOT}}/context/execution/current-state.md`
47
+ 8. Read `{{MONOLITH_ROOT}}/protocols/governance/memory-governance.md`
48
+ 9. Read `{{MONOLITH_ROOT}}/protocols/governance/core-invariants.md`
49
+ 10. Load skill from `{{MONOLITH_ROOT}}/skills/` per routing-map
50
+ 11. Load learning lessons per `{{MONOLITH_ROOT}}/learning/injection-map.md`
51
+ 12. Apply `{{MONOLITH_ROOT}}/protocols/cognition/cognitive-modes.md`
52
+
53
+ ---
54
+
55
+ # Rules
56
+
57
+ - Do NOT start any task before completing the boot sequence.
58
+ - Do NOT skip steps 3, 4, 8, 9 under any circumstances.
59
+ - One story at a time. Verify active.md before accepting new work.
@@ -0,0 +1,90 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-cognitive-modes
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ applies_to:
8
+ - all
9
+ topology_role: node
10
+ ---
11
+
12
+ # Cognitive Modes Protocol
13
+
14
+ 7 named modes that govern AI behavioral posture.
15
+
16
+ ---
17
+
18
+ ## Core Principle
19
+
20
+ Every task begins with a declared cognitive mode. The mode defines what is allowed, what is forbidden, and what mutations are permitted.
21
+
22
+ ---
23
+
24
+ ### exploration
25
+
26
+ **Activation triggers:** exploration-request, status-check, global-overview, ambiguous task
27
+
28
+ **Allowed:** read files, ask clarifying questions, summarize, map relationships
29
+ **Forbidden:** write code, modify files, create new files, make decisions
30
+ **Mutations:** none
31
+
32
+ ---
33
+
34
+ ### planning
35
+
36
+ **Activation triggers:** planning-request, architecture-review when no code change yet
37
+
38
+ **Allowed:** read files, create plan documents in context/templates/, propose approaches
39
+ **Forbidden:** implement without user approval, modify source code
40
+ **Mutations:** context/templates/ only
41
+
42
+ ---
43
+
44
+ ### implementation
45
+
46
+ **Activation triggers:** implementation-task, new-feature, documentation-update
47
+
48
+ **Allowed:** read and write source files, create tests, update memory
49
+ **Forbidden:** autonomous capability expansion, hidden state, silent semantic degradation
50
+ **Mutations:** source files, tests, memory/working/
51
+
52
+ ---
53
+
54
+ ### debugging
55
+
56
+ **Activation triggers:** bug-investigation
57
+
58
+ **Allowed:** read all files, add diagnostic logging, propose and apply fixes
59
+ **Forbidden:** refactor unrelated code while debugging, change architecture without user approval
60
+ **Mutations:** source files (targeted fixes only)
61
+
62
+ ---
63
+
64
+ ### review
65
+
66
+ **Activation triggers:** code-review, architecture-review
67
+
68
+ **Allowed:** read all files, write review comments, propose changes
69
+ **Forbidden:** apply changes without user approval
70
+ **Mutations:** none (propose only)
71
+
72
+ ---
73
+
74
+ ### finalization
75
+
76
+ **Activation triggers:** finalize-story, story-transition
77
+
78
+ **Allowed:** verify integrity, update memory, write capsule, update execution-history
79
+ **Forbidden:** add new features, modify source code logic
80
+ **Mutations:** memory/ only (working and long-term)
81
+
82
+ ---
83
+
84
+ ### reflection
85
+
86
+ **Activation triggers:** self-improvement, learning-update
87
+
88
+ **Allowed:** read error records, extract lessons, write to learning/mistakes/
89
+ **Forbidden:** modify source code, apply fixes (that's debugging mode)
90
+ **Mutations:** learning/mistakes/ only
@@ -0,0 +1,56 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-dry-run
4
+ category: cognition
5
+ scope: system
6
+ enforcement: conditional
7
+ ---
8
+
9
+ # Cognitive Dry-Run Protocol
10
+
11
+ When to activate dry-run mode and how to execute it.
12
+
13
+ ---
14
+
15
+ ## Activation
16
+
17
+ Activate dry-run when:
18
+
19
+ - Task involves irreversible operations (delete, deploy, drop database)
20
+ - Task scope is unclear
21
+ - Task may affect shared/production systems
22
+ - User explicitly requests dry-run
23
+
24
+ ---
25
+
26
+ ## Severity Levels
27
+
28
+ | Level | Description | Action |
29
+ | ---------- | ------------------------------------ | ------------------------- |
30
+ | `safe` | Read-only or easily reversible | Proceed |
31
+ | `caution` | Reversible but significant | Confirm with user |
32
+ | `warning` | Hard to reverse | Show dry-run output first |
33
+ | `critical` | Irreversible or production-affecting | Require explicit approval |
34
+
35
+ ---
36
+
37
+ ## Dry-Run Format
38
+
39
+ ```
40
+ DRY RUN — What would happen:
41
+
42
+ 1. [ACTION] file.ts — description of change
43
+ 2. [CREATE] new-file.ts — what would be created
44
+ 3. [DELETE] old-file.ts — what would be deleted
45
+
46
+ Severity: warning
47
+ Proceed? (yes / no)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Rules
53
+
54
+ - Never execute critical operations without dry-run first
55
+ - Never skip dry-run because "it's obvious"
56
+ - Dry-run output must list ALL side effects
@@ -0,0 +1,52 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-execution-trace-format
4
+ category: cognition
5
+ scope: system
6
+ enforcement: mandatory
7
+ ---
8
+
9
+ # Execution Trace Format
10
+
11
+ Standard format for execution traces written to `memory/execution/traces/`.
12
+
13
+ ---
14
+
15
+ ## File Naming
16
+
17
+ `YYYYMMDD-HHMMSS-<story-id>-<phase>.json`
18
+
19
+ ---
20
+
21
+ ## Schema
22
+
23
+ ```json
24
+ {
25
+ "traceId": "uuid",
26
+ "timestamp": "ISO 8601",
27
+ "protocolId": "finalize-story",
28
+ "storyId": "story-1-1-name",
29
+ "phaseId": "phase-1-name",
30
+ "steps": [
31
+ {
32
+ "stepId": "step-1",
33
+ "description": "What was done",
34
+ "status": "PASS | FAIL | WARN | SKIP",
35
+ "duration_ms": 0,
36
+ "output": "optional output summary"
37
+ }
38
+ ],
39
+ "result": {
40
+ "status": "PASS | FAIL | WARN",
41
+ "summary": "One-line summary"
42
+ }
43
+ }
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Rules
49
+
50
+ - Traces are append-only — never modify existing trace files
51
+ - One trace per protocol execution
52
+ - Failed traces must include error details in the step output
@@ -0,0 +1,51 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-semantic-planning
4
+ category: cognition
5
+ scope: planning
6
+ enforcement: mandatory
7
+ applies_to:
8
+ - planning-request
9
+ - architecture-review
10
+ ---
11
+
12
+ # Semantic Planning Protocol
13
+
14
+ How to conduct planning tasks in MONOLITH.
15
+
16
+ ---
17
+
18
+ ## When to Activate
19
+
20
+ - Task type is `planning-request`
21
+ - A new story requires upfront design
22
+ - Architecture review before implementation
23
+
24
+ ---
25
+
26
+ ## Steps
27
+
28
+ 1. **Read context** — Read routing-map, active.md, roadmap-index
29
+ 2. **Clarify objective** — One sentence: what does this plan achieve?
30
+ 3. **Identify constraints** — What must NOT change?
31
+ 4. **Propose approach** — 3-5 numbered steps, each actionable
32
+ 5. **List affected files** — Specific paths, not "the codebase"
33
+ 6. **Surface risks** — What could go wrong?
34
+ 7. **Define done** — Measurable completion criteria
35
+ 8. **Get user approval** — Do NOT implement without explicit "proceed"
36
+
37
+ ---
38
+
39
+ ## Output
40
+
41
+ Use `context/templates/plan-template.md` as the document format.
42
+
43
+ Store plan in `context/templates/` with a descriptive filename.
44
+
45
+ ---
46
+
47
+ ## Rules
48
+
49
+ - No implementation during planning mode
50
+ - Plans must be approved before any file is modified
51
+ - If scope changes during planning, restart from step 2
@@ -0,0 +1,37 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-hybrid-execution
4
+ category: execution
5
+ scope: system
6
+ enforcement: mandatory
7
+ ---
8
+
9
+ # Hybrid Execution Protocol
10
+
11
+ Governance for hybrid local/cloud AI execution model.
12
+
13
+ ---
14
+
15
+ ## Model Tiers
16
+
17
+ | Tier | When | Model |
18
+ | --------------- | ----------------------------------- | ------------------------ |
19
+ | cloud (default) | Public/internal data, general tasks | Default AI tool |
20
+ | local | Sensitive/restricted data | Local LLM (if available) |
21
+
22
+ ---
23
+
24
+ ## Routing Decision
25
+
26
+ 1. Classify context data using `context/models/privacy-classification.md`
27
+ 2. If any data is `sensitive` or `restricted` → switch to local tier
28
+ 3. If local model unavailable → pause and alert user
29
+ 4. If data is `public` or `internal` → use default cloud model
30
+
31
+ ---
32
+
33
+ ## Rules
34
+
35
+ - Never send `sensitive` or `restricted` data to cloud models
36
+ - Always check privacy classification before starting a task with external data
37
+ - If in doubt, ask user to classify before proceeding
@@ -0,0 +1,42 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-local-llm-governance
4
+ category: execution
5
+ scope: system
6
+ enforcement: conditional
7
+ ---
8
+
9
+ # Local LLM Governance
10
+
11
+ Rules for AI operations using local LLM models.
12
+
13
+ ---
14
+
15
+ ## When Local Model is Required
16
+
17
+ - Context contains `sensitive` or `restricted` data (per privacy-classification.md)
18
+ - User explicitly requests local execution
19
+ - Compliance requirements mandate on-premise processing
20
+
21
+ ---
22
+
23
+ ## Rules
24
+
25
+ 1. **Capability check** — Verify local model is available before routing
26
+ 2. **Fallback** — If local model unavailable: pause task, alert user, do not fall back to cloud for sensitive data
27
+ 3. **Quality gate** — Local models may have lower capability; flag to user if confidence is low
28
+ 4. **Audit** — Log all local model executions in execution traces
29
+
30
+ ---
31
+
32
+ ## Local Model Setup
33
+
34
+ Configure local model path in `monolith.config.json`:
35
+
36
+ ```json
37
+ {
38
+ "models": {
39
+ "local": "ollama://llama3.2"
40
+ }
41
+ }
42
+ ```
@@ -0,0 +1,51 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-command-policy
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ ---
8
+
9
+ # Command Policy
10
+
11
+ What commands the AI assistant may execute without confirmation, with confirmation, and never.
12
+
13
+ ---
14
+
15
+ ## Execute Without Confirmation
16
+
17
+ - `git status`, `git log`, `git diff` (read-only)
18
+ - `cat`, `ls`, `find`, `grep` (read-only)
19
+ - Build commands: `tsc`, `pnpm build`, `npm run build`
20
+ - Lint: `eslint`, `prettier`
21
+ - Test: `pnpm test`, `npm test`
22
+
23
+ ---
24
+
25
+ ## Execute With User Confirmation
26
+
27
+ - `git commit`, `git push`
28
+ - `git reset`, `git checkout`
29
+ - File creation in source directories
30
+ - `npm install`, `pnpm add`
31
+ - Any command that modifies shared state
32
+
33
+ ---
34
+
35
+ ## Never Execute Without Explicit Instruction
36
+
37
+ - `rm -rf`, `git clean -f`, `git reset --hard`
38
+ - Database migrations on production
39
+ - Deploy to production
40
+ - Publish to npm
41
+ - Delete branches
42
+ - Force push
43
+
44
+ ---
45
+
46
+ ## Rules
47
+
48
+ 1. When in doubt: ask, don't act
49
+ 2. Destructive operations: always show dry-run first
50
+ 3. Production-affecting operations: require explicit written confirmation
51
+ 4. Never bypass safety hooks (--no-verify, --force) without explicit instruction
@@ -0,0 +1,40 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-core-invariants
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ trigger: always_on
8
+ applies_to:
9
+ - all
10
+ ---
11
+
12
+ # Core Invariants
13
+
14
+ Always-on operational invariants. Applied to every task regardless of cognitive mode.
15
+
16
+ ---
17
+
18
+ ## Universal Invariants
19
+
20
+ These never change.
21
+
22
+ 1. **One story at a time** — Never start a new story without finishing or explicitly pausing the current one.
23
+ 2. **Vertical slice first** — Implement features end-to-end before expanding scope.
24
+ 3. **No autonomous capability expansion** — Never add features not explicitly requested.
25
+ 4. **No hidden state** — Every decision and state change must be visible and documented.
26
+ 5. **Memory before code** — Read active.md before writing any code.
27
+ 6. **Integrity before report** — Run integrity verification before claiming a story done.
28
+ 7. **No silent semantic degradation** — If meaning changes, make it explicit.
29
+
30
+ ---
31
+
32
+ ## Current Product Focus
33
+
34
+ <!-- Add project-specific invariants and current focus here. -->
35
+ <!-- This section is filled by the user after init. -->
36
+
37
+ <!-- Example: -->
38
+ <!-- - We are building a data pipeline MVP. No UI work until pipeline is stable. -->
39
+ <!-- - TypeScript strict mode everywhere. No `any` without justification. -->
40
+ <!-- - All new endpoints must have integration tests. -->
@@ -0,0 +1,54 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-memory-governance
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ applies_to:
8
+ - memory
9
+ - stories
10
+ - skills
11
+ topology_role: node
12
+ ---
13
+
14
+ # Memory Governance
15
+
16
+ Rules for creating, updating, migrating, and deprecating memory.
17
+
18
+ ---
19
+
20
+ ## Core Rules
21
+
22
+ ### 1. Avoid Monolithic Context Files
23
+
24
+ Do not expand a single large file indefinitely. Prefer:
25
+
26
+ - phase memory (per-phase capsules)
27
+ - story capsules (per-story records)
28
+ - indexed references (pointers, not content duplication)
29
+ - modular memory (separate files per domain)
30
+
31
+ ### 2. Separate Stable vs Volatile Memory
32
+
33
+ | Type | Location | Update Frequency |
34
+ | -------------------- | -------------------- | ----------------------- |
35
+ | Volatile (per-story) | `memory/working/` | Every story |
36
+ | Stable (cross-story) | `memory/long-term/` | On significant decision |
37
+ | Error records | `memory/errors/` | On failure |
38
+ | Lessons | `learning/mistakes/` | On self-improvement |
39
+
40
+ ### 3. Single Source of Truth
41
+
42
+ Each fact has exactly one authoritative location. Reference, don't duplicate.
43
+
44
+ ### 4. Append-Only History
45
+
46
+ `memory/long-term/execution-history.md` is append-only. Never edit past entries.
47
+
48
+ ### 5. Story Context Required
49
+
50
+ All `memory/working/` updates must reference the active story ID.
51
+
52
+ ### 6. Integrity Before Report
53
+
54
+ `memory/working/integrity-result.md` must be updated before finalizing a story.
@@ -0,0 +1,62 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-metadata-schema
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ ---
8
+
9
+ # Metadata Schema
10
+
11
+ YAML frontmatter schema for all MONOLITH artifacts.
12
+
13
+ ---
14
+
15
+ ## Required Fields
16
+
17
+ ```yaml
18
+ ---
19
+ type: memory | context | protocol | skill | schema | reference | template
20
+ id: unique-kebab-case-id
21
+ ---
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Optional Fields
27
+
28
+ ```yaml
29
+ ---
30
+ category: working | long-term | errors | execution | boot | governance | cognition
31
+ stability: volatile | stable | permanent
32
+ authority: authoritative | derived | reference
33
+ topology_role: root | node | leaf
34
+ enforcement: mandatory | conditional | optional
35
+ scope: system | project | story
36
+ applies_to:
37
+ - task-type-or-all
38
+ related_protocols:
39
+ - protocol-id
40
+ referenced_by:
41
+ - artifact-id
42
+ append_only: true | false
43
+ ---
44
+ ```
45
+
46
+ ---
47
+
48
+ ## topology_role Values
49
+
50
+ | Value | Meaning |
51
+ | ------ | -------------------------------------------- |
52
+ | `root` | Entry point; must exist; read at boot |
53
+ | `node` | Internal; referenced by roots or other nodes |
54
+ | `leaf` | Terminal; not referenced by others |
55
+
56
+ ---
57
+
58
+ ## Rules
59
+
60
+ - Every artifact must have `type` and `id`
61
+ - `id` must be unique across the instance
62
+ - `topology_role: root` artifacts are verified by the topology validator
@@ -0,0 +1,53 @@
1
+ ---
2
+ type: protocol
3
+ id: protocol-skills-governance
4
+ category: governance
5
+ scope: system
6
+ enforcement: mandatory
7
+ ---
8
+
9
+ # Skills Governance
10
+
11
+ Rules for AI skills — what they can do and what they cannot.
12
+
13
+ ---
14
+
15
+ ## What a Skill Is
16
+
17
+ A skill is a declarative procedure file that defines:
18
+
19
+ - when it activates (trigger)
20
+ - what it does (steps)
21
+ - what it produces (outputs)
22
+ - what it must verify (checks)
23
+
24
+ A skill does NOT contain runtime code. It is a specification read by the AI.
25
+
26
+ ---
27
+
28
+ ## Skill Rules
29
+
30
+ 1. **Atomic** — A skill runs to completion or not at all. No partial execution.
31
+ 2. **Idempotent** — Running a skill twice must not corrupt state.
32
+ 3. **Single story** — Skills operate on the active story only.
33
+ 4. **Memory first** — Read `memory/working/active.md` before starting any skill.
34
+ 5. **Verification required** — Skills that modify memory must verify their output.
35
+
36
+ ---
37
+
38
+ ## Skill Boundaries
39
+
40
+ | Allowed | Forbidden |
41
+ | ------------------------------ | ------------------------------------------------- |
42
+ | Read any file | Delete files outside memory/ |
43
+ | Write to memory/ | Modify source code (except implementation skills) |
44
+ | Create context/templates/ | Push to remote repositories |
45
+ | Call other skills as sub-steps | Call skills recursively |
46
+
47
+ ---
48
+
49
+ ## Adding a Skill
50
+
51
+ 1. Create `skills/<name>/SKILL.md`
52
+ 2. Add entry to `skills/INDEX.md`
53
+ 3. Add routing entry in `context/maps/routing-map.md` Table 2