sinapse-ai 1.21.0 → 1.23.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 +32 -3
- package/.claude/hooks/enforce-story-gate.cjs +53 -3
- package/.claude/rules/coderabbit-integration.md +6 -0
- package/.claude/rules/documentation-first-reference.md +146 -0
- package/.claude/rules/documentation-first.md +27 -119
- package/.claude/rules/mandatory-delegation-reference.md +93 -0
- package/.claude/rules/mandatory-delegation.md +29 -93
- package/.claude/rules/project-intelligence-reference.md +159 -0
- package/.claude/rules/project-intelligence.md +37 -155
- package/.claude/rules/safe-collaboration-reference.md +163 -0
- package/.claude/rules/safe-collaboration.md +32 -173
- package/.sinapse-ai/core/doctor/checks/index.js +1 -1
- package/.sinapse-ai/core/execution/build-orchestrator.js +4 -3
- package/.sinapse-ai/core/execution/subagent-dispatcher.js +2 -2
- package/.sinapse-ai/core/ideation/ideation-engine.js +2 -1
- package/.sinapse-ai/core/orchestration/cli-commands.js +13 -0
- package/.sinapse-ai/core/orchestration/doc-first-resolver.js +93 -2
- package/.sinapse-ai/core/orchestration/executors/epic-3-executor.js +15 -2
- package/.sinapse-ai/core/orchestration/executors/epic-4-executor.js +3 -1
- package/.sinapse-ai/core/orchestration/index.js +5 -0
- package/.sinapse-ai/core/orchestration/spec-complexity.js +141 -0
- package/.sinapse-ai/core-config.yaml +30 -0
- package/.sinapse-ai/data/entity-registry.yaml +46 -25
- package/.sinapse-ai/development/agents/architect.md +3 -15
- package/.sinapse-ai/development/agents/data-engineer.md +3 -15
- package/.sinapse-ai/development/agents/developer.md +3 -24
- package/.sinapse-ai/development/agents/devops.md +4 -25
- package/.sinapse-ai/development/agents/quality-gate.md +3 -25
- package/.sinapse-ai/development/knowledge-base/token-economy-guide.md +1 -1
- package/.sinapse-ai/development/tasks/resolve-github-issue.md +1 -1
- package/.sinapse-ai/docs/standards/SINAPSE-LIVRO-DE-OURO-V2.1-COMPLETE.md +6 -2
- package/.sinapse-ai/docs/standards/SINAPSE-LIVRO-DE-OURO-V2.2-SUMMARY.md +4 -1
- package/.sinapse-ai/install-manifest.yaml +44 -40
- package/.sinapse-ai/product/templates/story-tmpl.yaml +11 -6
- package/.sinapse-ai/quality/judge-calibration/README.md +75 -0
- package/.sinapse-ai/quality/judge-calibration/calibration-log.md +70 -0
- package/.sinapse-ai/quality/judge-calibration/golden-set.json +105 -0
- package/.sinapse-ai/quality/judge-calibration/scenarios.json +90 -0
- package/CHANGELOG.md +41 -11
- package/README.en.md +1 -1
- package/README.md +6 -6
- package/bin/sinapse-minimal.js +5 -4
- package/docs/community/README-community-snippet-core.md +1 -1
- package/docs/community/README-community-snippet-mcp.md +2 -2
- package/docs/framework/README.md +2 -2
- package/docs/framework/architecture-overview.md +2 -2
- package/docs/framework/core-architecture.md +1 -1
- package/docs/framework/feature-process.md +5 -5
- package/docs/framework/guiding-principles.md +1 -1
- package/docs/framework/roadmap.md +4 -4
- package/docs/framework/source-tree.md +1 -1
- package/docs/framework/versioning-and-releases.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/guides/agent-selection-guide.md +1 -1
- package/docs/guides/agents/traces/README.md +1 -1
- package/docs/guides/config-migration-guide.md +1 -1
- package/docs/guides/development-setup.md +1 -1
- package/docs/guides/docker-mcp-setup.md +5 -5
- package/docs/guides/getting-started.md +1 -1
- package/docs/guides/git-workflow-guide.md +3 -3
- package/docs/guides/ide-integration.md +3 -3
- package/docs/guides/ide-sync-guide.md +1 -1
- package/docs/guides/mcp/desktop-commander.md +2 -2
- package/docs/guides/mcp/docker-gateway-tutorial.md +1 -1
- package/docs/guides/mcp-global-setup.md +3 -3
- package/docs/guides/memory-intelligence-system.md +10 -10
- package/docs/guides/meta-agent-commands.md +1 -1
- package/docs/guides/quality-gates.md +1 -1
- package/docs/guides/security-hardening.md +1 -1
- package/docs/guides/service-discovery.md +1 -1
- package/docs/guides/squad-examples/README.md +1 -1
- package/docs/guides/squads-guide.md +1 -1
- package/docs/guides/testing-guide.md +2 -2
- package/docs/guides/user-guide.md +22 -22
- package/docs/guides/workflows/BROWNFIELD-DISCOVERY-WORKFLOW.md +3 -3
- package/docs/guides/workflows/BROWNFIELD-SERVICE-WORKFLOW.md +1 -1
- package/docs/guides/workflows/GREENFIELD-UI-WORKFLOW.md +2 -2
- package/docs/guides/workflows/SPEC-PIPELINE-WORKFLOW.md +3 -3
- package/docs/guides/workflows/STORY-DEVELOPMENT-CYCLE-WORKFLOW.md +3 -3
- package/docs/guides/workflows/pro-developer-workflow.md +2 -2
- package/docs/guides/workflows-guide.md +1 -1
- package/docs/guides/workflows-overview.md +1 -1
- package/docs/installation/npx-install.md +1 -1
- package/docs/installation/uninstallation.md +1 -1
- package/docs/installation/v4-quick-start.md +1 -1
- package/docs/pt/guides/user-guide.md +18 -18
- package/docs/pt/security.md +2 -2
- package/docs/security/overview.md +2 -2
- package/docs/security/security-best-practices.md +1 -1
- package/docs/sinapse-agent-flows/architect-system.md +1 -1
- package/docs/sinapse-agent-flows/data-engineer-system.md +1 -1
- package/docs/sinapse-agent-flows/dev-system.md +1 -1
- package/docs/sinapse-agent-flows/devops-system.md +2 -2
- package/docs/sinapse-agent-flows/qa-system.md +1 -1
- package/docs/sinapse-agent-flows/sm-system.md +2 -2
- package/docs/sinapse-agent-flows/snps-orqx-system.md +4 -4
- package/docs/sinapse-agent-flows/squad-creator-system.md +1 -1
- package/docs/sinapse-workflows/README.md +2 -2
- package/docs/sinapse-workflows/brownfield-discovery-workflow.md +3 -3
- package/docs/sinapse-workflows/brownfield-service-workflow.md +3 -3
- package/docs/sinapse-workflows/greenfield-ui-workflow.md +2 -2
- package/docs/sinapse-workflows/spec-pipeline-workflow.md +3 -3
- package/docs/sinapse-workflows/story-development-cycle-workflow.md +3 -3
- package/docs/troubleshooting.md +1 -1
- package/package.json +5 -1
- package/scripts/calibrate-judge.js +134 -0
- package/scripts/validate-all.js +5 -0
- package/scripts/validate-constitution.js +58 -0
- package/scripts/validate-story-acs.js +174 -0
- package/scripts/validate-tool-descriptions.js +128 -0
- package/scripts/wave-gate.js +1 -1
- package/squads/claude-code-mastery/agents/project-integrator.md +3 -10
- package/squads/claude-code-mastery/knowledge-base/context-window-optimization.md +2 -2
- package/squads/claude-code-mastery/knowledge-base/memory-systems-reference.md +1 -1
- package/squads/squad-copy/knowledge-base/ai-copy-human-loop-canon.md +1 -1
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> **Constitution Article VIII — NON-NEGOTIABLE**
|
|
4
4
|
> Applies to Imperator (sinapse-orqx) and ALL orchestrator agents (*-orqx).
|
|
5
|
+
> This is the always-on CORE (the law). The full delegation matrices (framework
|
|
6
|
+
> agents + squad orchestrators), own-domain table, and handoff detail live in
|
|
7
|
+
> `mandatory-delegation-reference.md` and load when you work on agent/squad files.
|
|
5
8
|
|
|
6
9
|
## Rule
|
|
7
10
|
|
|
@@ -12,109 +15,42 @@ Orchestrators NEVER execute domain work directly. They ALWAYS:
|
|
|
12
15
|
3. **Delegate** — Route to the appropriate specialist agent
|
|
13
16
|
4. **Coordinate** — Track progress and handle handoffs between agents
|
|
14
17
|
|
|
15
|
-
This is AUTOMATIC and INVIOLABLE
|
|
18
|
+
This is AUTOMATIC and INVIOLABLE — the user never needs to ask for delegation.
|
|
16
19
|
|
|
17
20
|
## Even When Explicitly Asked
|
|
18
21
|
|
|
19
|
-
If the user says
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- "nao delega, faz direto"
|
|
23
|
-
- "I want YOU to write the code"
|
|
24
|
-
- "just do it yourself"
|
|
25
|
-
- "implementa isso ai"
|
|
26
|
-
|
|
27
|
-
The orchestrator MUST still delegate. The correct response pattern is:
|
|
22
|
+
If the user says "voce faz", "faz voce mesmo", "nao delega", "I want YOU to write
|
|
23
|
+
the code", "just do it yourself", "implementa isso ai" — the orchestrator MUST
|
|
24
|
+
still delegate:
|
|
28
25
|
|
|
29
26
|
> "Absorvi o briefing. Delegando para @{specialist-agent} que e o especialista nesse dominio."
|
|
30
27
|
|
|
31
|
-
**NEVER** execute the work directly. **ALWAYS** delegate to the specialist
|
|
32
|
-
|
|
33
|
-
## Delegation Matrix
|
|
34
|
-
|
|
35
|
-
### Framework Agents (Development Workflow)
|
|
36
|
-
|
|
37
|
-
| Request Type | Delegate To |
|
|
38
|
-
|-------------|-------------|
|
|
39
|
-
| Code implementation | @developer (Pixel) |
|
|
40
|
-
| Story creation | @sprint-lead (Sync) |
|
|
41
|
-
| Story validation | @product-lead (Axis) |
|
|
42
|
-
| Architecture decisions | @architect (Stratum) |
|
|
43
|
-
| Quality/testing | @quality-gate (Litmus) |
|
|
44
|
-
| Database work | @data-engineer (Tensor) |
|
|
45
|
-
| UX/UI design | @ux-design-expert (Mosaic) |
|
|
46
|
-
| Git push/PR/release | @devops (Pipeline) |
|
|
47
|
-
| Epic orchestration | @project-lead (Beacon) |
|
|
48
|
-
| Research/analysis | @analyst (Scope) |
|
|
49
|
-
|
|
50
|
-
### Squad Orchestrators (Domain Expertise)
|
|
51
|
-
|
|
52
|
-
| Request Domain | Delegate To |
|
|
53
|
-
|---------------|-------------|
|
|
54
|
-
| Branding, identidade visual | @brand-orqx (Meridian) |
|
|
55
|
-
| Vendas, CRM, pipeline | @commercial-orqx (Pipeline) |
|
|
56
|
-
| Conteudo, editorial | @content-orqx |
|
|
57
|
-
| Copywriting, persuasao | @copy-orqx (Quill) |
|
|
58
|
-
| Animacoes web, motion | @animations-orqx (Kinetic) |
|
|
59
|
-
| UX/UI, design system | @design-orqx (Nexus) |
|
|
60
|
-
| Financeiro, pricing | @finance-orqx (Ledger) |
|
|
61
|
-
| Growth, SEO, analytics | @growth-orqx (Catalyst) |
|
|
62
|
-
| Midia paga, ads | @paidmedia-orqx (Apex) |
|
|
63
|
-
| Produto, roadmap | @product-orqx (Vector) |
|
|
64
|
-
| Pesquisa, inteligencia | @research-orqx (Prism) |
|
|
65
|
-
| Claude Code mastery | @swarm-orqx (Relay) |
|
|
66
|
-
| Conselho estrategico | @council-orqx (Zenith) |
|
|
67
|
-
| Storytelling, pitch | @storytelling-orqx (Arc) |
|
|
68
|
-
| Cybersecurity | @cyber-orqx (Fortress) |
|
|
69
|
-
| Clonagem cognitiva | @cloning-orqx (Helix) |
|
|
70
|
-
| Cursos, workshops | @courses-orqx (Syllabus) |
|
|
71
|
-
|
|
72
|
-
## What Orchestrators CAN Do (their actual domain)
|
|
73
|
-
|
|
74
|
-
Orchestrators have their OWN domain of expertise:
|
|
75
|
-
|
|
76
|
-
| Orchestrator | Own Domain (can execute directly) |
|
|
77
|
-
|-------------|----------------------------------|
|
|
78
|
-
| Imperator (sinapse-orqx) | Routing, diagnostico, plano de orquestracao, coordenacao cross-squad, framework governance |
|
|
79
|
-
| Squad *-orqx | Routing intra-squad, coordenacao de agentes do squad, handoff management |
|
|
80
|
-
|
|
81
|
-
Everything OUTSIDE their orchestration domain MUST be delegated.
|
|
82
|
-
|
|
83
|
-
## Anti-Patterns (FORBIDDEN)
|
|
84
|
-
|
|
85
|
-
- Orchestrator writing application code
|
|
86
|
-
- Orchestrator making architectural decisions without @architect
|
|
87
|
-
- Orchestrator creating stories without @sprint-lead
|
|
88
|
-
- Orchestrator running quality checks without @quality-gate
|
|
89
|
-
- Orchestrator doing database work without @data-engineer
|
|
90
|
-
- Orchestrator doing ANY specialist work outside of orchestration
|
|
91
|
-
- Saying "vou fazer isso eu mesmo" instead of delegating
|
|
92
|
-
- Absorbing a request and executing it instead of routing
|
|
93
|
-
|
|
94
|
-
## Universal Auto-Routing (users should NEVER call agents manually)
|
|
28
|
+
**NEVER** execute the work directly. **ALWAYS** delegate to the specialist.
|
|
95
29
|
|
|
96
|
-
|
|
30
|
+
## Universal Auto-Routing
|
|
97
31
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
32
|
+
Users are NOT AI experts. On EVERY user message: detect the domain → if a
|
|
33
|
+
specialist exists, delegate automatically (no confirmation) → brief
|
|
34
|
+
acknowledgment → return the result. Cross-agent handoffs (push → @devops,
|
|
35
|
+
tests → @quality-gate, schema → @data-engineer, story → @sprint-lead,
|
|
36
|
+
architecture → @architect) are automatic — never ask the user.
|
|
103
37
|
|
|
104
|
-
|
|
105
|
-
- Check for `.sinapse-ai/` → SINAPSE-managed (continue SDC)
|
|
106
|
-
- Check for `package.json` or `.git` → Brownfield (run quick tech scan first)
|
|
107
|
-
- Empty directory → Greenfield (ask project type, scaffold)
|
|
38
|
+
## Enforcement
|
|
108
39
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- Agent needs story → auto-create via fast-track or @sprint-lead
|
|
114
|
-
- Agent needs architecture decision → auto-delegate to @architect
|
|
40
|
+
Any orchestrator response containing direct domain work (code, schema, copy, etc.)
|
|
41
|
+
without having first delegated is a **constitutional violation** — correct it
|
|
42
|
+
immediately. Asking the user to manually invoke an agent (`@agent-name`,
|
|
43
|
+
`/SINAPSE:agents:...`) instead of auto-routing is a **UX violation**.
|
|
115
44
|
|
|
116
|
-
##
|
|
45
|
+
## Anti-Patterns (FORBIDDEN)
|
|
117
46
|
|
|
118
|
-
|
|
47
|
+
- Orchestrator writing application code, making architecture decisions without
|
|
48
|
+
@architect, creating stories without @sprint-lead, running quality gates
|
|
49
|
+
without @quality-gate, or doing ANY specialist work outside orchestration
|
|
50
|
+
- Saying "vou fazer isso eu mesmo" instead of delegating
|
|
51
|
+
- Absorbing a request and executing it instead of routing
|
|
119
52
|
|
|
120
|
-
|
|
53
|
+
> **Detail (loads on agent/squad work):** full delegation matrices (framework
|
|
54
|
+
> agents + 17 squad orchestrators), what orchestrators CAN do (own domain),
|
|
55
|
+
> auto-detect of project state, cross-agent handoff list — see
|
|
56
|
+
> `mandatory-delegation-reference.md`.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "package.json"
|
|
4
|
+
- "core-config.yaml"
|
|
5
|
+
- "docs/prd.md"
|
|
6
|
+
- "docs/project-brief.md"
|
|
7
|
+
- "docs/epics/**"
|
|
8
|
+
- "docs/stories/**"
|
|
9
|
+
- ".sinapse-ai/**"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Project Intelligence — Operational Reference
|
|
13
|
+
|
|
14
|
+
> Companion to `project-intelligence.md` (the always-on core law). This file carries
|
|
15
|
+
> the per-dimension signals, behaviors and examples and loads when you work on
|
|
16
|
+
> project-setup files.
|
|
17
|
+
|
|
18
|
+
## Initial State Audit — signals per dimension
|
|
19
|
+
|
|
20
|
+
The audit collects existence + summary for each dimension. Each is a YES/NO/PARTIAL signal:
|
|
21
|
+
|
|
22
|
+
| # | Dimension | Signals checked |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| 1 | **Docs** | `docs/project-brief.md`, `docs/prd.md`, `docs/architecture*.md`, `docs/front-end-spec.md`, `docs/epics/`, `docs/stories/` |
|
|
25
|
+
| 2 | **Brand** | `brand/`, `brandbook*`, `assets/brand/`, `public/brand/`, `*logo*`, `BRAND.md`, `BRANDBOOK.md` |
|
|
26
|
+
| 3 | **Design system** | `tokens.json`, `design-tokens.json`, `tailwind.config.*` with custom theme, `components/ui/`, `DESIGN.md`, `DS.md` |
|
|
27
|
+
| 4 | **Components** | `components/`, `src/components/`, `app/`, `pages/` with `.tsx` / `.jsx` / `.vue` files |
|
|
28
|
+
| 5 | **Code** | `package.json`, `tsconfig.json`, `src/`, language-specific markers (`go.mod`, `pyproject.toml`, `Cargo.toml`) |
|
|
29
|
+
| 6 | **Tests** | `jest.config.*`, `vitest.config.*`, `__tests__/`, `tests/`, `*.test.*`, `*.spec.*` |
|
|
30
|
+
| 7 | **Infra** | `.github/workflows/`, `Dockerfile`, `docker-compose.*`, `vercel.json`, `.env.example`, CI configs |
|
|
31
|
+
| 8 | **Git history** | `.git/` exists, `git log` has commits, recent activity (last 30 days), branch count |
|
|
32
|
+
|
|
33
|
+
### Maturity classification — criteria
|
|
34
|
+
|
|
35
|
+
| Level | Criteria | Recommended workflow |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `EMPTY` | 0/8 signals; directory has only `.git/` or nothing | Full greenfield workflow (greenfield-handler.js) |
|
|
38
|
+
| `BOOTSTRAPPED` | Only Infra (7) present (CI, Dockerfile, .env.example) — no code yet | Skip Phase 0 Bootstrap, jump to Phase 1 Discovery |
|
|
39
|
+
| `PARTIAL` | Some Docs/Brand/DS but no Code, OR Code without Docs | **Continue from where it stopped** — never overwrite, merge with existing |
|
|
40
|
+
| `MATURE` | Code + Tests + (Docs OR Infra) — real working project | Brownfield Discovery (10-phase technical debt) before any change |
|
|
41
|
+
| `SINAPSE_MANAGED` | `.sinapse-ai/` exists with `core-config.yaml` | Resume SDC: read `docs/stories/`, find active story, continue |
|
|
42
|
+
|
|
43
|
+
### Audit output (always presented to user before proceeding)
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Estado detectado: {maturity_level}
|
|
47
|
+
Já existe: {list of YES dimensions, e.g., "Brand (logo + brandbook), 1 PRD parcial em docs/, 5 componentes UI"}
|
|
48
|
+
Faltando: {list of NO dimensions critical to the user's request}
|
|
49
|
+
Recomendação: {workflow + concrete first step}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Anti-shortcuts (FORBIDDEN)
|
|
53
|
+
|
|
54
|
+
- Skipping the audit because "it looks empty" — always run, always check all 8 dimensions
|
|
55
|
+
- Calling a directory "greenfield" because `package.json` is missing (could have brand assets, half-written PRD, design tokens — all without `package.json`)
|
|
56
|
+
- Calling a directory "brownfield" only because `package.json` exists (could be just bootstrapped infra with zero feature work — different workflow)
|
|
57
|
+
- Overwriting existing partial work without listing it to the user first
|
|
58
|
+
- Ignoring `docs/epics/` and `docs/stories/` from a previous session
|
|
59
|
+
|
|
60
|
+
## Quick Tech Scan (BROWNFIELD, < 5 seconds)
|
|
61
|
+
|
|
62
|
+
When brownfield detected, silently check:
|
|
63
|
+
|
|
64
|
+
| Check | How | Sets Context |
|
|
65
|
+
|-------|-----|-------------|
|
|
66
|
+
| Framework | package.json dependencies | next/react/vue/angular/express |
|
|
67
|
+
| Language | tsconfig.json exists? | typescript/javascript |
|
|
68
|
+
| Database | supabase/, prisma/, .env | supabase/prisma/drizzle/none |
|
|
69
|
+
| Tests | jest.config, vitest.config | jest/vitest/none |
|
|
70
|
+
| CI | .github/workflows/ | github-actions/none |
|
|
71
|
+
|
|
72
|
+
Report to user in ONE line: "Projeto Next.js + TypeScript + Supabase detectado."
|
|
73
|
+
|
|
74
|
+
## Behavior Adaptation by State
|
|
75
|
+
|
|
76
|
+
### Greenfield Behavior
|
|
77
|
+
|
|
78
|
+
A bare `setup → story → implement` loop is **not enough** for greenfield. Large projects need upstream artifacts (project-brief, PRD, architecture, design spec) BEFORE stories. The greenfield branch sub-classifies the request and invokes the right workflow.
|
|
79
|
+
|
|
80
|
+
#### Step 1 — Sub-classify project_type
|
|
81
|
+
|
|
82
|
+
Detect intent and target from the user's first message (PT-BR or EN keywords):
|
|
83
|
+
|
|
84
|
+
| project_type | Triggers |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `site` | site, website, institucional, página, web page |
|
|
87
|
+
| `lp` | landing page, LP, captura, sales page, squeeze page |
|
|
88
|
+
| `app` | app mobile, ios, android, react native, flutter |
|
|
89
|
+
| `platform` | plataforma, dashboard, admin panel, portal interno |
|
|
90
|
+
| `saas` | SaaS, software as a service, app web com login, multi-tenant |
|
|
91
|
+
| `api` | API, backend, REST, GraphQL, microservice |
|
|
92
|
+
| `service` | worker, cron job, ETL, integration, automation |
|
|
93
|
+
|
|
94
|
+
If detection is ambiguous, ask ONE clarifying question with these options as choices.
|
|
95
|
+
|
|
96
|
+
#### Step 2 — Map to required workflow
|
|
97
|
+
|
|
98
|
+
| project_type | Workflow file | Phase 1 agents |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `site` / `lp` / `app` | `.sinapse-ai/development/workflows/greenfield-ui.yaml` | analyst → project-lead → ux-design-expert → architect → product-lead |
|
|
101
|
+
| `platform` / `saas` | `.sinapse-ai/development/workflows/greenfield-fullstack.yaml` | analyst → project-lead → ux-design-expert → architect → product-lead |
|
|
102
|
+
| `api` / `service` | `.sinapse-ai/development/workflows/greenfield-service.yaml` | analyst → project-lead → architect → product-lead |
|
|
103
|
+
|
|
104
|
+
Execution mechanism: `.sinapse-ai/core/orchestration/greenfield-handler.js` orchestrates Phase 0 (Bootstrap) → Phase 1 (Discovery 5-agent) → Phase 2 (Sharding) → Phase 3 (Dev Cycle).
|
|
105
|
+
|
|
106
|
+
#### Step 3 — Apply DS grounding (UI projects)
|
|
107
|
+
|
|
108
|
+
For `site` / `lp` / `app` / `platform` / `saas`, the DS Resolver runs before any visual output (see `~/.claude/rules/design-system-grounding.md`). Internal projects use the SINAPSE Brandbook; external clients use the client's brand or the high-quality fallback.
|
|
109
|
+
|
|
110
|
+
#### Step 4 — Forbidden shortcut
|
|
111
|
+
|
|
112
|
+
The greenfield branch NEVER skips to "implement" without:
|
|
113
|
+
- `docs/project-brief.md` validated
|
|
114
|
+
- `docs/prd.md` validated
|
|
115
|
+
- `docs/{front-end-spec | service-architecture}.md` validated
|
|
116
|
+
- `docs/architecture.md` (or `fullstack-architecture.md`) validated
|
|
117
|
+
- Stories in `docs/stories/` with status ≥ Ready
|
|
118
|
+
|
|
119
|
+
#### Auto-apply infra templates
|
|
120
|
+
|
|
121
|
+
Independent of project_type: PR template, CI, `.env.example`, CODEOWNERS, gitignore. These run during Phase 0 (Bootstrap) of the greenfield workflow.
|
|
122
|
+
|
|
123
|
+
### Continuation Behavior (PARTIAL maturity)
|
|
124
|
+
|
|
125
|
+
When the audit detects partial work — e.g., a brandbook without a site, a PRD without code, components without architecture, an abandoned epic — the framework MUST treat it as a continuation, not a bootstrap.
|
|
126
|
+
|
|
127
|
+
- **Inventory first:** list every existing artifact and tell the user what's there
|
|
128
|
+
- **Identify gaps:** what's missing to ship the user's stated goal?
|
|
129
|
+
- **Propose continuation plan:** which greenfield phase resumes from here? which brownfield steps apply?
|
|
130
|
+
- **Merge, never replace:** existing brand/DS/components are inputs to the workflow, not throwaway scaffolding
|
|
131
|
+
- **Preserve epic + story state:** if `docs/epics/` or `docs/stories/` exist, resume their lifecycle (Draft → Ready → InProgress → Done)
|
|
132
|
+
|
|
133
|
+
Example: user says "criar um site" but the audit finds a `brand/` folder with logo + brandbook. The framework reports:
|
|
134
|
+
> Estado: `PARTIAL`. Já existe: brand assets (logo + brandbook). Faltando: PRD, design spec, código. Recomendação: greenfield-ui.yaml começando da Phase 1, usando seu brandbook como input.
|
|
135
|
+
|
|
136
|
+
### Brownfield Behavior (MATURE maturity)
|
|
137
|
+
- Prioritize: understanding existing code before changing anything
|
|
138
|
+
- First action: read README, package.json, folder structure
|
|
139
|
+
- Workflow: quick scan → understand → then proceed with user request
|
|
140
|
+
- NEVER rewrite or refactor without understanding existing patterns
|
|
141
|
+
- Respect existing conventions (naming, folder structure, testing framework)
|
|
142
|
+
- For non-trivial changes: invoke Brownfield Discovery (10-phase technical debt assessment)
|
|
143
|
+
|
|
144
|
+
### SINAPSE-Managed Behavior
|
|
145
|
+
- Check for active story in docs/stories/
|
|
146
|
+
- Resume where last session left off
|
|
147
|
+
- Follow SDC workflow (story → implement → QA → push)
|
|
148
|
+
|
|
149
|
+
## Anti-Patterns (FORBIDDEN) — full list
|
|
150
|
+
|
|
151
|
+
- Asking user "is this a new or existing project?"
|
|
152
|
+
- Asking user to set `projectType` in config
|
|
153
|
+
- Starting implementation in brownfield without reading existing code first
|
|
154
|
+
- Applying greenfield templates to a brownfield project (overwriting existing CI/configs)
|
|
155
|
+
- Ignoring existing patterns and imposing SINAPSE conventions forcefully
|
|
156
|
+
- Treating greenfield as "setup → story → implement" without sub-classifying project_type
|
|
157
|
+
- Skipping `greenfield-handler.js` (or its workflow file) on a `site` / `lp` / `platform` / `saas` / `api` request
|
|
158
|
+
- Letting a domain orchestrator (design, brand) generate visual output before greenfield Phase 1 produces project-brief.md + prd.md + design spec
|
|
159
|
+
- Generating UI without DS grounding (see `~/.claude/rules/design-system-grounding.md`)
|
|
@@ -1,168 +1,50 @@
|
|
|
1
1
|
# Project Intelligence — Auto-Detection (NON-NEGOTIABLE)
|
|
2
2
|
|
|
3
3
|
> Applies to ALL agents, ALL sessions. Users NEVER configure project type manually.
|
|
4
|
+
> This is the always-on CORE (the law). The per-dimension signals, per-state
|
|
5
|
+
> behaviors (greenfield / continuation / brownfield / SINAPSE-managed) and examples
|
|
6
|
+
> live in `project-intelligence-reference.md` and load when you work on
|
|
7
|
+
> project-setup files.
|
|
4
8
|
|
|
5
|
-
## Initial State Audit (ALWAYS FIRST —
|
|
9
|
+
## Initial State Audit (ALWAYS FIRST — NON-NEGOTIABLE preflight)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
Before classifying anything, silently audit **8 dimensions** (existence + summary):
|
|
12
|
+
**Docs · Brand · Design system · Components · Code · Tests · Infra · Git history.**
|
|
13
|
+
Never skip it "because it looks empty" — partial work (brand without code, a
|
|
14
|
+
half-written PRD, abandoned epics) is exactly what the audit protects.
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
## Maturity Classification (from the 8 signals)
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| # | Dimension | Signals checked |
|
|
14
|
-
|---|---|---|
|
|
15
|
-
| 1 | **Docs** | `docs/project-brief.md`, `docs/prd.md`, `docs/architecture*.md`, `docs/front-end-spec.md`, `docs/epics/`, `docs/stories/` |
|
|
16
|
-
| 2 | **Brand** | `brand/`, `brandbook*`, `assets/brand/`, `public/brand/`, `*logo*`, `BRAND.md`, `BRANDBOOK.md` |
|
|
17
|
-
| 3 | **Design system** | `tokens.json`, `design-tokens.json`, `tailwind.config.*` with custom theme, `components/ui/`, `DESIGN.md`, `DS.md` |
|
|
18
|
-
| 4 | **Components** | `components/`, `src/components/`, `app/`, `pages/` with `.tsx` / `.jsx` / `.vue` files |
|
|
19
|
-
| 5 | **Code** | `package.json`, `tsconfig.json`, `src/`, language-specific markers (`go.mod`, `pyproject.toml`, `Cargo.toml`) |
|
|
20
|
-
| 6 | **Tests** | `jest.config.*`, `vitest.config.*`, `__tests__/`, `tests/`, `*.test.*`, `*.spec.*` |
|
|
21
|
-
| 7 | **Infra** | `.github/workflows/`, `Dockerfile`, `docker-compose.*`, `vercel.json`, `.env.example`, CI configs |
|
|
22
|
-
| 8 | **Git history** | `.git/` exists, `git log` has commits, recent activity (last 30 days), branch count |
|
|
23
|
-
|
|
24
|
-
### Maturity classification
|
|
25
|
-
|
|
26
|
-
Combining the 8 signals produces 1 of 5 maturity levels:
|
|
27
|
-
|
|
28
|
-
| Level | Criteria | Recommended workflow |
|
|
18
|
+
| Level | Meaning | Path |
|
|
29
19
|
|---|---|---|
|
|
30
|
-
| `EMPTY` | 0/8 signals
|
|
31
|
-
| `BOOTSTRAPPED` |
|
|
32
|
-
| `PARTIAL` |
|
|
33
|
-
| `MATURE` | Code + Tests + (Docs OR Infra)
|
|
34
|
-
| `SINAPSE_MANAGED` | `.sinapse-ai/`
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
| `EMPTY` | 0/8 signals | Full greenfield workflow |
|
|
21
|
+
| `BOOTSTRAPPED` | only Infra present | Greenfield from Phase 1 (skip Bootstrap) |
|
|
22
|
+
| `PARTIAL` | some Docs/Brand/DS without Code, or Code without Docs | **Continue** — never overwrite, merge with existing |
|
|
23
|
+
| `MATURE` | Code + Tests + (Docs OR Infra) | Brownfield Discovery before any change |
|
|
24
|
+
| `SINAPSE_MANAGED` | `.sinapse-ai/` + `core-config.yaml` | Resume SDC from active story |
|
|
25
|
+
|
|
26
|
+
**Audit output is always presented to the user before proceeding** (one structured
|
|
27
|
+
PT-BR paragraph: estado detectado · já existe · faltando · recomendação). Only
|
|
28
|
+
after this report does the framework classify + invoke workflows.
|
|
29
|
+
|
|
30
|
+
## The Law
|
|
31
|
+
|
|
32
|
+
- **Auto-detect, never ask** "is this a new or existing project?" or make the user
|
|
33
|
+
set `projectType`.
|
|
34
|
+
- **Brownfield:** understand existing code BEFORE changing anything; respect
|
|
35
|
+
existing conventions; never impose SINAPSE conventions forcefully.
|
|
36
|
+
- **Partial work is sacred:** inventory first, merge — never replace; preserve
|
|
37
|
+
epic/story state from previous sessions.
|
|
38
|
+
- **Greenfield is NOT "setup → story → implement":** sub-classify the project type
|
|
39
|
+
and run the required greenfield workflow with its upstream artifacts.
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
Estado detectado: {maturity_level}
|
|
42
|
-
Já existe: {list of YES dimensions, e.g., "Brand (logo + brandbook), 1 PRD parcial em docs/, 5 componentes UI"}
|
|
43
|
-
Faltando: {list of NO dimensions critical to the user's request}
|
|
44
|
-
Recomendação: {workflow + concrete first step}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Only AFTER this report (and any user adjustment) does the framework proceed to classification + workflow invocation.
|
|
48
|
-
|
|
49
|
-
### Anti-shortcuts (FORBIDDEN)
|
|
41
|
+
## Anti-Patterns (FORBIDDEN)
|
|
50
42
|
|
|
51
|
-
- Skipping the audit
|
|
52
|
-
- Calling a directory "greenfield" because `package.json` is missing (could have brand assets, half-written PRD, design tokens — all without `package.json`)
|
|
53
|
-
- Calling a directory "brownfield" only because `package.json` exists (could be just bootstrapped infra with zero feature work — different workflow)
|
|
43
|
+
- Skipping the audit; calling a directory greenfield/brownfield from one signal
|
|
54
44
|
- Overwriting existing partial work without listing it to the user first
|
|
55
45
|
- Ignoring `docs/epics/` and `docs/stories/` from a previous session
|
|
46
|
+
- Applying greenfield templates over an existing project's CI/configs
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
maturity == EMPTY → Full greenfield (see Greenfield Behavior below)
|
|
63
|
-
maturity == BOOTSTRAPPED → Greenfield Phase 1 onward (skip Bootstrap)
|
|
64
|
-
maturity == PARTIAL → Continuation Behavior (below)
|
|
65
|
-
maturity == MATURE → Brownfield Behavior (below)
|
|
66
|
-
maturity == SINAPSE_MANAGED → SINAPSE-Managed Behavior (below)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Quick Tech Scan (BROWNFIELD, < 5 seconds)
|
|
70
|
-
|
|
71
|
-
When brownfield detected, silently check:
|
|
72
|
-
|
|
73
|
-
| Check | How | Sets Context |
|
|
74
|
-
|-------|-----|-------------|
|
|
75
|
-
| Framework | package.json dependencies | next/react/vue/angular/express |
|
|
76
|
-
| Language | tsconfig.json exists? | typescript/javascript |
|
|
77
|
-
| Database | supabase/, prisma/, .env | supabase/prisma/drizzle/none |
|
|
78
|
-
| Tests | jest.config, vitest.config | jest/vitest/none |
|
|
79
|
-
| CI | .github/workflows/ | github-actions/none |
|
|
80
|
-
|
|
81
|
-
Report to user in ONE line: "Projeto Next.js + TypeScript + Supabase detectado."
|
|
82
|
-
|
|
83
|
-
## Behavior Adaptation by State
|
|
84
|
-
|
|
85
|
-
### Greenfield Behavior
|
|
86
|
-
|
|
87
|
-
A bare `setup → story → implement` loop is **not enough** for greenfield. Large projects need upstream artifacts (project-brief, PRD, architecture, design spec) BEFORE stories. The greenfield branch sub-classifies the request and invokes the right workflow.
|
|
88
|
-
|
|
89
|
-
#### Step 1 — Sub-classify project_type
|
|
90
|
-
|
|
91
|
-
Detect intent and target from the user's first message (PT-BR or EN keywords):
|
|
92
|
-
|
|
93
|
-
| project_type | Triggers |
|
|
94
|
-
|---|---|
|
|
95
|
-
| `site` | site, website, institucional, página, web page |
|
|
96
|
-
| `lp` | landing page, LP, captura, sales page, squeeze page |
|
|
97
|
-
| `app` | app mobile, ios, android, react native, flutter |
|
|
98
|
-
| `platform` | plataforma, dashboard, admin panel, portal interno |
|
|
99
|
-
| `saas` | SaaS, software as a service, app web com login, multi-tenant |
|
|
100
|
-
| `api` | API, backend, REST, GraphQL, microservice |
|
|
101
|
-
| `service` | worker, cron job, ETL, integration, automation |
|
|
102
|
-
|
|
103
|
-
If detection is ambiguous, ask ONE clarifying question with these options as choices.
|
|
104
|
-
|
|
105
|
-
#### Step 2 — Map to required workflow
|
|
106
|
-
|
|
107
|
-
| project_type | Workflow file | Phase 1 agents |
|
|
108
|
-
|---|---|---|
|
|
109
|
-
| `site` / `lp` / `app` | `.sinapse-ai/development/workflows/greenfield-ui.yaml` | analyst → project-lead → ux-design-expert → architect → product-lead |
|
|
110
|
-
| `platform` / `saas` | `.sinapse-ai/development/workflows/greenfield-fullstack.yaml` | analyst → project-lead → ux-design-expert → architect → product-lead |
|
|
111
|
-
| `api` / `service` | `.sinapse-ai/development/workflows/greenfield-service.yaml` | analyst → project-lead → architect → product-lead |
|
|
112
|
-
|
|
113
|
-
Execution mechanism: `.sinapse-ai/core/orchestration/greenfield-handler.js` orchestrates Phase 0 (Bootstrap) → Phase 1 (Discovery 5-agent) → Phase 2 (Sharding) → Phase 3 (Dev Cycle).
|
|
114
|
-
|
|
115
|
-
#### Step 3 — Apply DS grounding (UI projects)
|
|
116
|
-
|
|
117
|
-
For `site` / `lp` / `app` / `platform` / `saas`, the DS Resolver runs before any visual output (see `~/.claude/rules/design-system-grounding.md`). Internal projects use the SINAPSE Brandbook; external clients use the client's brand or the high-quality fallback.
|
|
118
|
-
|
|
119
|
-
#### Step 4 — Forbidden shortcut
|
|
120
|
-
|
|
121
|
-
The greenfield branch NEVER skips to "implement" without:
|
|
122
|
-
- `docs/project-brief.md` validated
|
|
123
|
-
- `docs/prd.md` validated
|
|
124
|
-
- `docs/{front-end-spec | service-architecture}.md` validated
|
|
125
|
-
- `docs/architecture.md` (or `fullstack-architecture.md`) validated
|
|
126
|
-
- Stories in `docs/stories/` with status ≥ Ready
|
|
127
|
-
|
|
128
|
-
#### Auto-apply infra templates
|
|
129
|
-
|
|
130
|
-
Independent of project_type: PR template, CI, `.env.example`, CODEOWNERS, gitignore. These run during Phase 0 (Bootstrap) of the greenfield workflow.
|
|
131
|
-
|
|
132
|
-
### Continuation Behavior (PARTIAL maturity)
|
|
133
|
-
|
|
134
|
-
When the audit detects partial work — e.g., a brandbook without a site, a PRD without code, components without architecture, an abandoned epic — the framework MUST treat it as a continuation, not a bootstrap.
|
|
135
|
-
|
|
136
|
-
- **Inventory first:** list every existing artifact and tell the user what's there
|
|
137
|
-
- **Identify gaps:** what's missing to ship the user's stated goal?
|
|
138
|
-
- **Propose continuation plan:** which greenfield phase resumes from here? which brownfield steps apply?
|
|
139
|
-
- **Merge, never replace:** existing brand/DS/components are inputs to the workflow, not throwaway scaffolding
|
|
140
|
-
- **Preserve epic + story state:** if `docs/epics/` or `docs/stories/` exist, resume their lifecycle (Draft → Ready → InProgress → Done)
|
|
141
|
-
|
|
142
|
-
Example: user says "criar um site" but the audit finds a `brand/` folder with logo + brandbook. The framework reports:
|
|
143
|
-
> Estado: `PARTIAL`. Já existe: brand assets (logo + brandbook). Faltando: PRD, design spec, código. Recomendação: greenfield-ui.yaml começando da Phase 1, usando seu brandbook como input.
|
|
144
|
-
|
|
145
|
-
### Brownfield Behavior (MATURE maturity)
|
|
146
|
-
- Prioritize: understanding existing code before changing anything
|
|
147
|
-
- First action: read README, package.json, folder structure
|
|
148
|
-
- Workflow: quick scan → understand → then proceed with user request
|
|
149
|
-
- NEVER rewrite or refactor without understanding existing patterns
|
|
150
|
-
- Respect existing conventions (naming, folder structure, testing framework)
|
|
151
|
-
- For non-trivial changes: invoke Brownfield Discovery (10-phase technical debt assessment)
|
|
152
|
-
|
|
153
|
-
### SINAPSE-Managed Behavior
|
|
154
|
-
- Check for active story in docs/stories/
|
|
155
|
-
- Resume where last session left off
|
|
156
|
-
- Follow SDC workflow (story → implement → QA → push)
|
|
157
|
-
|
|
158
|
-
## Anti-Patterns (FORBIDDEN)
|
|
159
|
-
|
|
160
|
-
- Asking user "is this a new or existing project?"
|
|
161
|
-
- Asking user to set `projectType` in config
|
|
162
|
-
- Starting implementation in brownfield without reading existing code first
|
|
163
|
-
- Applying greenfield templates to a brownfield project (overwriting existing CI/configs)
|
|
164
|
-
- Ignoring existing patterns and imposing SINAPSE conventions forcefully
|
|
165
|
-
- Treating greenfield as "setup → story → implement" without sub-classifying project_type
|
|
166
|
-
- Skipping `greenfield-handler.js` (or its workflow file) on a `site` / `lp` / `platform` / `saas` / `api` request
|
|
167
|
-
- Letting a domain orchestrator (design, brand) generate visual output before greenfield Phase 1 produces project-brief.md + prd.md + design spec
|
|
168
|
-
- Generating UI without DS grounding (see `~/.claude/rules/design-system-grounding.md`)
|
|
48
|
+
> **Detail (loads on setup work):** signals checked per dimension, quick tech scan
|
|
49
|
+
> table, per-state behaviors (greenfield steps 1-4, continuation, brownfield,
|
|
50
|
+
> SINAPSE-managed), examples — see `project-intelligence-reference.md`.
|