sinapse-ai 1.15.0 → 1.17.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 (39) hide show
  1. package/.claude/hooks/doc-first-gate.cjs +156 -0
  2. package/.claude/hooks/enforce-story-gate.cjs +6 -2
  3. package/.claude/rules/hook-governance.md +1 -0
  4. package/.sinapse-ai/constitution.md +1 -1
  5. package/.sinapse-ai/core/atlas/atlas-data.js +278 -0
  6. package/.sinapse-ai/core/atlas/flows-pt.js +253 -0
  7. package/.sinapse-ai/core/atlas/flows.js +266 -0
  8. package/.sinapse-ai/core/atlas/index.js +62 -0
  9. package/.sinapse-ai/core/atlas/render-html.js +216 -0
  10. package/.sinapse-ai/core/atlas/render-markdown.js +313 -0
  11. package/.sinapse-ai/core/atlas/render-research-card.js +164 -0
  12. package/.sinapse-ai/core/orchestration/build-command.js +136 -0
  13. package/.sinapse-ai/core/orchestration/doc-first-resolver.js +322 -0
  14. package/.sinapse-ai/core/orchestration/route-command.js +97 -0
  15. package/.sinapse-ai/data/entity-registry.yaml +113 -16
  16. package/.sinapse-ai/development/agents/snps-orqx.md +9 -0
  17. package/.sinapse-ai/development/tasks/create-doc.md +1 -1
  18. package/.sinapse-ai/development/tasks/create-next-story.md +2 -3
  19. package/.sinapse-ai/development/tasks/spec-analyze.md +460 -0
  20. package/.sinapse-ai/development/tasks/spec-clarify.md +374 -0
  21. package/.sinapse-ai/development/tasks/spec-gather-requirements.md +11 -0
  22. package/.sinapse-ai/development/templates/approval-table.md +106 -0
  23. package/.sinapse-ai/development/workflows/spec-pipeline.yaml +122 -7
  24. package/.sinapse-ai/install-manifest.yaml +70 -18
  25. package/.sinapse-ai/product/templates/prd-tmpl.yaml +6 -2
  26. package/.sinapse-ai/product/templates/spec-tmpl.md +18 -0
  27. package/AGENTS.md +1 -1
  28. package/CHANGELOG.md +18 -3
  29. package/bin/sinapse.js +121 -0
  30. package/docs/framework/atlas/OPERATING-ATLAS.md +537 -0
  31. package/docs/framework/atlas/README.md +34 -0
  32. package/docs/framework/atlas/atlas-data.json +2810 -0
  33. package/docs/framework/atlas/atlas.html +392 -0
  34. package/package.json +1 -1
  35. package/packages/installer/src/wizard/ide-config-generator.js +6 -0
  36. package/scripts/install-chrome-brain.sh +2 -2
  37. package/scripts/validate-no-personal-leaks.js +24 -9
  38. package/squads/squad-copy/knowledge-base/consequence-headline-patterns.md +2 -2
  39. package/docs/guides/hooks-two-layers.md +0 -66
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Route Command — read-only doc-first routing observability.
3
+ *
4
+ * Renders the deterministic routing decision for a briefing: project type →
5
+ * workflow → required upstream docs (exist/missing) → doc-first gate verdict.
6
+ *
7
+ * Intentionally lightweight: requires ONLY `doc-first-resolver` (fs + constants)
8
+ * and chalk. It does NOT pull the heavy orchestration index, so it has no side
9
+ * effects and no agent spawning.
10
+ *
11
+ * NOTE: a machine-readable `--json` mode was intentionally deferred — the
12
+ * framework emits an activation/cleanup summary to stdout on process exit
13
+ * (the same trailing line seen on `sinapse orchestrate`), which would corrupt
14
+ * strict JSON output. Programmatic consumers should require `doc-first-resolver`
15
+ * directly (clean, no side effects) instead of parsing this command's stdout.
16
+ *
17
+ * @module core/orchestration/route-command
18
+ * @version 1.0.0
19
+ */
20
+
21
+ 'use strict';
22
+
23
+ const { resolveDocFirstState } = require('./doc-first-resolver');
24
+
25
+ let chalk;
26
+ try {
27
+ chalk = require('chalk');
28
+ } catch {
29
+ const id = (s) => s;
30
+ chalk = {
31
+ green: id, red: id, yellow: id, cyan: Object.assign(id, { bold: id }),
32
+ gray: id, bold: id, dim: id,
33
+ };
34
+ }
35
+
36
+ /**
37
+ * Execute the `route` command.
38
+ *
39
+ * @param {string} brief - User briefing (e.g. "criar um site pra X")
40
+ * @param {Object} [options]
41
+ * @param {string} [options.projectRoot] - Project root path
42
+ * @param {string} [options.type] - Explicit project_type override
43
+ * @returns {Promise<{success:boolean, exitCode:number, state:Object}>}
44
+ */
45
+ async function route(brief, options = {}) {
46
+ const projectRoot = options.projectRoot || process.cwd();
47
+ const state = resolveDocFirstState({ projectRoot, brief, projectType: options.type });
48
+
49
+ const ok = (b) => (b ? chalk.green('✓') : chalk.red('✗'));
50
+ const briefLabel = brief ? `"${brief}"` : '(no brief — using project state only)';
51
+
52
+ console.log(chalk.cyan('\n═══════════════════════════════════════════════════════════'));
53
+ console.log(chalk.cyan.bold(' 🧭 SINAPSE Doc-First Routing'));
54
+ console.log(chalk.cyan('═══════════════════════════════════════════════════════════\n'));
55
+
56
+ console.log(`Brief: ${chalk.gray(briefLabel)}`);
57
+ console.log(
58
+ `Project type: ${chalk.bold(state.projectType)}` +
59
+ (state.classified ? '' : chalk.gray(' (default — not matched from brief)')),
60
+ );
61
+ console.log(`Workflow: ${chalk.bold(state.workflow || 'SDC (no upstream re-doc)')}\n`);
62
+
63
+ if (state.artifacts.length) {
64
+ console.log(chalk.bold('Required upstream documents:'));
65
+ console.log(chalk.gray(' ┌──────────────────┬────────────────────────────────────┬────────┐'));
66
+ console.log(chalk.gray(' │ Document │ Path │ Status │'));
67
+ console.log(chalk.gray(' ├──────────────────┼────────────────────────────────────┼────────┤'));
68
+ for (const a of state.artifacts) {
69
+ console.log(` │ ${a.id.padEnd(16)} │ ${a.path.padEnd(34)} │ ${ok(a.exists)} │`);
70
+ }
71
+ console.log(chalk.gray(' └──────────────────┴────────────────────────────────────┴────────┘\n'));
72
+ }
73
+
74
+ console.log(chalk.bold('Doc-first gate (required before code):'));
75
+ if (state.isLightType) {
76
+ console.log(chalk.gray(' (light task — rides on existing project; only a Ready story is required)'));
77
+ console.log(` ${ok(state.gate.readyStory)} Story (status >= Ready)`);
78
+ } else {
79
+ console.log(` ${ok(state.gate.prd)} PRD ${chalk.gray('docs/prd.md')}`);
80
+ console.log(` ${ok(state.gate.epic)} Epic ${chalk.gray('docs/epics/')}`);
81
+ console.log(` ${ok(state.gate.readyStory)} Story (Ready) ${chalk.gray('docs/stories/')}`);
82
+ }
83
+
84
+ console.log('');
85
+ if (state.gate.satisfied) {
86
+ console.log(chalk.green.bold(' ✅ GATE SATISFIED — implementation may proceed.\n'));
87
+ } else {
88
+ console.log(chalk.red.bold(' 🚫 GATE BLOCKED — missing: ' + state.gate.missing.join(', ')));
89
+ console.log(
90
+ chalk.gray(` Run the ${state.workflow || 'SDC'} flow to produce these before any code.\n`),
91
+ );
92
+ }
93
+
94
+ return { success: true, exitCode: 0, state };
95
+ }
96
+
97
+ module.exports = { route };
@@ -1,7 +1,7 @@
1
1
  metadata:
2
2
  version: 1.0.0
3
- lastUpdated: '2026-06-24T13:49:06.535Z'
4
- entityCount: 792
3
+ lastUpdated: '2026-06-25T14:57:04.344Z'
4
+ entityCount: 796
5
5
  checksumAlgorithm: sha256
6
6
  resolutionRate: 100
7
7
  entities:
@@ -650,6 +650,7 @@ entities:
650
650
  - chrome-brain-installer
651
651
  - cli
652
652
  - component-generator
653
+ - route-command
653
654
  externalDeps: []
654
655
  plannedDeps:
655
656
  - logger
@@ -660,8 +661,8 @@ entities:
660
661
  score: 0.7
661
662
  constraints: []
662
663
  extensionPoints: []
663
- checksum: sha256:01cae0d9971b1acaec7e62025570cc5a629fe60e91d226fde6818bf359913c78
664
- lastVerified: '2026-06-21T05:24:05.627Z'
664
+ checksum: sha256:5ee1c859ceedbbaa2cea1463677462985f1ce9472963d4b51589bdbfc5302395
665
+ lastVerified: '2026-06-25T14:57:04.173Z'
665
666
  collab-start:
666
667
  path: bin/utils/collab-start.js
667
668
  layer: L1
@@ -1927,8 +1928,8 @@ entities:
1927
1928
  score: 0.8
1928
1929
  constraints: []
1929
1930
  extensionPoints: []
1930
- checksum: sha256:86d38d0a9872d7e1e57edb2aa2be1e8a74a9e5ff78b9047ab15bc463fcf1cad6
1931
- lastVerified: '2026-06-15T00:26:26.247Z'
1931
+ checksum: sha256:c59435108b2a016040bafbcf6bbcf1a9ce3502446871ef5a3af908f38602cbfa
1932
+ lastVerified: '2026-06-25T14:35:16.949Z'
1932
1933
  create-next-story:
1933
1934
  path: .sinapse-ai/development/tasks/create-next-story.md
1934
1935
  layer: L2
@@ -1966,8 +1967,8 @@ entities:
1966
1967
  score: 0.8
1967
1968
  constraints: []
1968
1969
  extensionPoints: []
1969
- checksum: sha256:8a42add94bb0e1233d6f47203786ff57ec53bac148be37ec6ac3ca2cb3e5e2b8
1970
- lastVerified: '2026-06-15T00:26:26.248Z'
1970
+ checksum: sha256:5e3d0b592821b1136db7dcfa911ee5080055d76b2f390fe0497e8702b06f330d
1971
+ lastVerified: '2026-06-25T14:35:16.949Z'
1971
1972
  create-service:
1972
1973
  path: .sinapse-ai/development/tasks/create-service.md
1973
1974
  layer: L2
@@ -5625,6 +5626,32 @@ entities:
5625
5626
  extensionPoints: []
5626
5627
  checksum: sha256:702907ff987ef8db70bc7dba93aadcf40ba9d080321f8305dad7f9e2de10d1b2
5627
5628
  lastVerified: '2026-06-15T00:26:26.297Z'
5629
+ spec-analyze:
5630
+ path: .sinapse-ai/development/tasks/spec-analyze.md
5631
+ layer: L2
5632
+ type: task
5633
+ purpose: Provar, antes de gastar geração de código, que cada requisito virou task e que nada contradiz a
5634
+ keywords:
5635
+ - spec
5636
+ - analyze
5637
+ - 'pipeline:'
5638
+ - cross-consistency
5639
+ usedBy:
5640
+ - spec-pipeline
5641
+ dependencies:
5642
+ - architect
5643
+ externalDeps: []
5644
+ plannedDeps:
5645
+ - spec
5646
+ - constitution
5647
+ - tasks
5648
+ lifecycle: production
5649
+ adaptability:
5650
+ score: 0.8
5651
+ constraints: []
5652
+ extensionPoints: []
5653
+ checksum: sha256:5a73974cb88ca58274f907416839e8c864a3e35cf832668d3b2c582de3f6b26a
5654
+ lastVerified: '2026-06-24T15:49:40.276Z'
5628
5655
  spec-assess-complexity:
5629
5656
  path: .sinapse-ai/development/tasks/spec-assess-complexity.md
5630
5657
  layer: L2
@@ -5651,6 +5678,29 @@ entities:
5651
5678
  extensionPoints: []
5652
5679
  checksum: sha256:7ef9f00dad98113dcf6c273e0d56333aece4fa892c91fff8935d3c3c552748ae
5653
5680
  lastVerified: '2026-06-15T00:26:26.298Z'
5681
+ spec-clarify:
5682
+ path: .sinapse-ai/development/tasks/spec-clarify.md
5683
+ layer: L2
5684
+ type: task
5685
+ purpose: Desambiguar a especificação ANTES do QA gate e do plano. Roda DEPOIS de `write` (spec escrita)
5686
+ keywords:
5687
+ - spec
5688
+ - clarify
5689
+ - 'pipeline:'
5690
+ - specification
5691
+ usedBy:
5692
+ - spec-pipeline
5693
+ dependencies: []
5694
+ externalDeps: []
5695
+ plannedDeps:
5696
+ - spec
5697
+ lifecycle: production
5698
+ adaptability:
5699
+ score: 0.8
5700
+ constraints: []
5701
+ extensionPoints: []
5702
+ checksum: sha256:e4eee7ea80f146a697433462287aaff138536b148705337f2f32d66d2a83db5c
5703
+ lastVerified: '2026-06-24T15:49:40.277Z'
5654
5704
  spec-critique:
5655
5705
  path: .sinapse-ai/development/tasks/spec-critique.md
5656
5706
  layer: L2
@@ -5702,8 +5752,8 @@ entities:
5702
5752
  score: 0.8
5703
5753
  constraints: []
5704
5754
  extensionPoints: []
5705
- checksum: sha256:1a1b02926d2fc13d85caf9da0cbc84122cd4ec1e7ec8ec292b4d1cac190c70d3
5706
- lastVerified: '2026-06-15T00:26:26.299Z'
5755
+ checksum: sha256:7ed12b65fca5657d218fbfaa40c0a05af5d3e14a17a332c089dd1147d7cb1ca9
5756
+ lastVerified: '2026-06-25T14:35:16.977Z'
5707
5757
  spec-research-dependencies:
5708
5758
  path: .sinapse-ai/development/tasks/spec-research-dependencies.md
5709
5759
  layer: L2
@@ -7291,8 +7341,8 @@ entities:
7291
7341
  score: 0.5
7292
7342
  constraints: []
7293
7343
  extensionPoints: []
7294
- checksum: sha256:cc68f141e09386096f6add62717f63f0b56bb53f315eafcafc4bb649f151d25f
7295
- lastVerified: '2026-06-15T00:26:26.324Z'
7344
+ checksum: sha256:ae365825677131fc9f5c6762c6a4a036be0737442bcbdb04cdbd4e3e3f547265
7345
+ lastVerified: '2026-06-25T14:35:16.991Z'
7296
7346
  project-brief-tmpl:
7297
7347
  path: .sinapse-ai/product/templates/project-brief-tmpl.yaml
7298
7348
  layer: L2
@@ -7418,8 +7468,8 @@ entities:
7418
7468
  score: 0.5
7419
7469
  constraints: []
7420
7470
  extensionPoints: []
7421
- checksum: sha256:03a71c8a3758864c3d27e4f0865734d986f4259f64af477d9fa4244f8972c7eb
7422
- lastVerified: '2026-06-15T00:26:26.326Z'
7471
+ checksum: sha256:58207c62ca73c18d9584232bc62ec43ee5f11dc4337d231eee5bf2cc87d15b78
7472
+ lastVerified: '2026-06-24T15:32:36.159Z'
7423
7473
  state-persistence-tmpl:
7424
7474
  path: .sinapse-ai/product/templates/state-persistence-tmpl.yaml
7425
7475
  layer: L2
@@ -11831,6 +11881,28 @@ entities:
11831
11881
  extensionPoints: []
11832
11882
  checksum: sha256:14e91bfefde4f1ee9ecea1e2902bcc43a754719b1572d93f7d2ca357c87c8312
11833
11883
  lastVerified: '2026-06-15T00:26:26.404Z'
11884
+ doc-first-resolver:
11885
+ path: .sinapse-ai/core/orchestration/doc-first-resolver.js
11886
+ layer: L1
11887
+ type: module
11888
+ purpose: Entity at .sinapse-ai\core\orchestration\doc-first-resolver.js
11889
+ keywords:
11890
+ - doc
11891
+ - first
11892
+ - resolver
11893
+ usedBy:
11894
+ - route-command
11895
+ dependencies:
11896
+ - greenfield-handler
11897
+ externalDeps: []
11898
+ plannedDeps: []
11899
+ lifecycle: production
11900
+ adaptability:
11901
+ score: 0.4
11902
+ constraints: []
11903
+ extensionPoints: []
11904
+ checksum: sha256:e3c8c695ef0b4f268a3e02a0d4258fef1ae90aaec0b281ee8c5c5fb3bd475939
11905
+ lastVerified: '2026-06-25T14:57:04.259Z'
11834
11906
  epic-context-accumulator:
11835
11907
  path: .sinapse-ai/core/orchestration/epic-context-accumulator.js
11836
11908
  layer: L1
@@ -12035,6 +12107,7 @@ entities:
12035
12107
  - handler
12036
12108
  usedBy:
12037
12109
  - bob-orchestrator
12110
+ - doc-first-resolver
12038
12111
  dependencies:
12039
12112
  - workflow-executor
12040
12113
  - surface-checker
@@ -12141,6 +12214,27 @@ entities:
12141
12214
  extensionPoints: []
12142
12215
  checksum: sha256:cfbf41b69336548b2fc4179a5513243491ca6eb501de3426f98254f118b074e7
12143
12216
  lastVerified: '2026-06-15T00:26:26.411Z'
12217
+ route-command:
12218
+ path: .sinapse-ai/core/orchestration/route-command.js
12219
+ layer: L1
12220
+ type: module
12221
+ purpose: Entity at .sinapse-ai\core\orchestration\route-command.js
12222
+ keywords:
12223
+ - route
12224
+ - command
12225
+ usedBy:
12226
+ - sinapse
12227
+ dependencies:
12228
+ - doc-first-resolver
12229
+ externalDeps: []
12230
+ plannedDeps: []
12231
+ lifecycle: production
12232
+ adaptability:
12233
+ score: 0.4
12234
+ constraints: []
12235
+ extensionPoints: []
12236
+ checksum: sha256:b7a5aa520936eb819d7b577fd7b15bcee8c7f8e9e147c6fa3db9fd12a493b7f3
12237
+ lastVerified: '2026-06-25T14:57:04.262Z'
12144
12238
  session-state:
12145
12239
  path: .sinapse-ai/core/orchestration/session-state.js
12146
12240
  layer: L1
@@ -13655,6 +13749,7 @@ entities:
13655
13749
  - plan-create-context
13656
13750
  - plan-create-implementation
13657
13751
  - qa-review-build
13752
+ - spec-analyze
13658
13753
  - spec-assess-complexity
13659
13754
  - spec-critique
13660
13755
  - spec-gather-requirements
@@ -15074,7 +15169,9 @@ entities:
15074
15169
  - spec-assess-complexity
15075
15170
  - spec-research-dependencies
15076
15171
  - spec-write-spec
15172
+ - spec-clarify
15077
15173
  - spec-critique
15174
+ - spec-analyze
15078
15175
  - architect
15079
15176
  - analyst
15080
15177
  externalDeps: []
@@ -15086,8 +15183,8 @@ entities:
15086
15183
  score: 0.4
15087
15184
  constraints: []
15088
15185
  extensionPoints: []
15089
- checksum: sha256:890753d02dd6469441fe82a5eba0ecf48a3ac7969cfda3cd888c94cb74695c39
15090
- lastVerified: '2026-06-15T00:26:26.489Z'
15186
+ checksum: sha256:fc739f0f5ec927ed9daecbd0fc74b68017ed548ce445c40b9b1ecd5f1ff2ff4b
15187
+ lastVerified: '2026-06-25T14:35:17.067Z'
15091
15188
  story-development-cycle:
15092
15189
  path: .sinapse-ai/development/workflows/story-development-cycle.yaml
15093
15190
  layer: L2
@@ -80,6 +80,15 @@ Caio's runtime test (2026-05-07) showed the framework treating fresh installs as
80
80
  > **This step runs AFTER the Initial State Audit, BEFORE the routing decision. No exceptions.**
81
81
  > Without it, Imperator routes large-project requests directly to a domain orchestrator and skips the doc-first pipeline (Article III violation).
82
82
 
83
+ ### Deterministic engine (source of truth — never hand-classify)
84
+
85
+ The classification below is NOT done by reasoning from memory. It is computed by the **doc-first resolver** (`.sinapse-ai/core/orchestration/doc-first-resolver.js`) — the single source of truth shared by the CLI and the enforcement hook, so the agent and the gate can never drift:
86
+
87
+ - **Observe the decision** with `sinapse route "<brief>"` — read-only, no side effects. It returns the resolved `projectType`, the required greenfield `workflow`, the upstream `artifacts` (brief → prd → spec → architecture), and whether the doc-first `gate` is already satisfied.
88
+ - **Enforcement is automatic** — the `doc-first-gate.cjs` PreToolUse hook HARD-BLOCKS code writes in a greenfield project until PRD + epic + a `Ready` story exist. The framework repo and existing (brownfield) projects are exempt; escape with `SINAPSE_SKIP_DOCFIRST=1` only when explicitly justified.
89
+
90
+ Run `sinapse route` first and let its output drive Steps 1–4 below. Steps 1–4 are the human-readable explanation of what the resolver already decided — when prose and resolver disagree, the resolver wins.
91
+
83
92
  After the audit reports the maturity level, classify the request **before** consulting the routing table:
84
93
 
85
94
  ### Step 1 — Detect intent
@@ -238,7 +238,7 @@ If a YAML Template has not been provided, list all templates from .sinapse-ai/pr
238
238
 
239
239
  **YOU MUST:**
240
240
 
241
- 1. Present section content
241
+ 1. Present section content. **If the section content is a list of artifacts (epics, requirements, stories, tasks, risks), render it as a scannable approval table FIRST, following `.sinapse-ai/development/templates/approval-table.md` (verdict header → table → decision prompt). Never report a list as a count or as prose when a table schema fits.**
242
242
  2. Provide detailed rationale (explain trade-offs, assumptions, decisions made)
243
243
  3. **STOP and present numbered options 1-9:**
244
244
  - **Option 1:** Always "Proceed to next section"
@@ -773,9 +773,8 @@ Use the primary agent from "Specialized Agent Assignment" to determine which sel
773
773
  - Ensure tasks align with both epic requirements and architecture constraints
774
774
  - Update status to "Draft" and save the story file
775
775
  - Execute `sinapse-ai/tasks/execute-checklist` `sinapse-ai/checklists/story-draft-checklist`
776
- - Provide summary to user including:
777
- - Story created: `{devStoryLocation}/{epicNum}.{storyNum}.story.md`
778
- - Status: Draft
776
+ - Provide summary to user as a scannable **story approval table** per `.sinapse-ai/development/templates/approval-table.md` (Story summary schema: a `| Field | Value |` table + an `| AC# | Criterion | Tasks |` table), not a plain bullet list. The table MUST surface:
777
+ - Story created (path), Status (Draft), Acceptance count, Tasks count (linked to ACs), Dependencies
779
778
  - Key technical components included from architecture docs
780
779
  - Any deviations or conflicts noted between epic and architecture
781
780
  - Checklist Results