sinapse-ai 1.16.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.
- package/.claude/hooks/doc-first-gate.cjs +156 -0
- package/.claude/hooks/enforce-story-gate.cjs +6 -2
- package/.claude/rules/hook-governance.md +1 -0
- package/.sinapse-ai/constitution.md +1 -1
- package/.sinapse-ai/core/atlas/atlas-data.js +278 -0
- package/.sinapse-ai/core/atlas/flows-pt.js +253 -0
- package/.sinapse-ai/core/atlas/flows.js +266 -0
- package/.sinapse-ai/core/atlas/index.js +62 -0
- package/.sinapse-ai/core/atlas/render-html.js +216 -0
- package/.sinapse-ai/core/atlas/render-markdown.js +313 -0
- package/.sinapse-ai/core/atlas/render-research-card.js +164 -0
- package/.sinapse-ai/core/orchestration/build-command.js +136 -0
- package/.sinapse-ai/core/orchestration/doc-first-resolver.js +322 -0
- package/.sinapse-ai/core/orchestration/route-command.js +97 -0
- package/.sinapse-ai/data/entity-registry.yaml +59 -14
- package/.sinapse-ai/development/agents/snps-orqx.md +9 -0
- package/.sinapse-ai/development/tasks/create-doc.md +1 -1
- package/.sinapse-ai/development/tasks/create-next-story.md +2 -3
- package/.sinapse-ai/development/tasks/spec-gather-requirements.md +11 -0
- package/.sinapse-ai/development/templates/approval-table.md +106 -0
- package/.sinapse-ai/development/workflows/spec-pipeline.yaml +1 -0
- package/.sinapse-ai/install-manifest.yaml +60 -16
- package/.sinapse-ai/product/templates/prd-tmpl.yaml +6 -2
- package/CHANGELOG.md +18 -2
- package/bin/sinapse.js +121 -0
- package/docs/framework/atlas/OPERATING-ATLAS.md +537 -0
- package/docs/framework/atlas/README.md +34 -0
- package/docs/framework/atlas/atlas-data.json +2810 -0
- package/docs/framework/atlas/atlas.html +392 -0
- package/package.json +1 -1
- package/packages/installer/src/wizard/ide-config-generator.js +6 -0
- package/scripts/install-chrome-brain.sh +2 -2
- package/scripts/validate-no-personal-leaks.js +24 -9
- package/squads/squad-copy/knowledge-base/consequence-headline-patterns.md +2 -2
- package/docs/guides/hooks-two-layers.md +0 -66
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Operating Flows — PT-BR translations.
|
|
3
|
+
*
|
|
4
|
+
* Portuguese rendering of FRAMEWORK_FLOWS (flows.js), keyed by flow id. Used by
|
|
5
|
+
* the research-card render target so the SINAPSE case-study card in the
|
|
6
|
+
* engineering-software research reads in the same language as the rest of that
|
|
7
|
+
* corpus. flows.js stays the single source of *which* flows exist and their
|
|
8
|
+
* structure; this file is the translation layer.
|
|
9
|
+
*
|
|
10
|
+
* Drift guard: a test asserts every id in FRAMEWORK_FLOWS has an entry here, so
|
|
11
|
+
* adding a flow without translating it fails CI.
|
|
12
|
+
*
|
|
13
|
+
* @module core/atlas/flows-pt
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
/** @type {Record<string,{titulo:string,proposito:string,mermaid:string}>} */
|
|
19
|
+
const FRAMEWORK_FLOWS_PT = {
|
|
20
|
+
lifecycle: {
|
|
21
|
+
titulo: 'Ciclo de ponta a ponta',
|
|
22
|
+
proposito:
|
|
23
|
+
'A espinha completa que um pedido percorre: do briefing ao código entregue, com o pipeline doc-first e os gates no meio.',
|
|
24
|
+
mermaid: `flowchart TD
|
|
25
|
+
U[Briefing do usuário] --> C{Classifica intenção + tipo de projeto}
|
|
26
|
+
C -->|projeto novo| GF[Workflow greenfield]
|
|
27
|
+
C -->|projeto existente| BF[Descoberta brownfield]
|
|
28
|
+
C -->|bug / ajuste| SDC[Ciclo de dev da story - YOLO]
|
|
29
|
+
GF --> DOC[Pipeline doc-first]
|
|
30
|
+
BF --> DOC
|
|
31
|
+
DOC --> PRD[PRD] --> EPIC[Épico] --> STORY[Story - validada >= Ready] --> SPEC[Spec]
|
|
32
|
+
SPEC --> GATE{{Gate doc-first}}
|
|
33
|
+
SDC --> GATE
|
|
34
|
+
GATE -->|faltam docs| BLOCK[Bloqueado - produza os docs antes]
|
|
35
|
+
GATE -->|satisfeito| IMPL[Implementação - desenvolvedor]
|
|
36
|
+
IMPL --> QA[Gate de QA + loop de QA]
|
|
37
|
+
QA -->|passa| SHIP[Push / PR - só devops]
|
|
38
|
+
QA -->|falha| IMPL`,
|
|
39
|
+
},
|
|
40
|
+
'agent-routing': {
|
|
41
|
+
titulo: 'Roteamento de agente (delegação)',
|
|
42
|
+
proposito:
|
|
43
|
+
'Como um briefing chega no especialista certo. Orquestradores roteiam e coordenam; nunca executam o trabalho de domínio (Artigo VIII).',
|
|
44
|
+
mermaid: `sequenceDiagram
|
|
45
|
+
participant U as Usuário
|
|
46
|
+
participant I as Imperator (master -orqx)
|
|
47
|
+
participant S as Squad -orqx
|
|
48
|
+
participant A as Agente especialista
|
|
49
|
+
U->>I: briefing (linguagem natural)
|
|
50
|
+
I->>I: diagnostica domínio + tipo de projeto
|
|
51
|
+
alt trabalho de domínio
|
|
52
|
+
I->>S: delega (anuncia o plano, espera o "pode ir")
|
|
53
|
+
S->>A: roteia pro especialista
|
|
54
|
+
A-->>S: artefato / resultado
|
|
55
|
+
S-->>I: consolidado
|
|
56
|
+
else dev do framework
|
|
57
|
+
I->>A: roteia pro agente de framework (pm / architect / dev / qa)
|
|
58
|
+
end
|
|
59
|
+
I-->>U: resultado em linguagem de negócio (sem jargão interno)`,
|
|
60
|
+
},
|
|
61
|
+
'model-routing': {
|
|
62
|
+
titulo: 'Roteamento de modelo (o mais barato que resolve)',
|
|
63
|
+
proposito:
|
|
64
|
+
'Como cada tarefa escolhe o tier de modelo. O raciocínio pesado vai pra spec; a execução depois quase só lê um doc pronto, então economia de token é consequência.',
|
|
65
|
+
mermaid: `flowchart TD
|
|
66
|
+
T[Tarefa] --> K{Tipo?}
|
|
67
|
+
K -->|lint / rename / yaml / massa| H[haiku - esforço baixo]
|
|
68
|
+
K -->|feature da spec / review / bug / testes| SO[sonnet - alto]
|
|
69
|
+
K -->|arquivo único / factual| SM[sonnet - médio]
|
|
70
|
+
K -->|arquitetura cross-system / debug complexo| OP[opus - xhigh]
|
|
71
|
+
K -->|Spec Pipeline COMPLEX score >= 16| OM[opus - max]
|
|
72
|
+
H --> SP{>= 8 tool calls ou fan-out real?}
|
|
73
|
+
SO --> SP
|
|
74
|
+
SM --> SP
|
|
75
|
+
OP --> SP
|
|
76
|
+
OM --> SP
|
|
77
|
+
SP -->|sim| SUB[Spawna sub-agente]
|
|
78
|
+
SP -->|não| INLINE[Roda inline]`,
|
|
79
|
+
},
|
|
80
|
+
'doc-first': {
|
|
81
|
+
titulo: 'Enforcement doc-first',
|
|
82
|
+
proposito:
|
|
83
|
+
'O que torna impossível começar um projeto novo sem docs. O resolver responde o que falta; hooks bloqueiam escrita de código até existir PRD + épico + story.',
|
|
84
|
+
mermaid: `flowchart TD
|
|
85
|
+
W[Escreve/edita arquivo de código] --> EX{Path isento ou repo do framework?}
|
|
86
|
+
EX -->|sim| ALLOW[Libera]
|
|
87
|
+
EX -->|não| RES[doc-first-resolver: tipo, workflow, gate]
|
|
88
|
+
RES --> GF{Greenfield + gate não satisfeito?}
|
|
89
|
+
GF -->|não| STORY{Existe story Ready? - story-gate}
|
|
90
|
+
GF -->|sim, sem PRD/épico/story| DENY[BLOQUEIA - rode o fluxo greenfield antes]
|
|
91
|
+
STORY -->|sim| ALLOW
|
|
92
|
+
STORY -->|não| DENY2[BLOQUEIA - crie uma story]
|
|
93
|
+
DENY -.->|escape: SINAPSE_SKIP_DOCFIRST=1| ALLOW
|
|
94
|
+
OBS["sinapse route dá a mesma resposta (observabilidade)"]:::note
|
|
95
|
+
RES -. compartilha a lógica .- OBS
|
|
96
|
+
classDef note fill:#1c1c1c,stroke:#555,color:#aaa`,
|
|
97
|
+
},
|
|
98
|
+
'constitution-gates': {
|
|
99
|
+
titulo: 'Gates constitucionais por fase',
|
|
100
|
+
proposito:
|
|
101
|
+
'Onde cada artigo inegociável dispara ao longo do ciclo — a camada de enforcement que bloqueia violações automaticamente.',
|
|
102
|
+
mermaid: `flowchart LR
|
|
103
|
+
subgraph PLAN[Planejar]
|
|
104
|
+
A3[III Documentação-Primeiro]
|
|
105
|
+
A4[IV Sem Invenção]
|
|
106
|
+
end
|
|
107
|
+
subgraph BUILD[Construir]
|
|
108
|
+
A6[VI Imports Absolutos]
|
|
109
|
+
A8[VIII Delegação Obrigatória]
|
|
110
|
+
A10[X Segurança & Dados]
|
|
111
|
+
end
|
|
112
|
+
subgraph SHIP[Entregar]
|
|
113
|
+
A2[II Autoridade de Agente - só devops]
|
|
114
|
+
A5[V Qualidade Primeiro]
|
|
115
|
+
A9[IX Colaboração Segura]
|
|
116
|
+
end
|
|
117
|
+
subgraph ALWAYS[Transversais]
|
|
118
|
+
A1[I CLI Primeiro]
|
|
119
|
+
A7[VII Exatidão de Métricas]
|
|
120
|
+
A11[XI Default Conservador]
|
|
121
|
+
end
|
|
122
|
+
PLAN --> BUILD --> SHIP`,
|
|
123
|
+
},
|
|
124
|
+
'project-classification': {
|
|
125
|
+
titulo: 'Classificação de projeto para workflow',
|
|
126
|
+
proposito:
|
|
127
|
+
'Como a intenção mapeia pro workflow certo: site/lp/app vs plataforma/saas vs api/serviço, greenfield vs brownfield, ou um ajuste leve.',
|
|
128
|
+
mermaid: `flowchart TD
|
|
129
|
+
B[Briefing] --> N{Novo ou existente?}
|
|
130
|
+
N -->|existente, desconhecido| BD[brownfield-discovery]
|
|
131
|
+
N -->|existente, conhecido| FIX{Tamanho da mudança?}
|
|
132
|
+
N -->|novo| TYPE{Tipo de projeto?}
|
|
133
|
+
TYPE -->|site / lp / app| GUI[greenfield-ui]
|
|
134
|
+
TYPE -->|plataforma / saas| GFS[greenfield-fullstack]
|
|
135
|
+
TYPE -->|api / serviço| GSV[greenfield-service]
|
|
136
|
+
BD --> BTYPE{Tipo?}
|
|
137
|
+
BTYPE -->|ui| BUI[brownfield-ui]
|
|
138
|
+
BTYPE -->|fullstack| BFS[brownfield-fullstack]
|
|
139
|
+
BTYPE -->|serviço| BSV[brownfield-service]
|
|
140
|
+
FIX -->|bug / ajuste| YOLO[SDC - YOLO]
|
|
141
|
+
FIX -->|feature| SDCI[SDC - interativo]
|
|
142
|
+
FIX -->|complexo score >= 16| SPEC[Spec Pipeline antes]`,
|
|
143
|
+
},
|
|
144
|
+
'prompt-lifecycle': {
|
|
145
|
+
titulo: 'Cada prompt (o que dispara em toda mensagem)',
|
|
146
|
+
proposito:
|
|
147
|
+
'O que acontece em toda mensagem do usuário antes mesmo do modelo responder: hooks injetam grounding e a constituição, então cada turno já começa ciente da base de conhecimento do projeto, do design system, das leis de engenharia e das regras ativas.',
|
|
148
|
+
mermaid: `flowchart TD
|
|
149
|
+
P[Usuário envia um prompt] --> H[Hooks UserPromptSubmit disparam]
|
|
150
|
+
H --> VG[Grounding de conhecimento - contexto do projeto por domínio]
|
|
151
|
+
H --> DS[Grounding do design system - DS resolver por cwd]
|
|
152
|
+
H --> EG[Grounding de engenharia - leis + KIT por tema]
|
|
153
|
+
H --> SG[Grounding de squad - contexto curado da squad]
|
|
154
|
+
H --> CR[Constituição + bracket de contexto injetados]
|
|
155
|
+
VG --> M[Modelo recebe contexto enriquecido]
|
|
156
|
+
DS --> M
|
|
157
|
+
EG --> M
|
|
158
|
+
SG --> M
|
|
159
|
+
CR --> M
|
|
160
|
+
M --> ACT[Age: responde ou roteia pro especialista]`,
|
|
161
|
+
},
|
|
162
|
+
'session-start': {
|
|
163
|
+
titulo: 'Cada sessão (início seguro)',
|
|
164
|
+
proposito:
|
|
165
|
+
'A rede de segurança que roda antes de qualquer trabalho na sessão: sincroniza com o remoto, nunca toca na main, audita o que já existe para nunca sobrescrever trabalho parcial (Colaboração Segura + Inteligência de Projeto).',
|
|
166
|
+
mermaid: `flowchart TD
|
|
167
|
+
S[Sessão inicia] --> F[git fetch origin]
|
|
168
|
+
F --> SY{Main local atrasada?}
|
|
169
|
+
SY -->|sim, limpa| PULL[Pull fast-forward]
|
|
170
|
+
SY -->|divergiu| STOP[Para - resolve com segurança]
|
|
171
|
+
PULL --> BR[Cria feature branch automática - user/type/desc]
|
|
172
|
+
STOP --> BR
|
|
173
|
+
BR --> AUD[Auditoria de estado inicial - 8 dimensões]
|
|
174
|
+
AUD --> MAT{Maturidade?}
|
|
175
|
+
MAT -->|vazio| GREEN[Workflow greenfield]
|
|
176
|
+
MAT -->|parcial| CONT[Continua - nunca sobrescreve]
|
|
177
|
+
MAT -->|maduro| BROWN[Descoberta brownfield]
|
|
178
|
+
MAT -->|gerido-pelo-sinapse| RESUME[Retoma story ativa - SDC]`,
|
|
179
|
+
},
|
|
180
|
+
'orchestration-handoff': {
|
|
181
|
+
titulo: 'Cada orquestração (plano + handoff)',
|
|
182
|
+
proposito:
|
|
183
|
+
'Como o controle passa entre agentes sem inchar o contexto: o orquestrador planeja e então espera o "pode ir", e cada troca de agente compacta a persona anterior num artefato mínimo de handoff (~379 tokens) em vez de carregar tudo adiante.',
|
|
184
|
+
mermaid: `sequenceDiagram
|
|
185
|
+
participant U as Usuário
|
|
186
|
+
participant O as Orquestrador
|
|
187
|
+
participant A1 as Agente A (saindo)
|
|
188
|
+
participant A2 as Agente B (entrando)
|
|
189
|
+
O->>O: diagnostica + monta plano de orquestração
|
|
190
|
+
O->>U: apresenta o plano
|
|
191
|
+
U-->>O: pode ir
|
|
192
|
+
O->>A1: atribui trabalho (contexto isolado e mínimo)
|
|
193
|
+
A1->>A1: escreve artefato de handoff + scratchpad
|
|
194
|
+
A1-->>A2: handoff (story id, decisões, arquivos, próxima ação)
|
|
195
|
+
Note over A1,A2: persona completa descartada, ~379 tok mantidos
|
|
196
|
+
A2->>A2: lê o scratchpad, continua
|
|
197
|
+
A2-->>O: resultado destilado
|
|
198
|
+
O-->>U: síntese`,
|
|
199
|
+
},
|
|
200
|
+
'execution-cycle': {
|
|
201
|
+
titulo: 'Cada execução (ciclo de dev da story)',
|
|
202
|
+
proposito:
|
|
203
|
+
'O ciclo de vida da story depois que o gate doc-first é satisfeito: de rascunho a validada a implementada a revisada a entregue, com CodeRabbit se autocorrigindo no dev e o loop de QA antes do push (só @devops entrega).',
|
|
204
|
+
mermaid: `flowchart TD
|
|
205
|
+
D[Rascunho - sprint-lead] --> V{Valida - product-lead 10pt}
|
|
206
|
+
V -->|NÃO-VAI| D
|
|
207
|
+
V -->|VAI| R[Ready]
|
|
208
|
+
R --> IMP[InProgress - desenvolvedor]
|
|
209
|
+
IMP --> CRB[Autocorreção CodeRabbit - máx 2 iter]
|
|
210
|
+
CRB --> REV[InReview - quality-gate]
|
|
211
|
+
REV --> QL{Veredito do loop de QA}
|
|
212
|
+
QL -->|FALHA| IMP
|
|
213
|
+
QL -->|RESSALVAS| DOC[Documenta dívida]
|
|
214
|
+
QL -->|PASSA| PUSH[Push / PR - só devops]
|
|
215
|
+
DOC --> PUSH
|
|
216
|
+
PUSH --> DONE[Done]`,
|
|
217
|
+
},
|
|
218
|
+
'security-enforcement': {
|
|
219
|
+
titulo: 'Enforcement de segurança (transversal)',
|
|
220
|
+
proposito:
|
|
221
|
+
'Os guardrails sempre-ativos do commit à produção: segredos nunca são commitados, o acesso a dados é de menor privilégio e parametrizado, e nada chega na main sem PR (Artigos IX + X).',
|
|
222
|
+
mermaid: `flowchart TD
|
|
223
|
+
C[Pré-commit] --> SS{Varredura de segredos}
|
|
224
|
+
SS -->|segredo encontrado| BLK[Bloqueia - remove do staging]
|
|
225
|
+
SS -->|limpo| CM[Commit]
|
|
226
|
+
CM --> MRG[Merge origin/main - resolve conflitos]
|
|
227
|
+
MRG --> PR[PR obrigatório - branch protection]
|
|
228
|
+
PR --> CHK{Status checks + review}
|
|
229
|
+
CHK -->|falha| FIXS[Volta pra correção]
|
|
230
|
+
CHK -->|passa| SHIP[Merge]
|
|
231
|
+
DATA[Camada de dados] --> RLS[RLS em toda tabela de usuário]
|
|
232
|
+
DATA --> PAR[Só queries parametrizadas]
|
|
233
|
+
DATA --> ENV[Segredos no env, nunca no código]`,
|
|
234
|
+
},
|
|
235
|
+
'knowledge-memory': {
|
|
236
|
+
titulo: 'Conhecimento & memória (como se mantém atual)',
|
|
237
|
+
proposito:
|
|
238
|
+
'Como o framework se mantém grounded e autodocumentado: fontes de grounding alimentam cada turno, fatos duráveis persistem como dicas de memória, e o Atlas se regenera do disco para o mapa nunca divergir da realidade.',
|
|
239
|
+
mermaid: `flowchart TD
|
|
240
|
+
SRC[Fontes de grounding] --> VLT[Base de conhecimento - fonte de verdade do projeto]
|
|
241
|
+
SRC --> DSY[Design systems - DS do projeto]
|
|
242
|
+
SRC --> ENG[Pesquisa de engenharia - 60 domínios]
|
|
243
|
+
VLT --> TURN[Injetado a cada turno]
|
|
244
|
+
DSY --> TURN
|
|
245
|
+
ENG --> TURN
|
|
246
|
+
MEM[Arquivos de memória - dicas, não verdade] --> VERIFY[Verifica contra o código antes de agir]
|
|
247
|
+
ATL[sinapse atlas] --> SCAN[Varre o repo do disco - contagens exatas]
|
|
248
|
+
SCAN --> OUT[Regenera o mapa - md + html + json]
|
|
249
|
+
OUT --> NODRIFT[Fonte única, nunca diverge]`,
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
module.exports = { FRAMEWORK_FLOWS_PT };
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Operating Flows — the meta-workflows of how SINAPSE itself runs.
|
|
3
|
+
*
|
|
4
|
+
* These are NOT development workflows (those live in docs/sinapse-workflows/).
|
|
5
|
+
* They are the framework's own mechanisms — agent routing, model routing, the
|
|
6
|
+
* doc-first enforcement chain, constitutional gates, project classification —
|
|
7
|
+
* authored as Mermaid diagrams. Both the markdown atlas and the HTML dashboard
|
|
8
|
+
* render them, so "how the framework works" is shown visually in one place.
|
|
9
|
+
*
|
|
10
|
+
* Kept as data (id, title, purpose, mermaid) so renderers stay dumb and the set
|
|
11
|
+
* is easy to extend. Mermaid is hand-written and kept simple (plain node labels,
|
|
12
|
+
* no reserved chars) so it renders everywhere.
|
|
13
|
+
*
|
|
14
|
+
* @module core/atlas/flows
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
/** @type {Array<{id:string,title:string,purpose:string,mermaid:string}>} */
|
|
20
|
+
const FRAMEWORK_FLOWS = [
|
|
21
|
+
{
|
|
22
|
+
id: 'lifecycle',
|
|
23
|
+
title: 'End-to-end lifecycle',
|
|
24
|
+
purpose:
|
|
25
|
+
'The full spine a request travels: from briefing to shipped code, with the doc-first pipeline and gates in the middle.',
|
|
26
|
+
mermaid: `flowchart TD
|
|
27
|
+
U[User briefing] --> C{Classify intent + project type}
|
|
28
|
+
C -->|new project| GF[Greenfield workflow]
|
|
29
|
+
C -->|existing project| BF[Brownfield discovery]
|
|
30
|
+
C -->|bug / tweak| SDC[Story dev cycle - YOLO]
|
|
31
|
+
GF --> DOC[Doc-first pipeline]
|
|
32
|
+
BF --> DOC
|
|
33
|
+
DOC --> PRD[PRD] --> EPIC[Epic] --> STORY[Story - validated >= Ready] --> SPEC[Spec]
|
|
34
|
+
SPEC --> GATE{{Doc-first gate}}
|
|
35
|
+
SDC --> GATE
|
|
36
|
+
GATE -->|missing docs| BLOCK[Blocked - produce docs first]
|
|
37
|
+
GATE -->|satisfied| IMPL[Implementation - @developer]
|
|
38
|
+
IMPL --> QA[QA gate + QA loop]
|
|
39
|
+
QA -->|pass| SHIP[Push / PR - @devops only]
|
|
40
|
+
QA -->|fail| IMPL`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'agent-routing',
|
|
44
|
+
title: 'Agent routing (delegation)',
|
|
45
|
+
purpose:
|
|
46
|
+
'How a briefing reaches the right specialist. Orchestrators route and coordinate; they never execute domain work themselves (Article VIII).',
|
|
47
|
+
mermaid: `sequenceDiagram
|
|
48
|
+
participant U as User
|
|
49
|
+
participant I as Imperator (master -orqx)
|
|
50
|
+
participant S as Squad -orqx
|
|
51
|
+
participant A as Specialist agent
|
|
52
|
+
U->>I: briefing (natural language)
|
|
53
|
+
I->>I: diagnose domain + project type
|
|
54
|
+
alt domain work
|
|
55
|
+
I->>S: delegate (announce plan, await go)
|
|
56
|
+
S->>A: route to specialist
|
|
57
|
+
A-->>S: artifact / result
|
|
58
|
+
S-->>I: consolidated
|
|
59
|
+
else framework dev
|
|
60
|
+
I->>A: route to framework agent (pm / architect / dev / qa)
|
|
61
|
+
end
|
|
62
|
+
I-->>U: business-language result (no internal jargon)`,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'model-routing',
|
|
66
|
+
title: 'Model routing (cheapest that solves it)',
|
|
67
|
+
purpose:
|
|
68
|
+
'How each task picks a model tier. Heavy thinking goes into the spec; execution then mostly reads a finished doc, so token economy is a consequence.',
|
|
69
|
+
mermaid: `flowchart TD
|
|
70
|
+
T[Task] --> K{Kind?}
|
|
71
|
+
K -->|lint / rename / yaml / bulk| H[haiku - low effort]
|
|
72
|
+
K -->|feature from spec / review / bug / tests| SO[sonnet - high]
|
|
73
|
+
K -->|single-file / factual| SM[sonnet - medium]
|
|
74
|
+
K -->|cross-system arch / complex debug / multi-file| OP[opus - xhigh]
|
|
75
|
+
K -->|Spec Pipeline COMPLEX score >= 16| OM[opus - max]
|
|
76
|
+
H --> SP{>= 8 tool calls or real fan-out?}
|
|
77
|
+
SO --> SP
|
|
78
|
+
SM --> SP
|
|
79
|
+
OP --> SP
|
|
80
|
+
OM --> SP
|
|
81
|
+
SP -->|yes| SUB[Spawn sub-agent]
|
|
82
|
+
SP -->|no| INLINE[Run inline]`,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'doc-first',
|
|
86
|
+
title: 'Doc-first enforcement',
|
|
87
|
+
purpose:
|
|
88
|
+
'What makes it impossible to start a new project without docs. The resolver answers what is missing; hooks block code writes until PRD + epic + story exist.',
|
|
89
|
+
mermaid: `flowchart TD
|
|
90
|
+
W[Write/Edit a code file] --> EX{Exempt path or framework repo?}
|
|
91
|
+
EX -->|yes| ALLOW[Allow]
|
|
92
|
+
EX -->|no| RES[doc-first-resolver: type, workflow, gate]
|
|
93
|
+
RES --> GF{Greenfield + gate unsatisfied?}
|
|
94
|
+
GF -->|no| STORY{Ready story exists? - story-gate}
|
|
95
|
+
GF -->|yes, no PRD/epic/story| DENY[BLOCK - run greenfield flow first]
|
|
96
|
+
STORY -->|yes| ALLOW
|
|
97
|
+
STORY -->|no| DENY2[BLOCK - create a story]
|
|
98
|
+
DENY -.->|escape: SINAPSE_SKIP_DOCFIRST=1| ALLOW
|
|
99
|
+
OBS["sinapse route gives the same answer (observability)"]:::note
|
|
100
|
+
RES -. shares logic .- OBS
|
|
101
|
+
classDef note fill:#1c1c1c,stroke:#555,color:#aaa`,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'constitution-gates',
|
|
105
|
+
title: 'Constitutional gates by phase',
|
|
106
|
+
purpose:
|
|
107
|
+
'Where each non-negotiable article fires across the lifecycle — the enforcement layer that blocks violations automatically.',
|
|
108
|
+
mermaid: `flowchart LR
|
|
109
|
+
subgraph PLAN[Plan]
|
|
110
|
+
A3[III Documentation-First]
|
|
111
|
+
A4[IV No Invention]
|
|
112
|
+
end
|
|
113
|
+
subgraph BUILD[Build]
|
|
114
|
+
A6[VI Absolute Imports]
|
|
115
|
+
A8[VIII Mandatory Delegation]
|
|
116
|
+
A10[X Security & Data]
|
|
117
|
+
end
|
|
118
|
+
subgraph SHIP[Ship]
|
|
119
|
+
A2[II Agent Authority - devops only]
|
|
120
|
+
A5[V Quality First]
|
|
121
|
+
A9[IX Safe Collaboration]
|
|
122
|
+
end
|
|
123
|
+
subgraph ALWAYS[Cross-cutting]
|
|
124
|
+
A1[I CLI First]
|
|
125
|
+
A7[VII Metrics Accuracy]
|
|
126
|
+
A11[XI Conservative Default]
|
|
127
|
+
end
|
|
128
|
+
PLAN --> BUILD --> SHIP`,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'project-classification',
|
|
132
|
+
title: 'Project classification to workflow',
|
|
133
|
+
purpose:
|
|
134
|
+
'How intent maps to the right workflow: site/lp/app vs platform/saas vs api/service, greenfield vs brownfield, or a light fix.',
|
|
135
|
+
mermaid: `flowchart TD
|
|
136
|
+
B[Briefing] --> N{New or existing?}
|
|
137
|
+
N -->|existing, unknown| BD[brownfield-discovery]
|
|
138
|
+
N -->|existing, known| FIX{Change size?}
|
|
139
|
+
N -->|new| TYPE{Project type?}
|
|
140
|
+
TYPE -->|site / lp / app| GUI[greenfield-ui]
|
|
141
|
+
TYPE -->|platform / saas| GFS[greenfield-fullstack]
|
|
142
|
+
TYPE -->|api / service| GSV[greenfield-service]
|
|
143
|
+
BD --> BTYPE{Type?}
|
|
144
|
+
BTYPE -->|ui| BUI[brownfield-ui]
|
|
145
|
+
BTYPE -->|fullstack| BFS[brownfield-fullstack]
|
|
146
|
+
BTYPE -->|service| BSV[brownfield-service]
|
|
147
|
+
FIX -->|bug / tweak| YOLO[SDC - YOLO]
|
|
148
|
+
FIX -->|feature| SDCI[SDC - interactive]
|
|
149
|
+
FIX -->|complex score >= 16| SPEC[Spec Pipeline first]`,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'prompt-lifecycle',
|
|
153
|
+
title: 'Every prompt (what fires on each message)',
|
|
154
|
+
purpose:
|
|
155
|
+
'What happens on every single user message before the model even answers: hooks inject grounding and the constitution, so each turn starts already aware of the project knowledge base, design system, engineering laws and the active rules.',
|
|
156
|
+
mermaid: `flowchart TD
|
|
157
|
+
P[User sends a prompt] --> H[UserPromptSubmit hooks fire]
|
|
158
|
+
H --> VG[Knowledge grounding - project context by domain]
|
|
159
|
+
H --> DS[Design system grounding - DS resolver by cwd]
|
|
160
|
+
H --> EG[Engineering grounding - laws + KIT by topic]
|
|
161
|
+
H --> SG[Squad grounding - curated squad context]
|
|
162
|
+
H --> CR[Constitution + context bracket injected]
|
|
163
|
+
VG --> M[Model receives enriched context]
|
|
164
|
+
DS --> M
|
|
165
|
+
EG --> M
|
|
166
|
+
SG --> M
|
|
167
|
+
CR --> M
|
|
168
|
+
M --> ACT[Act: answer or route to specialist]`,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'session-start',
|
|
172
|
+
title: 'Every session (safe start)',
|
|
173
|
+
purpose:
|
|
174
|
+
'The safety net that runs before any work in a session: sync with remote, never touch main, audit what already exists so partial work is never overwritten (Safe Collaboration + Project Intelligence).',
|
|
175
|
+
mermaid: `flowchart TD
|
|
176
|
+
S[Session starts] --> F[git fetch origin]
|
|
177
|
+
F --> SY{Local main behind?}
|
|
178
|
+
SY -->|yes, clean| PULL[Fast-forward pull]
|
|
179
|
+
SY -->|diverged| STOP[Stop - resolve safely]
|
|
180
|
+
PULL --> BR[Auto-create feature branch - user/type/desc]
|
|
181
|
+
STOP --> BR
|
|
182
|
+
BR --> AUD[Initial state audit - 8 dimensions]
|
|
183
|
+
AUD --> MAT{Maturity?}
|
|
184
|
+
MAT -->|empty| GREEN[Greenfield workflow]
|
|
185
|
+
MAT -->|partial| CONT[Continue - never overwrite]
|
|
186
|
+
MAT -->|mature| BROWN[Brownfield discovery]
|
|
187
|
+
MAT -->|sinapse-managed| RESUME[Resume active story - SDC]`,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 'orchestration-handoff',
|
|
191
|
+
title: 'Every orchestration (plan + handoff)',
|
|
192
|
+
purpose:
|
|
193
|
+
'How control passes between agents without context bloat: the orchestrator plans then waits for go, and each agent switch compacts the previous persona into a tiny handoff artifact (~379 tokens) instead of carrying it all forward.',
|
|
194
|
+
mermaid: `sequenceDiagram
|
|
195
|
+
participant U as User
|
|
196
|
+
participant O as Orchestrator
|
|
197
|
+
participant A1 as Agent A (outgoing)
|
|
198
|
+
participant A2 as Agent B (incoming)
|
|
199
|
+
O->>O: diagnose + build orchestration plan
|
|
200
|
+
O->>U: present plan
|
|
201
|
+
U-->>O: go
|
|
202
|
+
O->>A1: assign work (isolated, minimal context)
|
|
203
|
+
A1->>A1: write handoff artifact + scratchpad
|
|
204
|
+
A1-->>A2: handoff (story id, decisions, files, next action)
|
|
205
|
+
Note over A1,A2: full persona discarded, ~379 tok kept
|
|
206
|
+
A2->>A2: read scratchpad, continue
|
|
207
|
+
A2-->>O: distilled result
|
|
208
|
+
O-->>U: synthesis`,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: 'execution-cycle',
|
|
212
|
+
title: 'Every execution (story dev cycle)',
|
|
213
|
+
purpose:
|
|
214
|
+
'The story lifecycle once the doc-first gate is satisfied: draft to validated to implemented to reviewed to shipped, with CodeRabbit self-healing in dev and the QA loop before push (only @devops ships).',
|
|
215
|
+
mermaid: `flowchart TD
|
|
216
|
+
D[Draft - sprint-lead] --> V{Validate - product-lead 10pt}
|
|
217
|
+
V -->|NO-GO| D
|
|
218
|
+
V -->|GO| R[Ready]
|
|
219
|
+
R --> IMP[InProgress - developer]
|
|
220
|
+
IMP --> CRB[CodeRabbit self-heal - max 2 iter]
|
|
221
|
+
CRB --> REV[InReview - quality-gate]
|
|
222
|
+
REV --> QL{QA loop verdict}
|
|
223
|
+
QL -->|FAIL| IMP
|
|
224
|
+
QL -->|CONCERNS| DOC[Document debt]
|
|
225
|
+
QL -->|PASS| PUSH[Push / PR - devops only]
|
|
226
|
+
DOC --> PUSH
|
|
227
|
+
PUSH --> DONE[Done]`,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: 'security-enforcement',
|
|
231
|
+
title: 'Security enforcement (cross-cutting)',
|
|
232
|
+
purpose:
|
|
233
|
+
'The always-on guardrails from commit to production: secrets never get committed, data access is least-privilege and parameterized, and nothing reaches main without a PR (Articles IX + X).',
|
|
234
|
+
mermaid: `flowchart TD
|
|
235
|
+
C[Pre-commit] --> SS{Secret scan}
|
|
236
|
+
SS -->|secret found| BLK[Block - remove from staging]
|
|
237
|
+
SS -->|clean| CM[Commit]
|
|
238
|
+
CM --> MRG[Merge origin/main - resolve conflicts]
|
|
239
|
+
MRG --> PR[PR required - branch protection]
|
|
240
|
+
PR --> CHK{Status checks + review}
|
|
241
|
+
CHK -->|fail| FIXS[Return for fixes]
|
|
242
|
+
CHK -->|pass| SHIP[Merge]
|
|
243
|
+
DATA[Data layer] --> RLS[RLS on every user table]
|
|
244
|
+
DATA --> PAR[Parameterized queries only]
|
|
245
|
+
DATA --> ENV[Secrets in env, never in code]`,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: 'knowledge-memory',
|
|
249
|
+
title: 'Knowledge & memory (how it stays current)',
|
|
250
|
+
purpose:
|
|
251
|
+
'How the framework keeps itself grounded and self-documenting: grounding sources feed every turn, durable facts persist as memory hints, and the Atlas regenerates from disk so the map never drifts from reality.',
|
|
252
|
+
mermaid: `flowchart TD
|
|
253
|
+
SRC[Grounding sources] --> VLT[Knowledge base - project source of truth]
|
|
254
|
+
SRC --> DSY[Design systems - project DS]
|
|
255
|
+
SRC --> ENG[Engineering research - 60 domains]
|
|
256
|
+
VLT --> TURN[Injected every turn]
|
|
257
|
+
DSY --> TURN
|
|
258
|
+
ENG --> TURN
|
|
259
|
+
MEM[Memory files - hints, not truth] --> VERIFY[Verify vs codebase before acting]
|
|
260
|
+
ATL[sinapse atlas] --> SCAN[Scan repo from disk - exact counts]
|
|
261
|
+
SCAN --> OUT[Regenerate map - md + html + json]
|
|
262
|
+
OUT --> NODRIFT[Single source, never drifts]`,
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
|
|
266
|
+
module.exports = { FRAMEWORK_FLOWS };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas — generate the Framework Operating Atlas (data + LLM-readable markdown).
|
|
3
|
+
*
|
|
4
|
+
* One source of truth (atlas-data) → multiple renderings. This module writes:
|
|
5
|
+
* - docs/framework/atlas/atlas-data.json (structured data; HTML dashboard + tooling consume it)
|
|
6
|
+
* - docs/framework/atlas/OPERATING-ATLAS.md (LLM-readable atlas)
|
|
7
|
+
*
|
|
8
|
+
* CLI-first (Article I): exposed as `sinapse atlas`.
|
|
9
|
+
*
|
|
10
|
+
* @module core/atlas
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const { buildAtlasData } = require('./atlas-data');
|
|
19
|
+
const { renderAtlasMarkdown } = require('./render-markdown');
|
|
20
|
+
const { renderAtlasHtml } = require('./render-html');
|
|
21
|
+
|
|
22
|
+
const OUT_DIR = path.join('docs', 'framework', 'atlas');
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Generate the atlas artifacts.
|
|
26
|
+
* @param {object} [opts]
|
|
27
|
+
* @param {string} [opts.root=process.cwd()] - Repo root.
|
|
28
|
+
* @param {string} [opts.generatedAt] - ISO timestamp to stamp into outputs.
|
|
29
|
+
* @param {boolean} [opts.write=true] - Write files to disk.
|
|
30
|
+
* @returns {{ data: object, markdown: string, paths: {json:string, md:string} }}
|
|
31
|
+
*/
|
|
32
|
+
function generateAtlas(opts = {}) {
|
|
33
|
+
const root = opts.root || process.cwd();
|
|
34
|
+
const data = buildAtlasData({ root, generatedAt: opts.generatedAt || null });
|
|
35
|
+
const markdown = renderAtlasMarkdown(data);
|
|
36
|
+
const html = renderAtlasHtml(data);
|
|
37
|
+
|
|
38
|
+
const outDir = path.join(root, OUT_DIR);
|
|
39
|
+
const jsonPath = path.join(outDir, 'atlas-data.json');
|
|
40
|
+
const mdPath = path.join(outDir, 'OPERATING-ATLAS.md');
|
|
41
|
+
const htmlPath = path.join(outDir, 'atlas.html');
|
|
42
|
+
|
|
43
|
+
if (opts.write !== false) {
|
|
44
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
45
|
+
fs.writeFileSync(jsonPath, JSON.stringify(data, null, 2) + '\n');
|
|
46
|
+
fs.writeFileSync(mdPath, markdown);
|
|
47
|
+
fs.writeFileSync(htmlPath, html);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
data,
|
|
52
|
+
markdown,
|
|
53
|
+
html,
|
|
54
|
+
paths: {
|
|
55
|
+
json: path.relative(root, jsonPath),
|
|
56
|
+
md: path.relative(root, mdPath),
|
|
57
|
+
html: path.relative(root, htmlPath),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { generateAtlas, buildAtlasData, renderAtlasMarkdown };
|