@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,73 @@
1
+ ---
2
+ type: context
3
+ id: semantic-map
4
+ topology_role: root
5
+ authority: authoritative
6
+ ---
7
+
8
+ # Semantic Map
9
+
10
+ Where authoritative truth lives for each semantic domain.
11
+
12
+ ---
13
+
14
+ ## Memory Domain
15
+
16
+ | What | Authoritative Source |
17
+ | ---------------------- | --------------------------------------- |
18
+ | Active story | `memory/working/active.md` |
19
+ | Story history | `memory/working/story-index.md` |
20
+ | ADR index | `docs/adr/README.md` (repo-relative, outside `{{MONOLITH_ROOT}}`) |
21
+ | Non-ADR decisions (`DEC-…`) | `memory/long-term/decisions.md` |
22
+ | Execution log | `memory/long-term/execution-history.md` |
23
+ | Error records | `memory/errors/ERR-*.md` |
24
+
25
+ ---
26
+
27
+ ## Context Domain
28
+
29
+ | What | Authoritative Source |
30
+ | ------------------ | ------------------------------- |
31
+ | Task routing | `context/maps/routing-map.md` |
32
+ | Project navigation | `context/maps/project-map.md` |
33
+ | Roadmap | `context/maps/roadmap-index.md` |
34
+ | Session state | `context/boot/HANDOFF.md` |
35
+
36
+ ---
37
+
38
+ ## Skills Domain
39
+
40
+ | What | Authoritative Source |
41
+ | ---------------- | ------------------------ |
42
+ | Available skills | `skills/INDEX.md` |
43
+ | Skill procedures | `skills/<name>/SKILL.md` |
44
+
45
+ ---
46
+
47
+ ## Protocols Domain
48
+
49
+ | What | Authoritative Source |
50
+ | ---------------- | ------------------------------------------- |
51
+ | Boot order | `protocols/boot/boot-sequence.md` |
52
+ | Behavioral modes | `protocols/cognition/cognitive-modes.md` |
53
+ | Memory rules | `protocols/governance/memory-governance.md` |
54
+ | Core invariants | `protocols/governance/core-invariants.md` |
55
+
56
+ ---
57
+
58
+ ## Learning Domain
59
+
60
+ | What | Authoritative Source |
61
+ | --------------- | ------------------------------- |
62
+ | Error lessons | `learning/mistakes/<category>/` |
63
+ | Injection rules | `learning/injection-map.md` |
64
+ | Taxonomy | `learning/taxonomy.md` |
65
+
66
+ ---
67
+
68
+ ## Governance Domain
69
+
70
+ | What | Authoritative Source |
71
+ | ---------------- | --------------------------- |
72
+ | Governance rules | `governance/GOV-*.md` |
73
+ | Rule schema | `governance/RULE_SCHEMA.md` |
@@ -0,0 +1,37 @@
1
+ ---
2
+ type: context
3
+ id: model-registry
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Model Registry
8
+
9
+ Available AI models and their capability tiers for this project.
10
+
11
+ Reference: `context/models/privacy-classification.md`
12
+
13
+ ---
14
+
15
+ ## Tiers
16
+
17
+ | Tier | Description | Use When |
18
+ | --------- | ------------------------------ | ----------------------------------- |
19
+ | `default` | Cloud model (e.g. Claude Opus) | General tasks, public/internal data |
20
+ | `local` | Local LLM (e.g. Ollama) | Sensitive/restricted data |
21
+
22
+ ---
23
+
24
+ ## Default Model
25
+
26
+ **Tool:** {{AI_TOOL}}
27
+ **Default tier:** cloud
28
+
29
+ ---
30
+
31
+ ## Privacy Override
32
+
33
+ When context contains `sensitive` or `restricted` data:
34
+ → Switch to `local` tier if available
35
+ → Otherwise: proceed with caution and flag to user
36
+
37
+ See: `protocols/execution/hybrid-execution.md`
@@ -0,0 +1,35 @@
1
+ ---
2
+ type: context
3
+ id: privacy-classification
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Privacy Classification
8
+
9
+ Data classification levels that determine model tier routing.
10
+
11
+ ---
12
+
13
+ ## Levels
14
+
15
+ | Level | Examples | Model Tier |
16
+ | ------------ | ------------------------------- | --------------- |
17
+ | `public` | Open source code, public docs | default (cloud) |
18
+ | `internal` | Internal architecture, planning | default (cloud) |
19
+ | `sensitive` | API keys, credentials, PII | local only |
20
+ | `restricted` | Compliance data, secrets | local only |
21
+
22
+ ---
23
+
24
+ ## Detection Rules
25
+
26
+ Flag as `sensitive` or `restricted` if the context includes:
27
+
28
+ - API keys or tokens
29
+ - Database credentials
30
+ - Personal identifiable information (PII)
31
+ - Payment data
32
+ - Health data
33
+ - Anything marked CONFIDENTIAL
34
+
35
+ When flagged: route to `local` tier, or pause and alert user.
@@ -0,0 +1,56 @@
1
+ ---
2
+ type: template
3
+ id: plan-template
4
+ category: templates
5
+ ---
6
+
7
+ # Plan: {{PLAN_TITLE}}
8
+
9
+ **Story:** STORY X.Y — Story Name
10
+ **Date:** YYYY-MM-DD
11
+ **Mode:** planning
12
+
13
+ ---
14
+
15
+ ## Objective
16
+
17
+ <!-- What does this plan achieve? -->
18
+
19
+ ---
20
+
21
+ ## Constraints
22
+
23
+ <!-- What must NOT change? What are the boundaries? -->
24
+
25
+ ---
26
+
27
+ ## Approach
28
+
29
+ <!-- Step-by-step implementation approach. -->
30
+
31
+ 1.
32
+ 2.
33
+ 3.
34
+
35
+ ---
36
+
37
+ ## Files Affected
38
+
39
+ | File | Change Type |
40
+ | ---- | ----------- |
41
+ | | |
42
+
43
+ ---
44
+
45
+ ## Risks
46
+
47
+ <!-- What could go wrong? -->
48
+
49
+ ---
50
+
51
+ ## Definition of Done
52
+
53
+ <!-- How will we know this is complete? -->
54
+
55
+ - [ ]
56
+ - [ ]
@@ -0,0 +1,29 @@
1
+ # Governance
2
+
3
+ This directory stores active governance rules for this project.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ governance/
9
+ ├── RULE_SCHEMA.md — format for GOV-*.md files
10
+ ├── README.md — this file
11
+ └── GOV-*.md — active governance rules (created at runtime)
12
+ ```
13
+
14
+ ## What Are Governance Rules?
15
+
16
+ Rules created when repeated failure patterns are detected. They encode project-specific behavioral constraints that the AI assistant must follow.
17
+
18
+ Unlike `protocols/governance/core-invariants.md` (universal rules), GOV-\*.md files are project-specific and evolve with the project.
19
+
20
+ ## Lifecycle
21
+
22
+ 1. A failure pattern is detected (via self-improvement skill or governance evaluation)
23
+ 2. A `GOV-*.md` file is created following `RULE_SCHEMA.md`
24
+ 3. The rule is enforced on subsequent sessions via the governance gate
25
+ 4. Rules can be superseded or archived when no longer relevant
26
+
27
+ ## Governance Evaluation
28
+
29
+ Run `monolith validate` to check for rule violations.
@@ -0,0 +1,58 @@
1
+ ---
2
+ type: schema
3
+ id: governance-rule-schema
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Governance Rule Schema
8
+
9
+ Format for governance rules in `governance/GOV-*.md`.
10
+
11
+ ## File Naming
12
+
13
+ `GOV-YYYY-XXXX.md` where YYYY = year, XXXX = sequential ID.
14
+
15
+ ## Fields
16
+
17
+ ```yaml
18
+ ---
19
+ id: GOV-YYYY-XXXX
20
+ date: YYYY-MM-DD
21
+ trigger: pattern that activates this rule
22
+ severity: critical | high | medium | low
23
+ status: active | superseded | archived
24
+ origin_story: STORY X.Y (optional — which story created this rule)
25
+ ---
26
+ ```
27
+
28
+ ## Body
29
+
30
+ ```markdown
31
+ ## Rule
32
+
33
+ One-sentence statement of the rule. Must be actionable and unambiguous.
34
+
35
+ ## Context
36
+
37
+ Why this rule exists. What failure pattern it prevents.
38
+
39
+ ## Pattern
40
+
41
+ The trigger condition: what behavior or situation activates this rule.
42
+
43
+ ## Action
44
+
45
+ What to do when the pattern is detected.
46
+
47
+ ## Examples
48
+
49
+ Concrete examples of the rule in action.
50
+ ```
51
+
52
+ ## When to Create a Rule
53
+
54
+ Create `GOV-*.md` when:
55
+
56
+ - A mistake occurs more than once with the same root cause
57
+ - A boundary violation is detected in governance evaluation
58
+ - A new constraint is established through discussion
@@ -0,0 +1,48 @@
1
+ ---
2
+ type: reference
3
+ id: learning-index
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Learning Layer
8
+
9
+ Overview of the MONOLITH learning system for this project.
10
+
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Capture lessons from mistakes and inject them into future tasks to prevent repetition.
16
+
17
+ ---
18
+
19
+ ## Structure
20
+
21
+ ```
22
+ learning/
23
+ ├── INDEX.md — this file (navigation overview)
24
+ ├── taxonomy.md — 8 error categories
25
+ ├── injection-map.md — task type → lesson categories
26
+ └── mistakes/
27
+ ├── architecture/ — architectural mistakes
28
+ ├── dependencies/ — dependency/import errors
29
+ ├── nonexistent-api/ — calling nonexistent methods/APIs
30
+ ├── context-sync/ — memory/state sync errors
31
+ ├── workflow/ — protocol violations
32
+ ├── typescript/ — TypeScript errors
33
+ └── documentation/ — missing or incorrect docs
34
+ ```
35
+
36
+ ---
37
+
38
+ ## How Lessons Are Injected
39
+
40
+ At boot step 8, the AI reads `learning/injection-map.md` to determine which lesson categories to load based on the current task type.
41
+
42
+ Lessons are searched by filename, tags, and keywords. Matching lessons are prepended to the task context to prevent known mistakes.
43
+
44
+ ---
45
+
46
+ ## How to Add a Lesson
47
+
48
+ Use the `self-improvement` skill. Or manually create `LESSON-YYYY-XXXX.md` in the appropriate category directory.
@@ -0,0 +1,49 @@
1
+ ---
2
+ type: reference
3
+ id: learning-injection-map
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Learning Injection Map
8
+
9
+ Maps task types to lesson categories that should be loaded at boot step 8.
10
+
11
+ ---
12
+
13
+ ## Injection Rules
14
+
15
+ | Task Type | Load Lesson Categories |
16
+ | ---------------------- | --------------------------------------------------------- |
17
+ | `implementation-task` | architecture, typescript, dependencies |
18
+ | `new-feature` | architecture, dependencies |
19
+ | `bug-investigation` | architecture, nonexistent-api, context-sync, dependencies |
20
+ | `code-review` | architecture, typescript |
21
+ | `finalize-story` | workflow, architecture |
22
+ | `architecture-review` | architecture |
23
+ | `planning-request` | architecture |
24
+ | `documentation-update` | documentation |
25
+ | `self-improvement` | all categories |
26
+ | `learning-update` | all categories |
27
+ | `status-check` | context-sync |
28
+ | `global-overview` | context-sync |
29
+ | `story-transition` | workflow |
30
+ | `exploration-request` | context-sync |
31
+
32
+ ---
33
+
34
+ ## Injection Threshold
35
+
36
+ Load lessons if they contain at least one of:
37
+
38
+ - A keyword matching the current task description
39
+ - A tag matching the current task type or cognitive mode
40
+ - A protocol name referenced in the current context
41
+
42
+ ---
43
+
44
+ ## Custom Injections
45
+
46
+ Add project-specific injection rules at the bottom of this file.
47
+
48
+ <!-- Example: -->
49
+ <!-- | `database-migration` | architecture, context-sync, workflow | -->
@@ -0,0 +1,30 @@
1
+ ---
2
+ type: reference
3
+ id: learning-taxonomy
4
+ authority: authoritative
5
+ ---
6
+
7
+ # Learning Taxonomy
8
+
9
+ 7 canonical categories for organizing lessons and mistakes.
10
+
11
+ ---
12
+
13
+ | Category | Lessons About |
14
+ | ----------------- | ----------------------------------------------------------------------------------- |
15
+ | `architecture` | Structural violations, layer boundary breaches, coupling issues, wrong abstractions |
16
+ | `dependencies` | Missing packages, version conflicts, circular imports, import resolution errors |
17
+ | `nonexistent-api` | Calling functions, methods, endpoints, or properties that do not exist |
18
+ | `context-sync` | Memory state out of sync with actual project state, stale assumptions |
19
+ | `workflow` | Protocol violations, skipped steps, wrong execution order, gate bypass |
20
+ | `typescript` | Type errors, incorrect generics, wrong inference, `any` misuse |
21
+ | `documentation` | Missing docs, stale descriptions, incorrect examples, wrong paths |
22
+
23
+ ---
24
+
25
+ ## Usage
26
+
27
+ - When creating a lesson with the self-improvement skill, map the mistake to exactly one category
28
+ - When searching for lessons, start with the most specific category
29
+ - Use `context-sync` for "I assumed X but it was actually Y" mistakes
30
+ - Use `nonexistent-api` for "I called X which doesn't exist" mistakes
@@ -0,0 +1,26 @@
1
+ # Error Memory
2
+
3
+ This directory stores failure records for this project.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ memory/errors/
9
+ ├── SCHEMA.md — format for ERR-*.md files
10
+ ├── TAXONOMY.md — 8 error categories
11
+ └── ERR-*.md — individual error records (created at runtime)
12
+ ```
13
+
14
+ ## When to Create a Record
15
+
16
+ Create an `ERR-*.md` file when:
17
+
18
+ - A significant error occurred during implementation
19
+ - A misunderstanding caused wrong behavior
20
+ - A pattern of mistakes was identified
21
+
22
+ ## How to Create
23
+
24
+ Use the `self-improvement` skill or manually create `ERR-YYYY-XXXX.md` following `SCHEMA.md`.
25
+
26
+ Lessons extracted from errors live in `learning/mistakes/<category>/`.
@@ -0,0 +1,47 @@
1
+ ---
2
+ type: schema
3
+ id: error-schema
4
+ category: errors
5
+ authority: authoritative
6
+ ---
7
+
8
+ # Error Record Schema
9
+
10
+ Schema for error records in `memory/errors/`.
11
+
12
+ ## Format
13
+
14
+ Filename: `ERR-YYYY-XXXX.md` where YYYY = year, XXXX = sequential ID.
15
+
16
+ ## Fields
17
+
18
+ ```yaml
19
+ ---
20
+ id: ERR-YYYY-XXXX
21
+ date: YYYY-MM-DD
22
+ category: architecture | dependencies | nonexistent-api | context-sync | workflow | typescript | documentation | other
23
+ severity: critical | high | medium | low
24
+ story: STORY X.Y — Story Name (optional)
25
+ resolved: true | false
26
+ ---
27
+ ```
28
+
29
+ ## Body
30
+
31
+ ```markdown
32
+ ## Error Description
33
+
34
+ What went wrong.
35
+
36
+ ## Root Cause
37
+
38
+ Why it happened.
39
+
40
+ ## Resolution
41
+
42
+ How it was fixed.
43
+
44
+ ## Prevention
45
+
46
+ How to avoid in future (becomes a lesson in learning/mistakes/).
47
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ type: reference
3
+ id: error-taxonomy
4
+ category: errors
5
+ authority: authoritative
6
+ ---
7
+
8
+ # Error Taxonomy
9
+
10
+ 8 canonical error categories for MONOLITH projects.
11
+
12
+ | Category | Description |
13
+ | ----------------- | -------------------------------------------------------------- |
14
+ | `architecture` | Structural violations, wrong layer boundaries, coupling issues |
15
+ | `dependencies` | Missing packages, version conflicts, import errors |
16
+ | `nonexistent-api` | Calling functions/methods/endpoints that don't exist |
17
+ | `context-sync` | Memory state out of sync with actual project state |
18
+ | `workflow` | Protocol violations, skipped steps, wrong execution order |
19
+ | `typescript` | Type errors, inference failures, incorrect generics |
20
+ | `documentation` | Missing, stale, or incorrect documentation |
21
+ | `other` | Errors that don't fit the above categories |
22
+
23
+ ## Usage
24
+
25
+ - Reference when creating `ERR-*.md` records
26
+ - The `category` field must match one of the above exactly
27
+ - Lessons in `learning/mistakes/` are organized by these categories
@@ -0,0 +1,31 @@
1
+ ---
2
+ type: memory
3
+ id: memory-long-term-architecture-principles
4
+ category: long-term
5
+ authority: authoritative
6
+ related_protocols:
7
+ - memory-governance
8
+ ---
9
+
10
+ # Architecture Principles
11
+
12
+ Stable architectural principles for this project. Read before every implementation task.
13
+
14
+ ---
15
+
16
+ ## Principles
17
+
18
+ <!-- Add your core architectural principles here. -->
19
+ <!-- Example: "Vertical slice first. Feature complete before horizontal scale." -->
20
+
21
+ ---
22
+
23
+ ## Stack Decisions
24
+
25
+ <!-- Key technology choices and the reasoning behind them. -->
26
+
27
+ ---
28
+
29
+ ## Invariants
30
+
31
+ <!-- Things that must never change without an explicit ADR. -->
@@ -0,0 +1,36 @@
1
+ ---
2
+ type: memory
3
+ id: memory-long-term-decisions
4
+ category: long-term
5
+ authority: authoritative
6
+ related_protocols:
7
+ - memory-governance
8
+ ---
9
+
10
+ # Decisions
11
+
12
+ Project decisions that are **not** ADRs (`DEC-…` records). Architecture Decision Records are not listed or summarised here: if this project keeps ADRs, their only index is `docs/adr/README.md`.
13
+
14
+ Updated by the finalize-story skill when a story records a decision that is not an ADR.
15
+
16
+ ---
17
+
18
+ ## Decision Template
19
+
20
+ ```
21
+ ### DEC-YYYY-XXXX — Decision Title
22
+
23
+ **Date:** YYYY-MM-DD
24
+ **Story:** STORY X.Y — Story Name
25
+ **Status:** Active | Superseded | Deprecated
26
+
27
+ **Context:** Why this decision was needed.
28
+ **Decision:** What was decided.
29
+ **Consequences:** What changes as a result.
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Decisions
35
+
36
+ <!-- Decisions are recorded here as stories are finalized. -->
@@ -0,0 +1,20 @@
1
+ ---
2
+ type: memory
3
+ id: memory-long-term-execution-history
4
+ category: long-term
5
+ authority: authoritative
6
+ append_only: true
7
+ ---
8
+
9
+ # Execution History
10
+
11
+ Append-only log of completed story finalizations.
12
+
13
+ Each entry is written by the finalize-story skill at story completion.
14
+
15
+ ---
16
+
17
+ ## History
18
+
19
+ <!-- Entries are appended here. Do not edit or delete existing entries. -->
20
+ <!-- Format: ## STORY X.Y — Story Name (YYYY-MM-DD) -->
@@ -0,0 +1,25 @@
1
+ ---
2
+ type: memory
3
+ id: memory-long-term-tech-debt
4
+ category: long-term
5
+ authority: authoritative
6
+ ---
7
+
8
+ # Technical Debt Registry
9
+
10
+ Tracks intentional technical debt to prevent accidental "fixing" of accepted trade-offs.
11
+
12
+ ---
13
+
14
+ ## Open Debt
15
+
16
+ | ID | Description | Accepted | Rationale |
17
+ | --- | ----------- | -------- | --------- |
18
+ | — | — | — | — |
19
+
20
+ ---
21
+
22
+ ## Accepted Debt
23
+
24
+ <!-- Debt that has been consciously accepted with a known trade-off. -->
25
+ <!-- Do NOT fix accepted debt without explicitly revisiting the decision. -->
@@ -0,0 +1,41 @@
1
+ ---
2
+ type: memory
3
+ id: memory-working-active
4
+ category: working
5
+ stability: volatile
6
+ authority: authoritative
7
+ topology_role: root
8
+ related_protocols:
9
+ - memory-governance
10
+ referenced_by:
11
+ - skill-finalize-story
12
+ - skill-current-status
13
+ - skill-global-status
14
+ ---
15
+
16
+ # Active Working Memory
17
+
18
+ ## Active Phase
19
+
20
+ No active phase.
21
+
22
+ ---
23
+
24
+ ## Current Story
25
+
26
+ No active story.
27
+
28
+ Previous: —
29
+
30
+ ---
31
+
32
+ ## Last Finalization
33
+
34
+ No finalization recorded yet.
35
+
36
+ ---
37
+
38
+ ## Current Operational Focus
39
+
40
+ <!-- Update this section when starting the first phase. -->
41
+ <!-- Describe what the project is building and what is in focus now. -->