naive-framework 0.0.0-stage → 0.2.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 (549) hide show
  1. package/AGENTS.md +62 -0
  2. package/LICENSE +21 -0
  3. package/README.md +37 -2
  4. package/docs/decisions/decisions.json +888 -0
  5. package/docs/ontology.json +796 -0
  6. package/docs/ontology.md +163 -0
  7. package/docs/reference/ROUTES.md +124 -0
  8. package/evidence/benchmarks/2026-10-27-golden.jev.after-catalog-fix.json +558 -0
  9. package/evidence/benchmarks/2026-10-27-golden.jev.json +501 -0
  10. package/evidence/benchmarks/2026-10-27-golden.reasoning-answers.json +177 -0
  11. package/evidence/benchmarks/JEV_VS_REASONING_MODEL_2026-10-27.md +68 -0
  12. package/evidence/capabilities/agent-capabilities.json +86 -0
  13. package/evidence/design-documents.registry.json +2896 -0
  14. package/evidence/evals/evals.json +25 -0
  15. package/evidence/evals/harness-evals.json +140 -0
  16. package/evidence/layer.json +51 -0
  17. package/evidence/skills/agent-capabilities/SKILL.md +35 -0
  18. package/evidence/skills/design-coverage/SKILL.md +57 -0
  19. package/evidence/skills/design-coverage/check.mjs +192 -0
  20. package/evidence/skills/design-coverage/scan.mjs +45 -0
  21. package/evidence/skills/fidelity-ladder-audit/SKILL.md +121 -0
  22. package/evidence/skills/fidelity-ladder-audit/ladder-census.mjs +180 -0
  23. package/evidence/skills/findability/SKILL.md +32 -0
  24. package/evidence/skills/findability/inventory.rb +41 -0
  25. package/evidence/skills/foreshadowing-audit/SKILL.md +183 -0
  26. package/evidence/skills/metrics-review/SKILL.md +177 -0
  27. package/evidence/tooling/integrations.json +153 -0
  28. package/governance/layer.json +102 -0
  29. package/governance/references/references.json +26 -0
  30. package/governance/skills/board-design/SKILL.md +68 -0
  31. package/governance/skills/brand-pillar/SKILL.md +90 -0
  32. package/governance/skills/business-pillar/SKILL.md +96 -0
  33. package/governance/skills/chief-of-staff/SKILL.md +45 -0
  34. package/governance/skills/cofounder-structure/SKILL.md +64 -0
  35. package/governance/skills/cross-pillar-tradeoff/SKILL.md +168 -0
  36. package/governance/skills/equity-and-share-classes/SKILL.md +68 -0
  37. package/governance/skills/executive-roles/SKILL.md +95 -0
  38. package/governance/skills/exit-planning/SKILL.md +66 -0
  39. package/governance/skills/financing-and-investor-rights/SKILL.md +73 -0
  40. package/governance/skills/office-hours-mode/SKILL.md +113 -0
  41. package/governance/skills/product-pillar/SKILL.md +81 -0
  42. package/governance/skills/publication-policy/SKILL.md +63 -0
  43. package/governance/skills/role-and-candidate-authoring/SKILL.md +198 -0
  44. package/governance/skills/stakeholder-update/SKILL.md +177 -0
  45. package/governance/tooling/integrations.json +37 -0
  46. package/governance/venture-template/AGENT_ROLES_AND_DECISION_RIGHTS.md +58 -0
  47. package/governance/venture-template/COMPANY_VAULT_DEFINITION_2026-10-25.md +204 -0
  48. package/governance/venture-template/README.md +74 -0
  49. package/governance/venture-template/decision-rights.json +186 -0
  50. package/governance/venture-template/index.md +151 -0
  51. package/governance/venture-template/pillars/brand.md +209 -0
  52. package/governance/venture-template/pillars/business.md +255 -0
  53. package/governance/venture-template/pillars/product.md +254 -0
  54. package/governance/venture-template/render-roles.py +11 -0
  55. package/governance/venture-template/roles/README.md +85 -0
  56. package/governance/venture-template/roles/agent-roles.json +202 -0
  57. package/governance/venture-template/roles/ceo.md +163 -0
  58. package/governance/venture-template/roles/chief-of-staff.md +153 -0
  59. package/governance/venture-template/roles/cmo.md +165 -0
  60. package/governance/venture-template/roles/coo.md +189 -0
  61. package/governance/venture-template/roles/cto.md +158 -0
  62. package/governance/venture-template/roles/department-head.md +47 -0
  63. package/governance/venture-template/roles/forward-deployed-engineer.md +51 -0
  64. package/governance/venture-template/roles/founder.md +173 -0
  65. package/governance/venture-template/roles/hr-manager.md +49 -0
  66. package/governance/venture-template/roles/talent-acquisition-manager.md +50 -0
  67. package/governance/venture-template/roles/venture-roles.json +62 -0
  68. package/interface/acting.mjs +83 -0
  69. package/interface/adapters/claude-code.json +16 -0
  70. package/interface/adapters/codex.json +14 -0
  71. package/interface/adapters/cursor.json +16 -0
  72. package/interface/adapters.mjs +182 -0
  73. package/interface/api/server.mjs +71 -0
  74. package/interface/boundaries.mjs +218 -0
  75. package/interface/brand.mjs +214 -0
  76. package/interface/cli/find-venture.mjs +15 -0
  77. package/interface/cli/freshness.mjs +59 -0
  78. package/interface/cli/guard.mjs +6 -0
  79. package/interface/cli/mentura.mjs +341 -0
  80. package/interface/cli/naive.mjs +194 -0
  81. package/interface/context.mjs +524 -0
  82. package/interface/demo/board.mjs +581 -0
  83. package/interface/demo/decision-harness.mjs +91 -0
  84. package/interface/demo/live-agent.mjs +47 -0
  85. package/interface/dev/setup.mjs +84 -0
  86. package/interface/gate-hooks.mjs +36 -0
  87. package/interface/harness/evals.mjs +90 -0
  88. package/interface/harness/examples/pt-no-shows.dump.md +19 -0
  89. package/interface/harness/run.mjs +313 -0
  90. package/interface/harness/site.mjs +59 -0
  91. package/interface/instrumentation.mjs +86 -0
  92. package/interface/kit-boundary.mjs +73 -0
  93. package/interface/layer.json +37 -0
  94. package/interface/mcp/server.mjs +162 -0
  95. package/interface/operator-console/README.md +58 -0
  96. package/interface/package-routes.mjs +196 -0
  97. package/interface/provenance.mjs +65 -0
  98. package/interface/reads.mjs +173 -0
  99. package/interface/references/references.json +28 -0
  100. package/interface/release-card.mjs +42 -0
  101. package/interface/route-aliases.json +32 -0
  102. package/interface/router.mjs +653 -0
  103. package/interface/skills/install-mentura/SKILL.md +88 -0
  104. package/interface/skills/naive-setup/SKILL.md +71 -0
  105. package/interface/skills/naive-setup/artifact.html +83 -0
  106. package/interface/tooling/integrations.json +112 -0
  107. package/interface/vitals.mjs +115 -0
  108. package/interface/writes.mjs +190 -0
  109. package/knowledge/connectors/README.md +54 -0
  110. package/knowledge/connectors/catalog.mjs +118 -0
  111. package/knowledge/connectors/contract.mjs +56 -0
  112. package/knowledge/connectors/eval.mjs +176 -0
  113. package/knowledge/connectors/filesystem.mjs +79 -0
  114. package/knowledge/connectors/index.mjs +102 -0
  115. package/knowledge/connectors/resolve.mjs +44 -0
  116. package/knowledge/connectors/suite.mjs +80 -0
  117. package/knowledge/freshness.json +85 -0
  118. package/knowledge/layer.json +50 -0
  119. package/knowledge/skills/find-reference/SKILL.md +38 -0
  120. package/knowledge/skills/industry-awareness/SKILL.md +277 -0
  121. package/knowledge/templates/glossary.md +23 -0
  122. package/knowledge/tooling/integrations.json +127 -0
  123. package/knowledge/tooling/questions.md +46 -0
  124. package/operations/FOUNDER_OPERATING_MODEL_CAMPAIGN_2026-10-14.md +16 -0
  125. package/operations/departments.json +162 -0
  126. package/operations/handoff-v2.md +93 -0
  127. package/operations/layer.json +67 -0
  128. package/operations/marketing/check-public.mjs +68 -0
  129. package/operations/marketing/site/README.md +86 -0
  130. package/operations/marketing/site/matrix.json +731 -0
  131. package/operations/marketing/site/plan.mjs +117 -0
  132. package/operations/marketing/site/presence.mjs +252 -0
  133. package/operations/references/references.json +45 -0
  134. package/operations/skills/recruiting/SKILL.md +32 -0
  135. package/operations/skills/team-design/SKILL.md +36 -0
  136. package/operations/skills/tool-selection/SKILL.md +46 -0
  137. package/operations/templates/marketing-brand.md +46 -0
  138. package/operations/templates/public-assets.md +39 -0
  139. package/operations/templates/recruiting-brief.md +35 -0
  140. package/operations/tooling/integrations.json +158 -0
  141. package/package.json +59 -4
  142. package/packages/catalog.json +280 -0
  143. package/packages/cofounder/package.json +42 -0
  144. package/packages/counsel/package.json +47 -0
  145. package/packages/customers/package.json +41 -0
  146. package/packages/deals/package.json +27 -0
  147. package/packages/decisions/package.json +28 -0
  148. package/packages/engineering/package.json +41 -0
  149. package/packages/evidence/package.json +17 -0
  150. package/packages/finance/frames/fund-without-ceding-control.frame.json +177 -0
  151. package/packages/finance/package.json +48 -0
  152. package/packages/foundation/package.json +59 -0
  153. package/packages/fund/package.json +48 -0
  154. package/packages/investor/package.json +57 -0
  155. package/packages/investors/package.json +21 -0
  156. package/packages/legal/package.json +73 -0
  157. package/packages/marketing/package.json +63 -0
  158. package/packages/money/package.json +42 -0
  159. package/packages/operations/package.json +74 -0
  160. package/packages/partner/package.json +38 -0
  161. package/packages/people/package.json +64 -0
  162. package/packages/product/package.json +49 -0
  163. package/packages/raw/package.json +19 -0
  164. package/packages/relationships/package.json +52 -0
  165. package/packages/validation/package.json +112 -0
  166. package/platform/README.md +51 -0
  167. package/platform/adapter.json +15 -0
  168. package/platform/connectors/eval.mjs +154 -0
  169. package/platform/connectors/fake-github.mjs +91 -0
  170. package/platform/connectors/github.mjs +105 -0
  171. package/platform/integrations/jev.mjs +30 -0
  172. package/platform/integrations/langsmith-docket.mjs +53 -0
  173. package/platform/integrations/langsmith-setup.mjs +115 -0
  174. package/platform/integrations/langsmith.mjs +47 -0
  175. package/platform/integrations/remote-image.mjs +79 -0
  176. package/platform/integrations/rho.mjs +146 -0
  177. package/platform/integrations/site.mjs +75 -0
  178. package/platform/kits/README.md +14 -0
  179. package/platform/kits/agent-upgrade/kit.json +15 -0
  180. package/platform/kits/agent-upgrade/run.mjs +82 -0
  181. package/platform/kits/agent-upgrade/stand-in-agent.mjs +32 -0
  182. package/platform/kits/validation-kickoff/kit.json +29 -0
  183. package/platform/mcp/research.mjs +64 -0
  184. package/platform/webhooks/server.mjs +70 -0
  185. package/purpose/checklists/vault-and-tooling-consultancy-setup.md +216 -0
  186. package/purpose/frameworks/business-discovery-framework-amendments-2026-05-20.md +181 -0
  187. package/purpose/frameworks/business-discovery-framework.html +938 -0
  188. package/purpose/frameworks/business-discovery-framework.md +326 -0
  189. package/purpose/frameworks/idea-map/README.md +74 -0
  190. package/purpose/frameworks/idea-map/conventions.json +146 -0
  191. package/purpose/frameworks/idea-map/graph.mjs +182 -0
  192. package/purpose/frameworks/idea-map/ideamap.mjs +181 -0
  193. package/purpose/frameworks/idea-map/route.mjs +140 -0
  194. package/purpose/frameworks/onboarding-handoff-framework.md +269 -0
  195. package/purpose/frameworks/post-discovery-deliverable-playbook.md +274 -0
  196. package/purpose/frameworks/product-anatomy/README.md +63 -0
  197. package/purpose/frameworks/product-anatomy/anatomy.mjs +195 -0
  198. package/purpose/frameworks/product-anatomy/examples/polity.answers.reasoned.json +11 -0
  199. package/purpose/frameworks/product-anatomy/examples/polity.json +89 -0
  200. package/purpose/frameworks/product-anatomy/phases.json +107 -0
  201. package/purpose/frameworks/product-anatomy/questions.json +74 -0
  202. package/purpose/kits/validation/README.md +14 -0
  203. package/purpose/kits/validation/references/references.json +122 -0
  204. package/purpose/kits/validation/skills/problem-validation/SKILL.md +43 -0
  205. package/purpose/kits/validation/skills/validation-score/SKILL.md +35 -0
  206. package/purpose/kits/validation/templates/go-to-market.md +19 -0
  207. package/purpose/kits/validation/templates/operations-readiness.md +20 -0
  208. package/purpose/kits/validation/templates/pricing.md +22 -0
  209. package/purpose/kits/validation/templates/problem-interview.md +36 -0
  210. package/purpose/kits/validation/templates/problem.md +45 -0
  211. package/purpose/kits/validation/templates/product-market-fit.md +23 -0
  212. package/purpose/kits/validation/templates/solution.md +18 -0
  213. package/purpose/kits/validation/templates/team.md +19 -0
  214. package/purpose/kits/validation/weights.json +22 -0
  215. package/purpose/layer.json +53 -0
  216. package/purpose/references/references.json +324 -0
  217. package/purpose/skills/ambition-tier/SKILL.md +205 -0
  218. package/purpose/skills/telos/SKILL.md +52 -0
  219. package/purpose/strategic-foundation.json +133 -0
  220. package/purpose/templates/telos-based-smart.md +39 -0
  221. package/purpose/tooling/integrations.json +48 -0
  222. package/schema/README.md +62 -0
  223. package/schema/VERSION +1 -0
  224. package/schema/access.mjs +57 -0
  225. package/schema/account.schema.json +79 -0
  226. package/schema/adapter.schema.json +33 -0
  227. package/schema/add-department.mjs +41 -0
  228. package/schema/agent-capability.schema.json +94 -0
  229. package/schema/alignment.schema.json +61 -0
  230. package/schema/assess-problem.mjs +131 -0
  231. package/schema/assets.mjs +212 -0
  232. package/schema/bdd.mjs +56 -0
  233. package/schema/board.schema.json +101 -0
  234. package/schema/brand.mjs +373 -0
  235. package/schema/build-release.mjs +61 -0
  236. package/schema/caching.mjs +505 -0
  237. package/schema/check-assets.mjs +24 -0
  238. package/schema/check-boundary.mjs +54 -0
  239. package/schema/check-brand.mjs +24 -0
  240. package/schema/check-config.mjs +110 -0
  241. package/schema/check-data-model.mjs +170 -0
  242. package/schema/check-data-packages.mjs +83 -0
  243. package/schema/check-departments.mjs +45 -0
  244. package/schema/check-execution.mjs +85 -0
  245. package/schema/check-governance.mjs +98 -0
  246. package/schema/check-integrations.mjs +33 -0
  247. package/schema/check-nextjs-status.mjs +79 -0
  248. package/schema/check-nouns.mjs +49 -0
  249. package/schema/check-people.mjs +70 -0
  250. package/schema/check-private.mjs +61 -0
  251. package/schema/check-provenance.mjs +55 -0
  252. package/schema/check-publication.mjs +96 -0
  253. package/schema/check-ready.mjs +89 -0
  254. package/schema/check-sources.mjs +74 -0
  255. package/schema/check-team.mjs +94 -0
  256. package/schema/check-telos.mjs +59 -0
  257. package/schema/check-validation.mjs +165 -0
  258. package/schema/check-ventures.mjs +81 -0
  259. package/schema/check-where-used.mjs +58 -0
  260. package/schema/data-master.schema.json +14 -0
  261. package/schema/data-model.json +1584 -0
  262. package/schema/data-model.schema.json +152 -0
  263. package/schema/deal.schema.json +80 -0
  264. package/schema/decision-analytics.mjs +77 -0
  265. package/schema/decision-record.schema.json +290 -0
  266. package/schema/decision-rights.schema.json +34 -0
  267. package/schema/decision.schema.json +30 -0
  268. package/schema/decisions.mjs +327 -0
  269. package/schema/department-catalog.schema.json +55 -0
  270. package/schema/department.schema.json +15 -0
  271. package/schema/departments.mjs +32 -0
  272. package/schema/docket-eval.mjs +89 -0
  273. package/schema/docket.mjs +135 -0
  274. package/schema/eval-suite.schema.json +45 -0
  275. package/schema/evidence.schema.json +110 -0
  276. package/schema/examples/frames/judge.mjs +10 -0
  277. package/schema/examples/migrate/agent.mjs +12 -0
  278. package/schema/examples/venture-type/jev.mjs +12 -0
  279. package/schema/examples/workspace/ventures/acme-labs/AGENTS.md +17 -0
  280. package/schema/examples/workspace/ventures/acme-labs/accounts/.gitkeep +0 -0
  281. package/schema/examples/workspace/ventures/acme-labs/decisions/discovery-goal.decision.json +23 -0
  282. package/schema/examples/workspace/ventures/acme-labs/decisions/statement-icp.decision.json +22 -0
  283. package/schema/examples/workspace/ventures/acme-labs/decisions/statement-problem.decision.json +22 -0
  284. package/schema/examples/workspace/ventures/acme-labs/decisions/venture.team.decision.json +37 -0
  285. package/schema/examples/workspace/ventures/acme-labs/knowledge/README.md +3 -0
  286. package/schema/examples/workspace/ventures/acme-labs/knowledge/sources.json +46 -0
  287. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000001.json +12 -0
  288. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000002.json +12 -0
  289. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000003.json +12 -0
  290. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000004.json +12 -0
  291. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000005.json +12 -0
  292. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000006.json +12 -0
  293. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000007.json +12 -0
  294. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000008.json +12 -0
  295. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000009.json +12 -0
  296. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000010.json +12 -0
  297. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000011.json +12 -0
  298. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000012.json +12 -0
  299. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000013.json +12 -0
  300. package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000014.json +12 -0
  301. package/schema/examples/workspace/ventures/acme-labs/money/_streams/transactions/stream.json +5 -0
  302. package/schema/examples/workspace/ventures/acme-labs/money/_summary.json +30 -0
  303. package/schema/examples/workspace/ventures/acme-labs/operations/departments/customer-service/README.md +5 -0
  304. package/schema/examples/workspace/ventures/acme-labs/operations/departments/customer-service/department.json +5 -0
  305. package/schema/examples/workspace/ventures/acme-labs/operations/departments/finance/README.md +5 -0
  306. package/schema/examples/workspace/ventures/acme-labs/operations/departments/finance/department.json +5 -0
  307. package/schema/examples/workspace/ventures/acme-labs/operations/departments/human-capital/README.md +5 -0
  308. package/schema/examples/workspace/ventures/acme-labs/operations/departments/human-capital/department.json +5 -0
  309. package/schema/examples/workspace/ventures/acme-labs/operations/departments/it/README.md +5 -0
  310. package/schema/examples/workspace/ventures/acme-labs/operations/departments/it/department.json +5 -0
  311. package/schema/examples/workspace/ventures/acme-labs/operations/departments/marketing-and-sales/README.md +5 -0
  312. package/schema/examples/workspace/ventures/acme-labs/operations/departments/marketing-and-sales/department.json +5 -0
  313. package/schema/examples/workspace/ventures/acme-labs/operations/departments/products/README.md +5 -0
  314. package/schema/examples/workspace/ventures/acme-labs/operations/departments/products/department.json +5 -0
  315. package/schema/examples/workspace/ventures/acme-labs/operations/departments/strategy/README.md +5 -0
  316. package/schema/examples/workspace/ventures/acme-labs/operations/departments/strategy/department.json +5 -0
  317. package/schema/examples/workspace/ventures/acme-labs/people/founders/maya-chen.json +15 -0
  318. package/schema/examples/workspace/ventures/acme-labs/people/people.json +22 -0
  319. package/schema/examples/workspace/ventures/acme-labs/pillars/brand.md +5 -0
  320. package/schema/examples/workspace/ventures/acme-labs/pillars/business.md +5 -0
  321. package/schema/examples/workspace/ventures/acme-labs/pillars/product.md +5 -0
  322. package/schema/examples/workspace/ventures/acme-labs/products/.gitkeep +0 -0
  323. package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.core-product.decision.json +28 -0
  324. package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.exists.decision.json +38 -0
  325. package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.flagship.decision.json +27 -0
  326. package/schema/examples/workspace/ventures/acme-labs/profile.md +12 -0
  327. package/schema/examples/workspace/ventures/acme-labs/provenance.jsonl +12 -0
  328. package/schema/examples/workspace/ventures/acme-labs/raw/dump.md +6 -0
  329. package/schema/examples/workspace/ventures/acme-labs/venture.json +27 -0
  330. package/schema/examples/workspace/ventures/northstar/AGENTS.md +17 -0
  331. package/schema/examples/workspace/ventures/northstar/accounts/.gitkeep +0 -0
  332. package/schema/examples/workspace/ventures/northstar/deals/ductline.json +8 -0
  333. package/schema/examples/workspace/ventures/northstar/deals/kilnworks.json +14 -0
  334. package/schema/examples/workspace/ventures/northstar/decisions/venture.team.decision.json +31 -0
  335. package/schema/examples/workspace/ventures/northstar/evidence/README.md +3 -0
  336. package/schema/examples/workspace/ventures/northstar/fund/decisions/terms.decision.json +27 -0
  337. package/schema/examples/workspace/ventures/northstar/fund/decisions/terms.first-close.decision.json +27 -0
  338. package/schema/examples/workspace/ventures/northstar/fund/decisions/thesis.decision.json +26 -0
  339. package/schema/examples/workspace/ventures/northstar/fund/terms.json +22 -0
  340. package/schema/examples/workspace/ventures/northstar/fund/thesis.json +22 -0
  341. package/schema/examples/workspace/ventures/northstar/governance/README.md +3 -0
  342. package/schema/examples/workspace/ventures/northstar/governance/departments/external-relationships/charter.md +5 -0
  343. package/schema/examples/workspace/ventures/northstar/governance/departments/external-relationships/department.json +5 -0
  344. package/schema/examples/workspace/ventures/northstar/governance/departments/finance/charter.md +5 -0
  345. package/schema/examples/workspace/ventures/northstar/governance/departments/finance/department.json +5 -0
  346. package/schema/examples/workspace/ventures/northstar/governance/departments/human-capital/charter.md +5 -0
  347. package/schema/examples/workspace/ventures/northstar/governance/departments/human-capital/department.json +5 -0
  348. package/schema/examples/workspace/ventures/northstar/governance/departments/risk-and-compliance/charter.md +5 -0
  349. package/schema/examples/workspace/ventures/northstar/governance/departments/risk-and-compliance/department.json +5 -0
  350. package/schema/examples/workspace/ventures/northstar/governance/departments/strategy/charter.md +5 -0
  351. package/schema/examples/workspace/ventures/northstar/governance/departments/strategy/department.json +5 -0
  352. package/schema/examples/workspace/ventures/northstar/knowledge/README.md +3 -0
  353. package/schema/examples/workspace/ventures/northstar/operations/README.md +3 -0
  354. package/schema/examples/workspace/ventures/northstar/operations/departments/external-relationships/README.md +5 -0
  355. package/schema/examples/workspace/ventures/northstar/operations/departments/external-relationships/department.json +5 -0
  356. package/schema/examples/workspace/ventures/northstar/operations/departments/finance/README.md +5 -0
  357. package/schema/examples/workspace/ventures/northstar/operations/departments/finance/department.json +5 -0
  358. package/schema/examples/workspace/ventures/northstar/operations/departments/human-capital/README.md +5 -0
  359. package/schema/examples/workspace/ventures/northstar/operations/departments/human-capital/department.json +5 -0
  360. package/schema/examples/workspace/ventures/northstar/operations/departments/risk-and-compliance/README.md +5 -0
  361. package/schema/examples/workspace/ventures/northstar/operations/departments/risk-and-compliance/department.json +5 -0
  362. package/schema/examples/workspace/ventures/northstar/operations/departments/strategy/README.md +5 -0
  363. package/schema/examples/workspace/ventures/northstar/operations/departments/strategy/department.json +5 -0
  364. package/schema/examples/workspace/ventures/northstar/people/founders/ana-ruiz.json +13 -0
  365. package/schema/examples/workspace/ventures/northstar/people/founders/ben-okafor.json +7 -0
  366. package/schema/examples/workspace/ventures/northstar/people/people.json +27 -0
  367. package/schema/examples/workspace/ventures/northstar/pillars/brand.md +5 -0
  368. package/schema/examples/workspace/ventures/northstar/pillars/business.md +5 -0
  369. package/schema/examples/workspace/ventures/northstar/pillars/product.md +5 -0
  370. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/AGENTS.md +17 -0
  371. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/accounts/.gitkeep +0 -0
  372. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/decisions/venture.team.decision.json +31 -0
  373. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/knowledge/README.md +3 -0
  374. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/customer-service/README.md +5 -0
  375. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/customer-service/department.json +5 -0
  376. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/finance/README.md +5 -0
  377. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/finance/department.json +5 -0
  378. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/human-capital/README.md +5 -0
  379. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/human-capital/department.json +5 -0
  380. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/it/README.md +5 -0
  381. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/it/department.json +5 -0
  382. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/marketing-and-sales/README.md +5 -0
  383. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/marketing-and-sales/department.json +5 -0
  384. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/products/README.md +5 -0
  385. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/products/department.json +5 -0
  386. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/strategy/README.md +5 -0
  387. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/strategy/department.json +5 -0
  388. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/brand.md +5 -0
  389. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/business.md +5 -0
  390. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/product.md +5 -0
  391. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/.gitkeep +0 -0
  392. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.core-product.decision.json +28 -0
  393. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.exists.decision.json +32 -0
  394. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.flagship.decision.json +27 -0
  395. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/profile.md +5 -0
  396. package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/venture.json +27 -0
  397. package/schema/examples/workspace/ventures/northstar/products/.gitkeep +0 -0
  398. package/schema/examples/workspace/ventures/northstar/profile.md +5 -0
  399. package/schema/examples/workspace/ventures/northstar/provenance.jsonl +3 -0
  400. package/schema/examples/workspace/ventures/northstar/purpose/README.md +3 -0
  401. package/schema/examples/workspace/ventures/northstar/venture.json +49 -0
  402. package/schema/examples/workspace/ventures/studio/accounts/bakery/account.json +18 -0
  403. package/schema/examples/workspace/ventures/studio/evidence/.gitkeep +0 -0
  404. package/schema/examples/workspace/ventures/studio/governance/.gitkeep +0 -0
  405. package/schema/examples/workspace/ventures/studio/knowledge/.gitkeep +0 -0
  406. package/schema/examples/workspace/ventures/studio/operations/.gitkeep +0 -0
  407. package/schema/examples/workspace/ventures/studio/print/knowledge/.gitkeep +0 -0
  408. package/schema/examples/workspace/ventures/studio/print/purpose/.gitkeep +0 -0
  409. package/schema/examples/workspace/ventures/studio/print/venture.json +37 -0
  410. package/schema/examples/workspace/ventures/studio/products/brand-care.json +19 -0
  411. package/schema/examples/workspace/ventures/studio/products/brand-kit.json +23 -0
  412. package/schema/examples/workspace/ventures/studio/provenance.jsonl +3 -0
  413. package/schema/examples/workspace/ventures/studio/purpose/.gitkeep +0 -0
  414. package/schema/examples/workspace/ventures/studio/venture.json +43 -0
  415. package/schema/examples/workspace/ventures/tandem/accounts/.gitkeep +0 -0
  416. package/schema/examples/workspace/ventures/tandem/evidence/README.md +3 -0
  417. package/schema/examples/workspace/ventures/tandem/governance/README.md +3 -0
  418. package/schema/examples/workspace/ventures/tandem/governance/agreements/dee-fast.md +3 -0
  419. package/schema/examples/workspace/ventures/tandem/governance/board.json +51 -0
  420. package/schema/examples/workspace/ventures/tandem/governance/departments/finance/charter.md +5 -0
  421. package/schema/examples/workspace/ventures/tandem/governance/departments/finance/department.json +5 -0
  422. package/schema/examples/workspace/ventures/tandem/governance/departments/primary/marketing-and-sales/charter.md +5 -0
  423. package/schema/examples/workspace/ventures/tandem/governance/departments/primary/marketing-and-sales/department.json +5 -0
  424. package/schema/examples/workspace/ventures/tandem/governance/exit.json +33 -0
  425. package/schema/examples/workspace/ventures/tandem/governance/founder-agreement.json +24 -0
  426. package/schema/examples/workspace/ventures/tandem/governance/founder-agreement.md +3 -0
  427. package/schema/examples/workspace/ventures/tandem/governance/ownership.json +131 -0
  428. package/schema/examples/workspace/ventures/tandem/governance/publication-policy.json +171 -0
  429. package/schema/examples/workspace/ventures/tandem/knowledge/README.md +3 -0
  430. package/schema/examples/workspace/ventures/tandem/knowledge/research/friends-feedback-2026-08.md +3 -0
  431. package/schema/examples/workspace/ventures/tandem/knowledge/research/pilot-2026-10.md +3 -0
  432. package/schema/examples/workspace/ventures/tandem/knowledge/research/problem-interviews-2026-09.md +20 -0
  433. package/schema/examples/workspace/ventures/tandem/knowledge/sources.json +8 -0
  434. package/schema/examples/workspace/ventures/tandem/knowledge/where-used.json +13 -0
  435. package/schema/examples/workspace/ventures/tandem/operations/README.md +3 -0
  436. package/schema/examples/workspace/ventures/tandem/operations/departments/finance/README.md +5 -0
  437. package/schema/examples/workspace/ventures/tandem/operations/departments/finance/department.json +5 -0
  438. package/schema/examples/workspace/ventures/tandem/operations/departments/primary/marketing-and-sales/README.md +5 -0
  439. package/schema/examples/workspace/ventures/tandem/operations/departments/primary/marketing-and-sales/department.json +5 -0
  440. package/schema/examples/workspace/ventures/tandem/pillars/brand.md +5 -0
  441. package/schema/examples/workspace/ventures/tandem/pillars/business.md +5 -0
  442. package/schema/examples/workspace/ventures/tandem/pillars/product.md +5 -0
  443. package/schema/examples/workspace/ventures/tandem/products/.gitkeep +0 -0
  444. package/schema/examples/workspace/ventures/tandem/products/shop-app.json +22 -0
  445. package/schema/examples/workspace/ventures/tandem/profile.md +5 -0
  446. package/schema/examples/workspace/ventures/tandem/provenance.jsonl +13 -0
  447. package/schema/examples/workspace/ventures/tandem/purpose/README.md +3 -0
  448. package/schema/examples/workspace/ventures/tandem/purpose/telos.json +78 -0
  449. package/schema/examples/workspace/ventures/tandem/purpose/validation/go-to-market.json +35 -0
  450. package/schema/examples/workspace/ventures/tandem/purpose/validation/pricing.json +37 -0
  451. package/schema/examples/workspace/ventures/tandem/purpose/validation/problem.json +74 -0
  452. package/schema/examples/workspace/ventures/tandem/purpose/validation/product-market-fit.json +66 -0
  453. package/schema/examples/workspace/ventures/tandem/purpose/validation/solution.json +33 -0
  454. package/schema/examples/workspace/ventures/tandem/purpose/validation/team.json +52 -0
  455. package/schema/examples/workspace/ventures/tandem/venture.json +79 -0
  456. package/schema/examples/workspace/ventures/woodworking/knowledge/.gitkeep +0 -0
  457. package/schema/examples/workspace/ventures/woodworking/venture.json +21 -0
  458. package/schema/examples/workspace/workspace.json +8 -0
  459. package/schema/exit.schema.json +74 -0
  460. package/schema/foundation.mjs +118 -0
  461. package/schema/founder-agreement.schema.json +83 -0
  462. package/schema/founder.schema.json +72 -0
  463. package/schema/frame.schema.json +240 -0
  464. package/schema/frames.mjs +228 -0
  465. package/schema/freshness-log.schema.json +40 -0
  466. package/schema/freshness-profiles.schema.json +44 -0
  467. package/schema/freshness.mjs +473 -0
  468. package/schema/fund-terms.schema.json +107 -0
  469. package/schema/fund-thesis.schema.json +87 -0
  470. package/schema/gate-drafts.mjs +130 -0
  471. package/schema/gate.mjs +133 -0
  472. package/schema/glossary.schema.json +25 -0
  473. package/schema/handoff.schema.json +239 -0
  474. package/schema/icp.schema.json +136 -0
  475. package/schema/idea-graph.schema.json +61 -0
  476. package/schema/init-venture.mjs +128 -0
  477. package/schema/integration.schema.json +143 -0
  478. package/schema/judgment.schema.json +38 -0
  479. package/schema/kit.schema.json +47 -0
  480. package/schema/kits.mjs +24 -0
  481. package/schema/knowledge-sources.schema.json +260 -0
  482. package/schema/layer.json +59 -0
  483. package/schema/layer.schema.json +119 -0
  484. package/schema/load-packages.mjs +26 -0
  485. package/schema/marketing-brand.schema.json +116 -0
  486. package/schema/marketing-sitemap.schema.json +232 -0
  487. package/schema/migrate-venture.mjs +192 -0
  488. package/schema/migrations/kit-to-package.mjs +94 -0
  489. package/schema/migrations/package-layout.mjs +86 -0
  490. package/schema/model-steps.mjs +717 -0
  491. package/schema/money-summary.schema.json +138 -0
  492. package/schema/naive-config.mjs +165 -0
  493. package/schema/naive-config.schema.json +268 -0
  494. package/schema/need-now.json +772 -0
  495. package/schema/need-now.mjs +108 -0
  496. package/schema/nextjs-status.schema.json +29 -0
  497. package/schema/ownership.schema.json +282 -0
  498. package/schema/packages.json +4 -0
  499. package/schema/packages.mjs +252 -0
  500. package/schema/payouts.mjs +91 -0
  501. package/schema/people.schema.json +86 -0
  502. package/schema/port-venture.mjs +161 -0
  503. package/schema/product.schema.json +223 -0
  504. package/schema/provenance-entry.schema.json +154 -0
  505. package/schema/public-assets.schema.json +76 -0
  506. package/schema/publication-policy.schema.json +293 -0
  507. package/schema/raw-source.schema.json +15 -0
  508. package/schema/reference.schema.json +115 -0
  509. package/schema/release-read.mjs +111 -0
  510. package/schema/releases.mjs +497 -0
  511. package/schema/route-aliases.schema.json +25 -0
  512. package/schema/run-handoff.mjs +51 -0
  513. package/schema/scaffold/defaults.json +54 -0
  514. package/schema/setup.mjs +164 -0
  515. package/schema/site-presence.schema.json +337 -0
  516. package/schema/stale.mjs +111 -0
  517. package/schema/start-release.mjs +41 -0
  518. package/schema/strategic-foundation.schema.json +74 -0
  519. package/schema/stream.schema.json +14 -0
  520. package/schema/structure.mjs +186 -0
  521. package/schema/systems-catalog.json +126 -0
  522. package/schema/systems-catalog.schema.json +78 -0
  523. package/schema/team-plan.schema.json +157 -0
  524. package/schema/telos.schema.json +197 -0
  525. package/schema/time-to-ready.mjs +93 -0
  526. package/schema/trigger.schema.json +44 -0
  527. package/schema/triggers.mjs +237 -0
  528. package/schema/upgrade-registry.schema.json +60 -0
  529. package/schema/upgrade-venture.mjs +107 -0
  530. package/schema/upgrades.json +69 -0
  531. package/schema/upgrades.mjs +385 -0
  532. package/schema/use-model.mjs +10 -0
  533. package/schema/validate.py +58 -0
  534. package/schema/validation-evidence.schema.json +123 -0
  535. package/schema/validation-go-to-market.schema.json +110 -0
  536. package/schema/validation-operations-readiness.schema.json +91 -0
  537. package/schema/validation-pricing.schema.json +114 -0
  538. package/schema/validation-problem.schema.json +118 -0
  539. package/schema/validation-product-market-fit.schema.json +135 -0
  540. package/schema/validation-solution.schema.json +79 -0
  541. package/schema/validation-team.schema.json +116 -0
  542. package/schema/venture-role.schema.json +64 -0
  543. package/schema/venture-type.mjs +62 -0
  544. package/schema/venture-types.json +346 -0
  545. package/schema/venture-types.schema.json +129 -0
  546. package/schema/venture.schema.json +460 -0
  547. package/schema/vocab/business-models.json +298 -0
  548. package/schema/where-used.schema.json +56 -0
  549. package/schema/workspace.schema.json +38 -0
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env node
2
+ // The MCP server over the router (EE-030): stdio, newline-delimited JSON-RPC 2.0, no dependencies.
3
+ // Tools are the router's actions; resources are the route table and each venture's records.
4
+ // Every caller here is an agent: write never takes an actor, so a gated record (ownership, board,
5
+ // founder agreement, exit, telos, decision rights, publication policy) is always written as a
6
+ // draft for a person to accept. Nothing an agent sends through this server can approve itself.
7
+ //
8
+ // claude mcp add mentura -- node <repo>/interface/mcp/server.mjs
9
+ // MENTURA_WORKSPACE=<dir> sets the workspace; the default is this repository's instance/.
10
+
11
+ import { createInterface } from "node:readline";
12
+ import { call, routes, routesMd, ventureDir, ventures } from "../router.mjs";
13
+ import { runStreaming } from "../context.mjs";
14
+ import { propose } from "../../schema/decisions.mjs";
15
+
16
+ const PROTOCOL = "2025-06-18";
17
+ const venture = { type: "string", description: "The venture's id, or its folder path for a nested venture (see mentura_ventures)" };
18
+ const route = { type: "string", description: "A route from mentura_routes, such as purpose/validation/problem" };
19
+ export const TOOLS = [
20
+ { name: "mentura_routes", description: "The route table: every record and command a venture has, with its actions, decision classes and groups. A collection item is <route>/<id>, such as purpose/product/kettle.", inputSchema: { type: "object", properties: { group: { type: "string", description: "Only the routes need-now suggests in this phase: discovery, validation, beachhead, scale or platform" } } } },
21
+ { name: "mentura_layout", description: "The context for a route before you act on it: the system, layer and kit purpose, skills and references, the schema and template, the gate, and what need-now says about the record.", inputSchema: { type: "object", properties: { venture, route }, required: ["route"] } },
22
+ { name: "mentura_view", description: "A route as a Markdown page for a person. system/overview shows the venture at a glance.", inputSchema: { type: "object", properties: { venture, route }, required: ["venture", "route"] } },
23
+ { name: "mentura_ventures", description: "The ventures in the workspace, with their phase.", inputSchema: { type: "object", properties: {} } },
24
+ { name: "mentura_read", description: "Read one record of a venture, header first: the header (what it is, its state, owner and size in tokens), the budget, the layout (in a session, only the parts you have not seen), the template (need-now and open decisions, fresh), the record as result (null when the venture has no such record yet), and prefetch: short summaries of the routes you are likely to need next. Pass header_only to stop after the header. A list returns only the items your role may read.", inputSchema: { type: "object", properties: { venture, route,
25
+ session: { type: "string", description: "Your session id: the layout is sent once per session, then only the parts that changed" },
26
+ task: { type: "string", description: "What you are doing; a route it names is prefetched in full" },
27
+ prefetch: { description: "false turns prefetch off; a list of routes prefetches those in full", oneOf: [{ type: "boolean" }, { type: "array", items: { type: "string" } }] },
28
+ header_only: { type: "boolean", description: "Return only the header, to decide whether to read on" },
29
+ where: { type: "object", description: "For a list: keep only records whose fields match these values" },
30
+ agent_id: { type: "string", description: "Your role in the team plan, so its read routes apply" } }, required: ["venture", "route"] } },
31
+ { name: "mentura_write", description: "Write one record of a venture. The record must match its schema. A gated record is written as a draft under _drafts/ for a person to accept. Every write is logged in the venture's provenance log: say what the content came from and the decision it acts under.", inputSchema: { type: "object", properties: { venture, route, record: { type: "object", description: "The whole record" },
32
+ derived_from: { type: "array", items: { type: "string" }, description: "What the content came from: venture-relative paths, URLs or decision ids" },
33
+ decision: { type: "string", description: "The decision the write acts under, such as EE-026" },
34
+ model: { type: "string", description: "Your model, for the provenance log" }, note: { type: "string" },
35
+ agent_id: { type: "string", description: "Your role in the team plan, so its routes and unlocks apply" },
36
+ // Gate group hook (X-4): a score computed before the write; the gate's confidence rules read it and never compute one.
37
+ confidence: { type: "number", description: "Your confidence in this record, 0 to 1, if you computed one. Below the venture's threshold, a gate rule may send the write to its function owner" } }, required: ["venture", "route", "record"] } },
38
+ { name: "mentura_decisions", description: "The decisions a venture owes (EE-054): each with its parent, boundary, phase, due time and whether it renders now, is overdue, waits, comes later, is stale or deferred. Work on what renders now or overdue; a decision that waits is held by an open fail-closed decision above it. A route a pending decision unlocks is refused until a person decides it.", inputSchema: { type: "object", properties: { venture,
39
+ render: { type: "array", items: { type: "string" }, description: "Only these states, such as [\"overdue\", \"now\"]" } }, required: ["venture"] } },
40
+ { name: "mentura_propose_decision", description: "Propose a decision, or new wording for an open one. It stays open until a person approves it in the CLI (mentura decide); you can never mark a decision decided. Put it beside what it decides with at (a venture folder such as operations) and name (<record>[.<topic>]).", inputSchema: { type: "object", properties: { venture,
41
+ decision: { type: "object", description: "id, question, and optionally answer (your proposed wording), decides, layer, parent, needed_in, due, outcomes, unlocks, note, plus at and name for where it goes" },
42
+ agent_id: { type: "string", description: "Your role in the team plan" }, model: { type: "string" } }, required: ["venture", "decision"] } },
43
+ // Setup (EE-083, interface/skills/naive-setup): the questions that establish a new venture, in order, and an artifact of the progress.
44
+ { name: "mentura_setup", description: "Where a new venture's setup stands: its people and hats, the source of truth for each function, the foundation and first decisions (the docket), the goal for discovery, and which steps are done. artifact is that state as one self-contained HTML page: render it as an artifact where your harness has artifacts, and again after every answer. Ask the founder the next open question, one at a time, in order.", inputSchema: { type: "object", properties: { venture }, required: ["venture"] } },
45
+ { name: "mentura_setup_answer", description: "Write down the founder's answer to one setup question (a docket id from mentura_setup, or discovery-goal), exactly in their words. It is proposed with their words as its wording and stays open until the founder confirms it at the keyboard (naive setup confirm): you never decide for them.", inputSchema: { type: "object", properties: { venture,
46
+ id: { type: "string", description: "The question's id from mentura_setup's docket, or discovery-goal" },
47
+ answer: { type: "string", description: "The founder's answer, verbatim" },
48
+ agent_id: { type: "string", description: "Your role in the team plan" }, model: { type: "string" } }, required: ["venture", "id", "answer"] } },
49
+ { name: "mentura_setup_point", description: "Point one function of the venture at the system that holds its truth (from mentura_setup's catalog), as the founder said, such as finance at rho or products at github with address acme/app. Naive keeps a pointer, never a copy; Rho is synced at once.", inputSchema: { type: "object", properties: { venture,
50
+ function: { type: "string", description: "A function, such as products, finance or legal" },
51
+ system: { type: "string", description: "A system the catalog offers for that function" },
52
+ address: { type: "string", description: "Where in that system, such as acme/app" },
53
+ agent_id: { type: "string", description: "Your role in the team plan" } }, required: ["venture", "function", "system"] } },
54
+ // The decision library (schema/frames.mjs): a founder's problem matched to a frame, its premises judged, its decisions proposed.
55
+ { name: "mentura_frame", description: "When the founder states a problem in their own words (\"I need investors to scale but I don't want to give up control\"), match it to a frame in the decision library, judge the premises their sentence assumes against the venture's records, and propose the decisions hidden in it, open, with options. The result says which premises hold, whether the trade is false, real or a sequence, and the better question to ask. Never pick an option for the founder, and never name an instrument as the answer: options for how to do something come from a dated, cited lookup.", inputSchema: { type: "object", properties: { venture,
56
+ text: { type: "string", description: "The founder's words, verbatim" },
57
+ frame: { type: "string", description: "A frame id, when you already know it; otherwise the founder's words pick one" },
58
+ lookup: { type: "object", description: "Options a lookup found: { options: [{ option, source, as_of }] }; only dated, cited options within the frame's freshness are kept" },
59
+ agent_id: { type: "string", description: "Your role in the team plan" }, model: { type: "string" } } } },
60
+ { name: "mentura_check", description: "Run the checks for one record of a venture.", inputSchema: { type: "object", properties: { venture, route }, required: ["venture", "route"] } },
61
+ { name: "mentura_template", description: "The fill-in template for a record, where its kit has one.", inputSchema: { type: "object", properties: { route }, required: ["route"] } },
62
+ { name: "mentura_run", description: "Run a command route for a venture: system/need-now (what to work on now), system/time-to-ready, purpose/validation/assess (what the problem's evidence is strong enough for), governance/payouts, knowledge/catalog (index every source the venture keeps records in), knowledge/search (find items in any of them). A result with needs_input lists what is missing: ask the person whether to fill it in or run as is, and only then call again with as_is.", inputSchema: { type: "object", properties: { venture, route, value: { type: ["number", "string"], description: "governance/payouts: a sale value; knowledge/search: the query" },
63
+ as_is: { type: "boolean", description: "purpose/validation/assess: run even though the record is incomplete. Set it only after the person chose to run as is" },
64
+ agent_id: { type: "string", description: "Your role in the team plan" } }, required: ["venture", "route"] } },
65
+ ];
66
+
67
+ let client = null; // the harness, as it named itself at initialize
68
+
69
+ // notify sends a notification to the client; progress for a call that carries _meta.progressToken (N-5).
70
+ export async function handle(msg, notify = () => {}) {
71
+ const { id, method, params = {} } = msg;
72
+ const reply = (result) => ({ jsonrpc: "2.0", id, result });
73
+ const fail = (code, message) => ({ jsonrpc: "2.0", id, error: { code, message } });
74
+ switch (method) {
75
+ case "initialize":
76
+ client = params.clientInfo ? [params.clientInfo.name, params.clientInfo.version].filter(Boolean).join(" ") : null;
77
+ return reply({ protocolVersion: PROTOCOL, capabilities: { tools: {}, resources: {} }, serverInfo: { name: "mentura", version: "0.1.0" },
78
+ instructions: "Start with mentura_decisions to see which decisions are due and what is held, then mentura_run on system/need-now to see what a venture needs now, so you build only that. Read before you write. Gated records are drafts until a person accepts them." });
79
+ case "notifications/initialized": case "notifications/cancelled": return null;
80
+ case "ping": return reply({});
81
+ case "tools/list": return reply({ tools: TOOLS });
82
+ case "tools/call": {
83
+ const a = params.arguments ?? {};
84
+ const token = params._meta?.progressToken;
85
+ let step = 0;
86
+ const progress = token === undefined ? null : ({ progress: p, total, message }) => notify({ jsonrpc: "2.0", method: "notifications/progress", params: { progressToken: token, progress: Math.max(p ?? 0, ++step), ...(total ? { total } : {}), message } });
87
+ let r;
88
+ switch (params.name) {
89
+ case "mentura_routes": r = { ok: true, result: a.group ? routes().filter((x) => x.groups.includes(`(${a.group})`)) : routes() }; break;
90
+ case "mentura_ventures": r = { ok: true, result: ventures().map(({ id, name, phase, path }) => ({ id, name, phase, path })) }; break;
91
+ case "mentura_layout": r = await call({ venture: a.venture, route: a.route, action: "layout" }); break;
92
+ case "mentura_view": r = await call({ venture: a.venture, route: a.route, action: "view" }); break;
93
+ // Context hook (interface/context.mjs): a read is a navigation, header first, its parts streamed as progress.
94
+ // A filtered list (where) is a plain read (interface/writes.mjs); anything else is a navigation.
95
+ case "mentura_read": r = a.where ? await call({ venture: a.venture, route: a.route, action: "read", actor_id: a.agent_id, via: "mcp", input: { where: a.where } }) : await call({ venture: a.venture, route: a.route, action: "navigate", actor_id: a.agent_id, via: "mcp",
96
+ input: { session: a.session, task: a.task, prefetch: a.prefetch, header_only: a.header_only, ...(progress ? { onPart: ({ part, data }) => progress({ message: `${part}: ${JSON.stringify(data)}` }) } : {}) } }); break;
97
+ case "mentura_write": r = await call({ venture: a.venture, route: a.route, action: "write", input: a.record, actor: "agent", actor_id: a.agent_id, via: "mcp",
98
+ provenance: { derived_from: a.derived_from, decision: a.decision, note: a.note, confidence: a.confidence, agent: Object.fromEntries(Object.entries({ harness: client, model: a.model }).filter(([, v]) => v)) } }); break;
99
+ // Setup (EE-083): schema/setup.mjs holds the questions; answers are proposals the founder confirms.
100
+ case "mentura_setup": { const m = await import("../../schema/setup.mjs"); const dir = ventureDir(a.venture); r = { ok: true, result: { state: await m.state(dir), artifact: await m.artifact(dir) } }; break; }
101
+ case "mentura_setup_answer": r = await (await import("../../schema/setup.mjs")).relay(ventureDir(a.venture), { id: a.id, answer: a.answer, agentId: a.agent_id, harness: client, model: a.model }); break;
102
+ case "mentura_setup_point": r = await (await import("../../schema/setup.mjs")).point(ventureDir(a.venture), { fn: a.function, system: a.system, address: a.address, via: "mcp", actor: "agent", agentId: a.agent_id }); break;
103
+ case "mentura_frame": r = await (await import("../../schema/frames.mjs")).run(ventureDir(a.venture), { id: a.frame, text: a.text, lookup: a.lookup, agentId: a.agent_id ?? "frames", harness: client, model: a.model }); break;
104
+ case "mentura_decisions": {
105
+ r = await call({ venture: a.venture, route: "governance/decisions", action: "run", actor_id: a.agent_id });
106
+ if (r.ok && a.render?.length) r.result = { ...r.result, decisions: r.result.decisions.filter((d) => a.render.includes(d.render)) };
107
+ break;
108
+ }
109
+ case "mentura_propose_decision": {
110
+ const dir = ventureDir(a.venture);
111
+ r = dir ? propose(dir, a.decision, { agentId: a.agent_id, via: "mcp", harness: client, model: a.model }) : { ok: false, error: `no venture ${a.venture}` };
112
+ break;
113
+ }
114
+ case "mentura_check": r = await call({ venture: a.venture, route: a.route, action: "check" }); break;
115
+ case "mentura_template": r = await call({ route: a.route, action: "template" }); break;
116
+ case "mentura_run": r = progress && a.route !== "system/overview" && a.route !== "system/robots"
117
+ ? await runStreaming({ venture: a.venture, route: a.route, input: { value: a.value, as_is: a.as_is }, actor_id: a.agent_id }, progress)
118
+ : await call({ venture: a.venture, route: a.route, action: "run", actor_id: a.agent_id, input: a.value !== undefined || a.as_is ? { ...(a.value !== undefined ? { value: a.value } : {}), ...(a.as_is ? { as_is: true } : {}) } : undefined }); break;
119
+ default: return fail(-32602, `unknown tool ${params.name}`);
120
+ }
121
+ if (r.ok && r.needs_input) return reply({ content: [{ type: "text", text: `Ask the person before running. ${r.needs_input.ask}\n${JSON.stringify(r.needs_input, null, 2)}` }], isError: false });
122
+ const extra = ["not_found", "pending_draft", "fix", "deprecated"].some((k) => r[k]);
123
+ const text = r.ok ? (typeof r.result === "string" && !extra ? r.result : JSON.stringify(extra ? r : r.result, null, 2)) : JSON.stringify({ error: r.error, ...(r.fix ? { fix: r.fix } : {}), ...(r.result ? { result: r.result } : {}) }, null, 2);
124
+ return reply({ content: [{ type: "text", text }], isError: !r.ok });
125
+ }
126
+ case "resources/list":
127
+ return reply({ resources: [
128
+ { uri: "mentura://routes", name: "Route table", mimeType: "text/markdown" },
129
+ ...ventures().map((v) => ({ uri: `mentura://${v.id}`, name: `${v.id}: overview`, mimeType: "text/markdown" })),
130
+ ...ventures().flatMap((v) => routes().filter((x) => x.kind === "record" && !x.route.endsWith("[id]")).map((x) => ({ uri: `mentura://${v.id}/${x.route}`, name: `${v.id}: ${x.route}`, mimeType: "application/json" }))),
131
+ ] });
132
+ case "resources/read": {
133
+ const uri = params.uri ?? "";
134
+ if (uri === "mentura://routes") return reply({ contents: [{ uri, mimeType: "text/markdown", text: routesMd() }] });
135
+ const o = uri.match(/^mentura:\/\/([^/]+)$/);
136
+ if (o) { const r = await call({ venture: o[1], route: "system/overview", action: "view" }); return r.ok ? reply({ contents: [{ uri, mimeType: "text/markdown", text: r.result }] }) : fail(-32602, r.error); }
137
+ const m = uri.match(/^mentura:\/\/([^/]+)\/(.+)$/);
138
+ if (!m) return fail(-32602, `unknown resource ${uri}`);
139
+ const r = await call({ venture: m[1], route: m[2], action: "read" });
140
+ if (!r.ok) return fail(-32602, r.error);
141
+ return reply({ contents: [{ uri, mimeType: "application/json", text: JSON.stringify(r.result, null, 2) }] });
142
+ }
143
+ default:
144
+ return id === undefined ? null : fail(-32601, `method not found: ${method}`);
145
+ }
146
+ }
147
+
148
+ if (import.meta.url === `file://${process.argv[1]}`) {
149
+ const rl = createInterface({ input: process.stdin });
150
+ // Answers go out in the order requests came in: each line waits for the one before.
151
+ let queue = Promise.resolve();
152
+ rl.on("line", (line) => {
153
+ if (!line.trim()) return;
154
+ queue = queue.then(async () => {
155
+ let msg;
156
+ try { msg = JSON.parse(line); } catch { process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "parse error" } }) + "\n"); return; }
157
+ let res;
158
+ try { res = await handle(msg, (n) => process.stdout.write(JSON.stringify(n) + "\n")); } catch (e) { res = { jsonrpc: "2.0", id: msg.id ?? null, error: { code: -32603, message: String(e.message ?? e) } }; }
159
+ if (res) process.stdout.write(JSON.stringify(res) + "\n");
160
+ });
161
+ });
162
+ }
@@ -0,0 +1,58 @@
1
+ ---
2
+ type: entity-readme
3
+ ai-model: claude
4
+ entity-name: operator-console
5
+ companion-to: "[[project-view-mockup-2026-05-14.html]]"
6
+ source: hybrid
7
+ created: 2026-05-14
8
+ last-reviewed: 2026-05-14
9
+ authorship: hybrid
10
+ authors: [the author, Claude]
11
+ ip-sensitivity: normal
12
+ scope: global
13
+ scope-entity: "[[everything-ecosystem]]"
14
+ tags: [operator-console, methodology-product, orchestration-software, mockup, html-companion, 2026-05-14]
15
+ ---
16
+
17
+ # `operator-console/` — The Operator Console
18
+
19
+ *Renamed from `harness/` on 2026-10-26 (G-029): "harness" now means only the entity class for a first-party interface over a product.*
20
+
21
+ > Working folder for the operator console — the operational software layered on top of the SAD methodology. Per §39, the trajectory is HTML now → real software later. The first mockup is **[[project-view-mockup-2026-05-14.html]]**. Open it in a browser.
22
+
23
+ ## What this is
24
+
25
+ The operator console is the methodology's operational consumer surface. It's the dashboard a solo operator (or eventually a multi-person team) lives in when managing projects under the methodology. Distinct from:
26
+
27
+ - **The methodology itself** ([[pipeline-canonical-view-2026-05-14]]) — the abstract framework
28
+ - **The methodology website** (separate concern; for publishing + teaching + onboarding to the public)
29
+ - **Per-entity orchestration HTML** ([[per-entity-orchestration-template]]) — the static, vault-embedded version of similar information
30
+
31
+ The operator console is a polished SaaS-style application that surfaces project state, agent activity, and methodology mechanisms (skills, commands, hooks) for the operator.
32
+
33
+ ## Current state
34
+
35
+ - **[[project-view-mockup-2026-05-14.html]]** — high-fidelity static mockup of the project-level view (the reference project as the demonstrative project)
36
+ - Topbar with project switcher; left sidebar with project + operations + methodology nav groups; main area showing three-pillar prominence + agent system panel + recent decisions + quick action cards
37
+
38
+ ## Trajectory
39
+
40
+ Per §39 orchestration trajectory:
41
+
42
+ - **Now:** static HTML mockup for design iteration
43
+ - **Next:** real web app (Next.js + Postgres likely), bespoke for the owner's solo use initially
44
+ - **Later:** multi-person team support (auth, real-time collaboration, role-based access)
45
+ - **Eventually:** publicly available methodology product (when the methodology generalizes beyond the reference project)
46
+
47
+ Paused as of 2026-05-14 to return to the reference project work. Will resume after V1.5 articulation has more shape.
48
+
49
+ ## Related
50
+
51
+ - [[pipeline-canonical-view-2026-05-14]] — the methodology the operator console operationalizes
52
+ - [[per-entity-orchestration-template]] — vault-embedded parallel artifact (less polished, more comprehensive)
53
+ - A project note — the orchestration HTML instance the operator console mockup demonstrates against
54
+ - [[build-roadmap-and-html-orchestration-2026-05-12]] §32 + §39 — methodology amendments establishing the operator console concept
55
+
56
+ ## Status
57
+
58
+ - **2026-05-14:** Initial mockup authored; paused to return to the reference project V1.5 work.
@@ -0,0 +1,196 @@
1
+ // Package routes, route groups and slot defaults (Next.js translation L-6, P-17, P-36, P-37, and the
2
+ // venture route for P-3). The router reaches these when a route is not in the route table, so the
3
+ // table, generated from the data model, stays as it is.
4
+ //
5
+ // <package> a package's own route (validation, foundation, marketing; packages/<name> works
6
+ // for every package, even one whose name is also a record route such as product).
7
+ // read returns its records and their state: progress, what moves now, what waits,
8
+ // and the drafts pending in it (its loading state, P-37). check runs its boundary
9
+ // (E-5). view is the same as a page. layout is its group's and its own context.
10
+ // (<group>) a route group (P-36): packages that share a layout, so they share context. The
11
+ // framework defines (go-to-market) for marketing, relationships and customers; a
12
+ // venture adds or changes groups in naive.config.json "groups", and may keep the
13
+ // group's own AGENTS.md in a (<group>)/ folder at its root. Only the packages in a
14
+ // group get its layout: the layout is opt-in.
15
+ // venture the venture's own route: read is the manifest venture.json declares (P-3), check
16
+ // runs every boundary (E-5).
17
+ // @packages the system/overview slot: each package in use, and for a package with nothing in
18
+ // it, its default: what to write first and where to start (P-17).
19
+
20
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
21
+ import { join } from "node:path";
22
+
23
+ const repo = new URL("..", import.meta.url).pathname;
24
+ const load = (f) => JSON.parse(readFileSync(f, "utf8"));
25
+
26
+ /** The framework's route groups (P-36). A venture's naive.config.json "groups" adds to or replaces these. */
27
+ export const GROUPS = {
28
+ "go-to-market": { packages: ["marketing", "relationships", "customers"], context: "Who the venture sells to and how it reaches them. Marketing and sales share the ICP, the offer and the accounts, so they share one layout." },
29
+ };
30
+
31
+ export const packageNames = () => existsSync(join(repo, "packages")) ? readdirSync(join(repo, "packages")).filter((n) => existsSync(join(repo, "packages", n, "package.json"))) : [];
32
+ export const packageDef = (n) => load(join(repo, "packages", n, "package.json"));
33
+
34
+ /** The venture's route groups: the framework's, then its own from naive.config.json. */
35
+ export function groupsOf(dir) {
36
+ const f = dir && join(dir, "naive.config.json");
37
+ const own = f && existsSync(f) ? load(f).groups ?? {} : {};
38
+ return { ...GROUPS, ...own };
39
+ }
40
+
41
+ /** The package a record type lives in: its core home first, else the data or folder package that declares it. */
42
+ export function packageOfRecord(type) {
43
+ if (!type) return null;
44
+ const names = packageNames();
45
+ const core = names.find((n) => { const p = packageDef(n); return p.kind === "core" && [...(p.required ?? []), ...(p.optional ?? [])].includes(type); });
46
+ if (core) return core;
47
+ return names.find((n) => { const p = packageDef(n); return p.kind !== "handoff" && (p.records ?? []).includes(type); }) ?? null;
48
+ }
49
+
50
+ /** The group layout a package gets (P-36), or null when it is in no group. */
51
+ export function groupLayout(pkg, dir) {
52
+ const gs = groupsOf(dir);
53
+ const id = Object.keys(gs).find((g) => (gs[g].packages ?? []).includes(pkg));
54
+ if (!id) return null;
55
+ const g = gs[id];
56
+ const agents = dir && existsSync(join(dir, `(${id})`, "AGENTS.md")) ? `(${id})/AGENTS.md` : null;
57
+ const shares = [...new Set(g.packages.filter((n) => packageNames().includes(n)).flatMap((n) => packageDef(n).refs ?? []))];
58
+ return { group: `(${id})`, packages: g.packages, context: g.context ?? null, shares, agents };
59
+ }
60
+
61
+ /** Which special route a name is: a package, a group or the venture. */
62
+ export function special(route) {
63
+ if (route === "venture") return { kind: "venture" };
64
+ const g = route.match(/^\(([a-z0-9-]+)\)$/);
65
+ if (g) return { kind: "group", id: g[1] };
66
+ const name = route.startsWith("packages/") ? route.slice("packages/".length) : route;
67
+ return packageNames().includes(name) ? { kind: "package", name } : null;
68
+ }
69
+
70
+ /** The route of a record type: its item or single route, else its list route. */
71
+ export const routeOfType = async (type) => {
72
+ const { routes } = await import("./router.mjs");
73
+ const rs = routes().filter((r) => r.record === type);
74
+ return (rs.find((r) => r.collection !== "list") ?? rs[0])?.route ?? null;
75
+ };
76
+
77
+ // The drafts waiting in a package's records (P-37): its pending state.
78
+ async function pendingIn(dir, types, venture) {
79
+ const { recordOf } = await import("../schema/decisions.mjs");
80
+ const { entries } = await import("./provenance.mjs");
81
+ const d = join(dir, "_drafts");
82
+ if (!existsSync(d)) return [];
83
+ const log = entries(dir);
84
+ const out = [];
85
+ for (const f of readdirSync(d).filter((x) => x.endsWith(".draft"))) {
86
+ const file = f.slice(0, -".draft".length).replace(/__/g, "/");
87
+ const type = recordOf(file);
88
+ if (!types.includes(type)) continue;
89
+ const route = await routeOfType(type);
90
+ const id = route?.endsWith("[id]") ? file.split("/").at(-1).replace(/\.json$/, "") : null;
91
+ const concrete = id ? route.replace("[id]", id) : route;
92
+ out.push({ record: type, route: concrete, draft: `_drafts/${f}`, since: log.filter((e) => e.entity === `_drafts/${f}`).at(-1)?.at ?? null, accept: `mentura accept ${concrete} --venture ${venture}` });
93
+ }
94
+ return out;
95
+ }
96
+
97
+ /** A package's own route read (L-6, P-37): its records and their state, what moves now, what waits, what is pending. */
98
+ export async function packageState(dir, name, venture) {
99
+ const def = packageDef(name);
100
+ const { packages } = await import("../schema/packages.mjs");
101
+ const all = packages(dir);
102
+ const p = [...all.core, ...all.handoff].find((x) => x.id === name);
103
+ if (p?.kind === "core") {
104
+ const records = await Promise.all(p.records.map(async (r) => ({ record: r.record, title: r.title, role: r.role, route: await routeOfType(r.record), status: r.status, moves: r.moves, ...(r.waits_on ? { waits_on: r.waits_on } : {}), files: r.files })));
105
+ const pending = await pendingIn(dir, p.records.filter((r) => r.role !== "reads").map((r) => r.record), venture);
106
+ return { package: name, kind: "core", title: p.title, purpose: p.purpose, function: def.function ?? def.department ?? null, fit: p.fit, in: p.in, state: p.state, progress: p.progress,
107
+ records, moves_now: records.filter((r) => r.moves === "now" && r.role !== "reads").map((r) => r.route), waits: records.filter((r) => r.moves === "waits").map((r) => ({ route: r.route, on: r.waits_on })),
108
+ loading: pending.length ? { drafts: pending, note: `${pending.length} draft${pending.length > 1 ? "s" : ""} waiting for a person to accept` } : null, unlocks: p.unlocks, missing: p.missing, to_review: p.to_review };
109
+ }
110
+ if (p?.kind === "handoff") return { package: name, kind: "handoff", title: p.title, for: p.for, from: p.from, fit: p.fit, in: p.in, state: p.state, progress: p.progress, waits_on: p.waits_on, unlocks: p.unlocks, loading: null };
111
+ // Data, folder and raw packages: never complete; their state is what they hold.
112
+ const { routes, glob } = await import("./router.mjs");
113
+ const { files } = await import("./router.mjs");
114
+ const here = files(dir);
115
+ const records = await Promise.all((def.records ?? []).map(async (t) => {
116
+ const r = routes().find((x) => x.record === t);
117
+ const held = r ? here.filter((f) => r.files.some((g) => glob(g).test(f))) : [];
118
+ return { record: t, route: await routeOfType(t), items: held.length, files: held };
119
+ }));
120
+ const pending = await pendingIn(dir, def.records ?? [], venture);
121
+ return { package: name, kind: def.kind, title: def.title, purpose: def.purpose, state: records.some((r) => r.items) ? "holding" : "empty", records, gates: def.gates ?? [],
122
+ loading: pending.length ? { drafts: pending, note: `${pending.length} draft${pending.length > 1 ? "s" : ""} waiting for a person to accept` } : null };
123
+ }
124
+
125
+ /** The overview's @packages slot (P-17): each package in use, and the default a package with nothing in it shows. */
126
+ export async function packageSlots(dir, venture) {
127
+ const { manifest } = await import("../schema/structure.mjs");
128
+ const m = await manifest(dir);
129
+ const out = [];
130
+ for (const { name, known } of m.packages.list) {
131
+ if (!known) { out.push({ package: name, shows: "not a Naive package: check venture.json packages" }); continue; }
132
+ const s = await packageState(dir, name, venture);
133
+ const empty = s.kind === "core" ? s.records.filter((r) => r.role !== "reads").every((r) => r.status === "missing") : s.kind === "handoff" ? false : s.state === "empty";
134
+ if (!empty) { out.push({ package: name, title: s.title, state: s.state, progress: s.progress ?? null, moving: (s.moves_now ?? []).join(", ") || "none" }); continue; }
135
+ // The default: nothing written yet, and where to start.
136
+ const first = s.kind === "core" ? s.records.find((r) => r.role === "required" && r.moves === "now") ?? s.records.find((r) => r.role !== "reads") : s.records[0];
137
+ const route = first?.route ?? null;
138
+ const concrete = route?.endsWith("[id]") ? route.replace("[id]", "<id>") : route;
139
+ const { routes } = await import("./router.mjs");
140
+ const acts = routes().find((x) => x.route === route)?.actions ?? [];
141
+ const write = acts.includes("write") ? `mentura ${concrete} write --venture ${venture} --input <file>` : null;
142
+ const start = !concrete ? null : acts.includes("template") ? `mentura ${concrete} template${write ? `, then ${write}` : ""}` : write ?? `mentura ${concrete} layout --venture ${venture}`;
143
+ out.push({ package: name, title: s.title, default: true, shows: `${s.title}: nothing written yet`, start });
144
+ }
145
+ return out;
146
+ }
147
+
148
+ const pageOf = (s) => {
149
+ const lines = [`# ${s.title ?? s.package}`, "", s.purpose ?? "", ""];
150
+ if (s.state) lines.push(`State: ${s.state}${s.progress != null ? ` (${Math.round(s.progress * 100)}%)` : ""}.`, "");
151
+ if (s.loading) lines.push(`> ${s.loading.note}: ${s.loading.drafts.map((d) => `\`${d.accept}\``).join(", ")}`, "");
152
+ if (s.records?.length) {
153
+ const cols = s.kind === "core" ? ["route", "role", "status", "moves"] : ["route", "items"];
154
+ lines.push(`| ${cols.join(" | ")} |`, `| ${cols.map(() => "---").join(" | ")} |`, ...s.records.map((r) => `| ${cols.map((c) => String(r[c] ?? "")).join(" | ")} |`), "");
155
+ }
156
+ return lines.join("\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
157
+ };
158
+
159
+ /** Answers a call to a package, group or venture route; null when the route is none of them. */
160
+ export async function specialCall({ venture, route, action, workspace }) {
161
+ const sp = special(route);
162
+ if (!sp) return null;
163
+ const { ventureDir } = await import("./router.mjs");
164
+ const actions = sp.kind === "group" ? ["read", "view", "layout"] : ["read", "view", "check", "layout"];
165
+ if (!actions.includes(action)) return { ok: false, error: `${route} has no action ${action} (it has ${actions.join(", ")})` };
166
+ const dir = venture ? ventureDir(venture, workspace) : null;
167
+ if (!dir && !(action === "layout" && sp.kind !== "venture")) return { ok: false, error: `no venture ${venture}` };
168
+ if (sp.kind === "venture") {
169
+ const { manifest } = await import("../schema/structure.mjs");
170
+ const { boundaries } = await import("./boundaries.mjs");
171
+ if (action === "check") { const b = await boundaries(dir); return { ok: b.ok, result: b }; }
172
+ const m = await manifest(dir);
173
+ if (action === "view") return { ok: true, result: `# ${m.identity.name}\n\nPhase: ${m.phase}. Packages: ${m.packages.list.map((p) => p.name).join(", ")}.\n\n| Function | Owner | Packages |\n| --- | --- | --- |\n${m.functions.map((f) => `| ${f.function} | ${f.owner ?? "nobody yet"} | ${f.packages.join(", ")} |`).join("\n")}\n` };
174
+ if (action === "layout") return { ok: true, result: { route: "venture", manifest: m } };
175
+ return { ok: true, result: m };
176
+ }
177
+ if (sp.kind === "group") {
178
+ const gs = groupsOf(dir);
179
+ const g = gs[sp.id];
180
+ if (!g) return { ok: false, error: `no route group (${sp.id}): the groups are ${Object.keys(gs).map((x) => `(${x})`).join(", ")}` };
181
+ const lay = groupLayout(g.packages[0], dir);
182
+ if (action === "layout" || !dir) return { ok: true, result: { ...lay, chain: lay.agents && dir ? [{ path: lay.agents, text: readFileSync(join(dir, lay.agents), "utf8") }] : [] } };
183
+ const states = [];
184
+ for (const n of g.packages.filter((x) => packageNames().includes(x))) states.push(await packageState(dir, n, venture));
185
+ const res = { group: `(${sp.id})`, context: g.context ?? null, packages: states.map((s) => ({ package: s.package, state: s.state, progress: s.progress ?? null, pending: s.loading?.drafts.length ?? 0 })) };
186
+ return { ok: true, result: action === "view" ? `# (${sp.id})\n\n${res.context ?? ""}\n\n${res.packages.map((p) => `- ${p.package}: ${p.state}${p.progress != null ? ` (${Math.round(p.progress * 100)}%)` : ""}${p.pending ? `, ${p.pending} pending` : ""}`).join("\n")}\n` : res };
187
+ }
188
+ const name = sp.name;
189
+ if (action === "layout") {
190
+ const def = packageDef(name);
191
+ return { ok: true, result: { route: name, package: { name, title: def.title, purpose: def.purpose, function: def.function ?? def.department ?? null, skill: def.skill?.path ?? null, gates: def.gates ?? [] }, group: groupLayout(name, dir) } };
192
+ }
193
+ if (action === "check") { const { boundaries } = await import("./boundaries.mjs"); const b = await boundaries(dir, { only: [name] }); return { ok: b.packages.every((p) => p.ok), result: b.packages[0] ?? { package: name, ok: true, note: "not in use by this venture" } }; }
194
+ const s = await packageState(dir, name, venture);
195
+ return action === "view" ? { ok: true, result: pageOf(s) } : { ok: true, result: s, ...(s.loading ? { pending_drafts: s.loading.drafts } : {}) };
196
+ }
@@ -0,0 +1,65 @@
1
+ // The provenance log (EE-031): one append-only JSON line per write, after W3C PROV (entity,
2
+ // activity, agent, derived from). Each line carries the previous line's hash, so an edited or
3
+ // deleted line breaks the chain. Lives at <venture>/provenance.jsonl, in the system layer, so it
4
+ // is on whatever layers a venture uses. Git history stays the implicit provenance for anything
5
+ // written outside the router.
6
+
7
+ import { createHash } from "node:crypto";
8
+ import { spawnSync } from "node:child_process";
9
+ import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ import { emit } from "./instrumentation.mjs";
12
+
13
+ export const LOG = "provenance.jsonl";
14
+ const sha = (s) => createHash("sha256").update(s).digest("hex");
15
+ const sorted = (x) => Array.isArray(x) ? x.map(sorted) : x && typeof x === "object" ? Object.fromEntries(Object.keys(x).sort().map((k) => [k, sorted(x[k])])) : x;
16
+ export const lineHash = (prev, entry) => { const { hash, ...rest } = entry; return sha(prev + JSON.stringify(sorted(rest))); };
17
+ export const contentHash = (file) => sha(readFileSync(file));
18
+
19
+ export function entries(dir) {
20
+ const f = join(dir, LOG);
21
+ return existsSync(f) ? readFileSync(f, "utf8").split("\n").filter((l) => l.trim()).map((l) => JSON.parse(l)) : [];
22
+ }
23
+
24
+ /** The agent behind this process: MENTURA_ACTOR (person or agent), MENTURA_ACTOR_ID, MENTURA_MODEL, MENTURA_SESSION, MENTURA_HARNESS. */
25
+ export function agentFromEnv(kind, via, extra = {}) {
26
+ const e = process.env;
27
+ const a = { kind, via, id: e.MENTURA_ACTOR_ID, model: kind === "agent" ? e.MENTURA_MODEL : undefined, session: e.MENTURA_SESSION, harness: e.MENTURA_HARNESS, ...extra };
28
+ return Object.fromEntries(Object.entries(a).filter(([, v]) => v));
29
+ }
30
+
31
+ /**
32
+ * Appends one entry for a file just written: a path relative to the venture folder, or, for a
33
+ * record in another source (EE-037), its address (<source>://<path>) with the content's sha256
34
+ * and the source's version, commit and pull request.
35
+ */
36
+ export function record(dir, { entity, route, activity, agent, derived_from, decision, note, sha256, source, statement }) {
37
+ const prior = entries(dir);
38
+ const prev = prior.length ? prior.at(-1).hash : "genesis";
39
+ const entry = Object.fromEntries(Object.entries({ at: new Date().toISOString(), entity, route, activity, agent,
40
+ derived_from: derived_from?.length ? derived_from : undefined, decision, note, source, statement, sha256: sha256 ?? contentHash(join(dir, entity)), prev }).filter(([, v]) => v !== undefined));
41
+ entry.hash = lineHash(prev, entry);
42
+ appendFileSync(join(dir, LOG), JSON.stringify(entry) + "\n");
43
+ // Context hook: every provenance entry (write, draft, accept, confirm, decision) is an instrumentation event (P-4).
44
+ emit(dir, { kind: "provenance", activity: entry.activity, entity: entry.entity, route: entry.route, decision: entry.decision, by: entry.agent?.kind, via: entry.agent?.via });
45
+ fireTriggers(dir);
46
+ return entry;
47
+ }
48
+
49
+ // Triggers hook (M-12, E-7): every entry is an event. A venture whose naive.config.json has triggers or
50
+ // kits runs them (schema/triggers.mjs) in a separate process after the write; the runs themselves do
51
+ // not fire this again. A crash of that process is kept for the next run to raise, never lost.
52
+ function fireTriggers(dir) {
53
+ if (process.env.NAIVE_TRIGGERS_ACTIVE) return;
54
+ let cfg;
55
+ try { cfg = JSON.parse(readFileSync(join(dir, "naive.config.json"), "utf8")); } catch { return; }
56
+ if (!cfg?.triggers?.length && !cfg?.kits?.length) return;
57
+ // The write has landed; nothing here may undo it or throw past it.
58
+ try {
59
+ const p = spawnSync(process.execPath, [new URL("../schema/triggers.mjs", import.meta.url).pathname, dir, "--fire", "--quiet"], { encoding: "utf8", env: { ...process.env, NAIVE_TRIGGERS_ACTIVE: "hook" } });
60
+ if (p.status !== 0) {
61
+ mkdirSync(join(dir, ".naive"), { recursive: true });
62
+ appendFileSync(join(dir, ".naive/trigger-errors.jsonl"), JSON.stringify({ at: new Date().toISOString(), status: p.status, error: (p.stderr || p.stdout || String(p.error ?? "")).trim().slice(-2000) }) + "\n");
63
+ }
64
+ } catch (e) { console.error(`triggers did not run after this write: ${e.message}`); }
65
+ }