sinapse-ai 7.7.11 → 8.0.1

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 (112) hide show
  1. package/.claude/CLAUDE.md +10 -10
  2. package/.claude/rules/agent-authority.md +7 -7
  3. package/.claude/rules/agent-memory-imports.md +3 -1
  4. package/.claude/rules/coderabbit-integration.md +1 -0
  5. package/.claude/rules/mandatory-delegation.md +10 -10
  6. package/.claude/rules/mcp-usage.md +1 -1
  7. package/.claude/rules/security-data-protection.md +2 -2
  8. package/.claude/rules/security-scanning.md +10 -0
  9. package/.claude/rules/tool-response-filtering.md +1 -0
  10. package/.codex/agents/sinapse-orqx.md +4 -4
  11. package/.sinapse-ai/constitution.md +1 -1
  12. package/.sinapse-ai/data/entity-registry.yaml +826 -880
  13. package/.sinapse-ai/data/registry-update-log.jsonl +37 -0
  14. package/.sinapse-ai/data/rls-security-patterns.md +384 -0
  15. package/.sinapse-ai/data/sinapse-kb.md +1 -1
  16. package/.sinapse-ai/development/agents/analyst.md +2 -2
  17. package/.sinapse-ai/development/agents/product-lead/MEMORY.md +1 -1
  18. package/.sinapse-ai/development/agents/product-lead.md +4 -4
  19. package/.sinapse-ai/development/agents/project-lead.md +2 -2
  20. package/.sinapse-ai/development/agents/sinapse-orqx.md +4 -4
  21. package/.sinapse-ai/development/agents/sprint-lead.md +3 -3
  22. package/.sinapse-ai/development/tasks/analyze-project-structure.md +3 -3
  23. package/.sinapse-ai/development/tasks/create-service.md +1 -1
  24. package/.sinapse-ai/development/tasks/create-worktree.md +1 -1
  25. package/.sinapse-ai/development/tasks/environment-bootstrap.md +1 -1
  26. package/.sinapse-ai/development/tasks/execute-epic-plan.md +5 -5
  27. package/.sinapse-ai/development/tasks/extract-patterns.md +1 -1
  28. package/.sinapse-ai/development/tasks/ids-governor.md +1 -1
  29. package/.sinapse-ai/development/tasks/init-project-status.md +1 -1
  30. package/.sinapse-ai/development/tasks/list-worktrees.md +1 -1
  31. package/.sinapse-ai/development/tasks/next.md +1 -1
  32. package/.sinapse-ai/development/tasks/patterns.md +1 -1
  33. package/.sinapse-ai/development/tasks/plan-create-context.md +1 -1
  34. package/.sinapse-ai/development/tasks/plan-create-implementation.md +1 -1
  35. package/.sinapse-ai/development/tasks/plan-execute-subtask.md +1 -1
  36. package/.sinapse-ai/development/tasks/qa-fix-issues.md +1 -1
  37. package/.sinapse-ai/development/tasks/remove-worktree.md +1 -1
  38. package/.sinapse-ai/development/tasks/setup-github.md +1 -1
  39. package/.sinapse-ai/development/tasks/setup-llm-routing.md +1 -1
  40. package/.sinapse-ai/development/tasks/setup-mcp-docker.md +1 -1
  41. package/.sinapse-ai/development/tasks/spec-assess-complexity.md +1 -1
  42. package/.sinapse-ai/development/tasks/spec-critique.md +1 -1
  43. package/.sinapse-ai/development/tasks/spec-gather-requirements.md +1 -1
  44. package/.sinapse-ai/development/tasks/spec-research-dependencies.md +1 -1
  45. package/.sinapse-ai/development/tasks/spec-write-spec.md +1 -1
  46. package/.sinapse-ai/development/tasks/story-checkpoint.md +1 -1
  47. package/.sinapse-ai/development/tasks/update-sinapse.md +1 -1
  48. package/.sinapse-ai/development/tasks/validate-tech-preset.md +1 -1
  49. package/.sinapse-ai/development/tasks/verify-subtask.md +1 -1
  50. package/.sinapse-ai/infrastructure/scripts/validate-codex-delegation.js +1 -1
  51. package/.sinapse-ai/install-manifest.yaml +79 -75
  52. package/README.en.md +1 -1
  53. package/README.md +342 -216
  54. package/bin/utils/staged-secret-scan.js +5 -0
  55. package/docs/architecture-overview.md +239 -0
  56. package/docs/community.md +2 -2
  57. package/docs/feature-process.md +162 -0
  58. package/docs/getting-started.md +115 -231
  59. package/docs/guides/agent-reference.md +203 -0
  60. package/docs/guides/{MEMORY-INTEGRATION.md → memory-integration.md} +2 -2
  61. package/docs/guides/{MEMORY-INTELLIGENCE-SYSTEM.md → memory-intelligence-system.md} +3 -3
  62. package/docs/guides/workflows-overview.md +282 -0
  63. package/docs/guiding-principles.md +188 -0
  64. package/docs/legal/license-clarification.md +120 -15
  65. package/docs/legal/privacy.md +93 -80
  66. package/docs/legal/terms.md +90 -103
  67. package/docs/{ORQX-PLAN.md → orqx-plan.md} +15 -15
  68. package/docs/pt/FEATURE_PROCESS.md +2 -2
  69. package/docs/pt/GUIDING-PRINCIPLES.md +2 -2
  70. package/docs/pt/community.md +2 -2
  71. package/docs/pt/roadmap.md +2 -2
  72. package/docs/pt/security.md +215 -79
  73. package/docs/roadmap.md +2 -2
  74. package/docs/security/{PR_SECURITY_CHECKLIST.md → pr-security-checklist.md} +1 -1
  75. package/docs/security.md +215 -79
  76. package/package.json +1 -1
  77. package/packages/installer/src/manifest-signature.js +194 -0
  78. package/sinapse/agents/sinapse-orqx.md +4 -4
  79. package/squads/claude-code-mastery/agents/config-engineer.md +7 -7
  80. package/squads/claude-code-mastery/agents/hooks-architect.md +4 -4
  81. package/squads/claude-code-mastery/agents/mcp-integrator.md +6 -6
  82. package/squads/claude-code-mastery/agents/project-integrator.md +8 -8
  83. package/squads/claude-code-mastery/agents/roadmap-sentinel.md +7 -7
  84. package/squads/claude-code-mastery/agents/skill-craftsman.md +10 -10
  85. package/squads/claude-code-mastery/agents/swarm-orqx.md +4 -4
  86. package/squads/squad-animations/README.md +96 -0
  87. package/squads/squad-brand/agents/brand-creative-engineer.md +1 -1
  88. package/squads/squad-brand/agents/brand-motion-vfx.md +1 -1
  89. package/squads/squad-brand/agents/brand-sonic-designer.md +1 -1
  90. package/squads/squad-brand/agents/brand-system-architect.md +2 -2
  91. package/squads/squad-claude/README.md +84 -0
  92. package/squads/squad-cloning/README.md +86 -0
  93. package/squads/squad-commercial/README.md +89 -0
  94. package/squads/squad-content/README.md +97 -0
  95. package/squads/squad-copy/README.md +100 -0
  96. package/squads/squad-council/README.md +88 -0
  97. package/squads/squad-courses/README.md +95 -0
  98. package/squads/squad-cybersecurity/README.md +88 -0
  99. package/squads/squad-design/README.md +96 -0
  100. package/squads/squad-finance/README.md +80 -0
  101. package/squads/squad-growth/README.md +94 -0
  102. package/squads/squad-paidmedia/README.md +96 -0
  103. package/squads/squad-product/README.md +93 -0
  104. package/squads/squad-research/README.md +97 -0
  105. package/squads/squad-storytelling/README.md +96 -0
  106. package/docs/FEATURE_PROCESS.md +0 -93
  107. package/docs/GUIDING-PRINCIPLES.md +0 -95
  108. /package/docs/{CHANGELOG.md → changelog.md} +0 -0
  109. /package/docs/guides/{IDS-CONCEITOS-EXPLICADOS.md → ids-conceitos-explicados.md} +0 -0
  110. /package/docs/guides/{MEMORY-SYSTEM.md → memory-system.md} +0 -0
  111. /package/docs/security/{MANIFEST_SIGNING.md → manifest-signing.md} +0 -0
  112. /package/docs/{SQUAD-COMMANDS-REFERENCE.md → squad-commands-reference.md} +0 -0
package/docs/security.md CHANGED
@@ -1,124 +1,260 @@
1
- # Security Policy
1
+ # SINAPSE-AI Security Guide
2
2
 
3
- > 🇧🇷 [Versão em Português](SECURITY-PT.md)
3
+ > For vulnerability reporting, see [SECURITY.md](../SECURITY.md)
4
4
 
5
- ## Supported Versions
5
+ ---
6
6
 
7
- We release patches for security vulnerabilities in the following versions:
7
+ ## Table of Contents
8
8
 
9
- | Version | Supported |
10
- | ------- | ------------------ |
11
- | 2.1.x | :white_check_mark: |
12
- | < 2.1 | :x: |
9
+ 1. [Security Architecture Overview](#security-architecture-overview)
10
+ 2. [Secret Management](#secret-management)
11
+ 3. [MCP Server Trust Model](#mcp-server-trust-model)
12
+ 4. [Agent Security Boundaries](#agent-security-boundaries)
13
+ 5. [Hook Architecture](#hook-architecture)
14
+ 6. [Best Practices for Users](#best-practices-for-users)
15
+ 7. [Constitutional Enforcement](#constitutional-enforcement)
13
16
 
14
- ## Reporting a Vulnerability
17
+ ---
15
18
 
16
- We take security seriously at SinapseAI. If you discover a security vulnerability in SINAPSE, please report it responsibly.
19
+ ## Security Architecture Overview
20
+
21
+ SINAPSE-AI implements a defense-in-depth security model with multiple enforcement layers:
22
+
23
+ ```
24
+ Constitution (Article X)
25
+ |
26
+ +-- 25 Pre-Deploy Blockers (3 tiers)
27
+ | +-- Tier 1: Absolute Blockers (deploy impossible)
28
+ | +-- Tier 2: Compliance Blockers (LGPD)
29
+ | +-- Tier 3: Operational Blockers
30
+ |
31
+ +-- 19 Claude Code Hooks (real-time enforcement)
32
+ | +-- Secret scanning
33
+ | +-- SQL governance
34
+ | +-- Architecture-first gates
35
+ | +-- Push authority control
36
+ |
37
+ +-- Quality Gates (pre-commit, PR, human review)
38
+ ```
39
+
40
+ Security is not optional in SINAPSE-AI. It is enforced at the constitutional level (Article X -- NON-NEGOTIABLE) and automated through hooks and gates that block violations before they reach production.
17
41
 
18
- ### How to Report
42
+ ---
19
43
 
20
- **DO NOT** create a public GitHub issue for security vulnerabilities.
44
+ ## Secret Management
21
45
 
22
- Instead, please report security vulnerabilities through one of these channels:
46
+ ### How SINAPSE-AI Handles Secrets
23
47
 
24
- 1. **GitHub Security Advisories** (Preferred)
25
- - Go to [Security Advisories](https://github.com/SinapseAI/sinapse-ai/security/advisories)
26
- - Click "Report a vulnerability"
27
- - Fill out the form with details
48
+ SINAPSE-AI uses a hook-based secret scanning system that runs on every file write and commit operation.
28
49
 
29
- 2. **GitHub Issues (Private)**
30
- - Open a [private security advisory](https://github.com/SinapseAI/sinapse-ai/security/advisories)
31
- - Use subject line: `[SECURITY] Brief description`
50
+ **Active hook:** `secret-scanning.cjs`
32
51
 
33
- ### What to Include
52
+ **Scanned patterns include:**
53
+ - AWS access keys and secret keys
54
+ - Stripe API keys (live and test)
55
+ - SSH private keys (RSA, ED25519, ECDSA)
56
+ - GitHub tokens (personal, OAuth, app)
57
+ - Google API keys and OAuth credentials
58
+ - Slack tokens and webhooks
59
+ - Database connection strings with embedded credentials
60
+ - JWT tokens and Bearer tokens
61
+ - Generic high-entropy strings matching key patterns
34
62
 
35
- Please include the following in your report:
63
+ **Behavior on detection:**
64
+ - The commit is **blocked** immediately
65
+ - The agent is notified with the specific file and pattern match
66
+ - The file is removed from staging
67
+ - The user is warned to rotate the detected credential
36
68
 
37
- - **Description**: A clear description of the vulnerability
38
- - **Impact**: What could an attacker achieve with this vulnerability?
39
- - **Steps to Reproduce**: Detailed steps to reproduce the issue
40
- - **Affected Versions**: Which versions are affected?
41
- - **Possible Fix**: If you have suggestions for how to fix the issue
42
- - **Your Information**: Name/handle for acknowledgment (optional)
69
+ ### Environment Variable Rules
43
70
 
44
- ### What to Expect
71
+ | Rule | Enforcement |
72
+ |------|-------------|
73
+ | `.env` files must be in `.gitignore` | Hook blocks commits containing `.env` |
74
+ | `.env.example` must use placeholders | Manual review during QA gate |
75
+ | `NEXT_PUBLIC_*` variables are public | Never put secrets in `NEXT_PUBLIC_*` |
76
+ | `service_role` keys never in frontend | Hook scans `src/`, `app/`, `pages/` directories |
45
77
 
46
- 1. **Acknowledgment**: We will acknowledge receipt within 48 hours
47
- 2. **Initial Assessment**: We will provide an initial assessment within 5 business days
48
- 3. **Updates**: We will keep you informed of our progress
49
- 4. **Resolution**: We aim to resolve critical issues within 30 days
50
- 5. **Disclosure**: We will coordinate disclosure timing with you
78
+ ---
51
79
 
52
- ### Safe Harbor
80
+ ## MCP Server Trust Model
53
81
 
54
- We consider security research conducted in accordance with this policy to be:
82
+ SINAPSE-AI uses a tiered approach to MCP (Model Context Protocol) server trust:
55
83
 
56
- - Authorized concerning any applicable anti-hacking laws
57
- - Authorized concerning any relevant anti-circumvention laws
58
- - Exempt from restrictions in our Terms of Service that would interfere with conducting security research
84
+ ### Docker Isolation
59
85
 
60
- We will not pursue civil action or initiate a complaint to law enforcement for accidental, good faith violations of this policy.
86
+ MCP servers that require authentication or access external services run inside Docker containers via Docker MCP Toolkit. This provides:
61
87
 
62
- ## Security Best Practices
88
+ - **Process isolation:** MCP servers cannot access the host filesystem directly
89
+ - **Network segmentation:** Each container has its own network namespace
90
+ - **Credential isolation:** API keys are injected via Docker environment variables, not stored in project files
63
91
 
64
- When using SINAPSE Framework, we recommend:
92
+ ### Native Tool Preference
65
93
 
66
- ### Environment Variables
94
+ SINAPSE-AI always prefers native Claude Code tools over MCP equivalents:
67
95
 
68
- - Never commit `.env` files to version control
69
- - Use `.env.example` as a template without real values
70
- - Rotate API keys and secrets regularly
96
+ | Task | Preferred Tool | Why |
97
+ |------|---------------|-----|
98
+ | File read/write | Read, Write, Edit | Runs locally, no network |
99
+ | Search | Grep, Glob | Faster, no external calls |
100
+ | Commands | Bash | Direct host execution |
71
101
 
72
- ### MCP Server Security
102
+ MCP servers are only used when native tools cannot provide the required capability (web search, browser automation, external API access).
73
103
 
74
- - Only enable MCP servers from trusted sources
75
- - Review MCP server code before enabling
76
- - Use sandboxed execution environments when available
77
- - Limit MCP server permissions to minimum required
104
+ ### MCP Governance
78
105
 
79
- ### AI Agent Security
106
+ Only the DevOps agent (`@devops` / Pipeline) has authority to:
107
+ - Add or remove MCP servers
108
+ - Configure MCP credentials
109
+ - Manage Docker MCP infrastructure
110
+
111
+ Other agents are consumers only -- they cannot modify MCP configuration.
112
+
113
+ ---
80
114
 
81
- - Be cautious with agent commands that execute system operations
82
- - Review generated code before execution in production
83
- - Use appropriate access controls for sensitive operations
115
+ ## Agent Security Boundaries
84
116
 
85
- ### Dependency Management
117
+ ### Framework Protection Layers (L1-L4)
86
118
 
87
- - Keep dependencies up to date
88
- - Run `npm audit` regularly
89
- - Review dependency changes in pull requests
119
+ SINAPSE-AI enforces a 4-layer boundary model that controls what agents can and cannot modify:
90
120
 
91
- ## Known Security Considerations
121
+ | Layer | Protection | What It Contains |
122
+ |-------|-----------|-----------------|
123
+ | **L1** Framework Core | NEVER modify | Core modules, Constitution, CLI binaries |
124
+ | **L2** Framework Templates | NEVER modify | Tasks, templates, checklists, workflows |
125
+ | **L3** Project Config | Controlled | Data files, agent memory, config |
126
+ | **L4** Project Runtime | Open | Stories, packages, tests |
92
127
 
93
- ### Framework Architecture
128
+ These boundaries are enforced deterministically through deny rules in `.claude/settings.json`, not through agent honor system.
94
129
 
95
- SINAPSE Framework executes AI-generated code and commands. Users should:
130
+ ### Agent Authority Matrix
96
131
 
97
- - Understand that AI agents can execute arbitrary code
98
- - Use appropriate sandboxing for untrusted environments
99
- - Review AI-generated output before production deployment
132
+ Each agent has explicit permissions defining what operations it can perform:
133
+
134
+ | Agent | Can Do | Cannot Do |
135
+ |-------|--------|-----------|
136
+ | `@developer` | Write code, commit locally | Push to remote, create PRs |
137
+ | `@devops` | Push, create PRs, manage CI | Write application code |
138
+ | `@architect` | Design decisions | Write implementation code |
139
+ | `@data-engineer` | Schema design, migrations | Application code, git push |
140
+
141
+ The `enforce-delegation.cjs` hook blocks orchestrator agents from executing domain work directly, enforcing the delegation matrix at runtime.
142
+
143
+ ### Git Push Authority
144
+
145
+ Only `@devops` (Pipeline) can execute `git push`. The `enforce-git-push-authority.sh` hook intercepts all Bash commands and blocks any push attempt from other agents.
146
+
147
+ ---
100
148
 
101
- ### Data Handling
149
+ ## Hook Architecture
102
150
 
103
- - SINAPSE may process sensitive data through AI providers
104
- - Review your AI provider's data handling policies
105
- - Consider data classification when using AI features
151
+ SINAPSE-AI uses 19 Claude Code hooks organized by trigger event:
106
152
 
107
- ## Security Updates
153
+ ### Hook Event Map
108
154
 
109
- Security updates are announced through:
155
+ | Event | Hook | Purpose | Behavior |
156
+ |-------|------|---------|----------|
157
+ | **UserPromptSubmit** | `synapse-wrapper.cjs` | Context injection | Allow |
158
+ | **PreToolUse (Bash)** | `enforce-git-push-authority.sh` | Block unauthorized push | Block |
159
+ | **PreToolUse (Bash)** | `sql-governance.py` | Block dangerous SQL | Block |
160
+ | **PreToolUse (Bash)** | `enforce-delegation.cjs` | Block direct orchestrator work | Block |
161
+ | **PreToolUse (Write/Edit)** | `enforce-architecture-first.cjs` | Require docs before code | Block |
162
+ | **PreToolUse (Write/Edit)** | `write-path-validation.cjs` | Warn on wrong paths | Warn |
163
+ | **PreToolUse (Write/Edit)** | `enforce-story-gate.cjs` | Require story for code | Block |
164
+ | **PreToolUse (Write/Edit)** | `slug-validation.py` | Validate naming | Warn |
165
+ | **PreToolUse (Write/Edit)** | `mind-clone-governance.py` | Require DNA for clones | Block |
166
+ | **PreToolUse (Write/Edit)** | `enforce-delegation.cjs` | Block direct orchestrator work | Block |
167
+ | **PreToolUse (Read)** | `read-protection.py` | Control sensitive file access | Warn |
168
+ | **PreCompact** | `precompact-wrapper.cjs` | Session digest capture | Allow |
110
169
 
111
- - [GitHub Security Advisories](https://github.com/SinapseAI/sinapse-ai/security/advisories)
112
- - [CHANGELOG.md](./CHANGELOG.md)
113
- - GitHub Releases
170
+ ### Design Principles
114
171
 
115
- ## Acknowledgments
172
+ 1. **Fail-open** -- If a hook crashes or cannot parse input, it exits with code 0 (allow). This prevents hook bugs from blocking all development.
173
+ 2. **Fast** -- Each hook must complete in under 5 seconds.
174
+ 3. **Silent on success** -- Hooks only produce output when blocking or warning.
175
+ 4. **Deterministic** -- Same input always produces the same output.
176
+ 5. **No side effects** -- Hooks read state but do not modify it.
116
177
 
117
- We thank the following researchers for responsibly disclosing security issues:
178
+ ### Exit Code Protocol
179
+
180
+ | Code | Meaning | Effect |
181
+ |------|---------|--------|
182
+ | 0 | Allow | Operation proceeds normally |
183
+ | 2 | Block | Operation denied, message shown |
184
+ | Other | Ignored | Treated as 0 (allow) |
185
+
186
+ ---
187
+
188
+ ## Best Practices for Users
189
+
190
+ ### After Installing SINAPSE-AI
191
+
192
+ 1. **Verify hook installation**: Run `npx sinapse-ai doctor` to confirm all hooks are registered
193
+ 2. **Check `.gitignore`**: Ensure `.env`, `.sinapse/`, and other sensitive paths are listed
194
+ 3. **Review MCP servers**: Only enable MCP servers you trust and need
195
+ 4. **Set up branch protection**: Enable branch protection on `main` in GitHub settings
196
+
197
+ ### During Development
198
+
199
+ 1. **Never commit `.env` files** -- Use `.env.example` with placeholder values
200
+ 2. **Use parameterized queries** -- Never use string interpolation for SQL
201
+ 3. **Review generated code** -- AI-generated code should be reviewed before production
202
+ 4. **Keep dependencies updated** -- Run `npm audit` regularly
203
+ 5. **Use feature branches** -- SINAPSE-AI automatically creates branches and never works on `main`
204
+
205
+ ### For Production Deployments
206
+
207
+ 1. **Enable RLS on all tables** with user data (see [RLS Patterns](../.sinapse-ai/data/rls-security-patterns.md))
208
+ 2. **Never expose `service_role`** keys in frontend code
209
+ 3. **Configure CORS** with explicit origins (never use `origin: '*'` in production)
210
+ 4. **Add rate limiting** to all public API endpoints
211
+ 5. **Set up security headers** using helmet or equivalent middleware
212
+
213
+ ---
118
214
 
119
- *No reports yet - be the first!*
215
+ ## Constitutional Enforcement
216
+
217
+ SINAPSE-AI's Constitution (Article X -- Security and Data Protection) defines 25 mandatory pre-deploy blockers:
218
+
219
+ ### Tier 1: Absolute Blockers (10 items)
220
+
221
+ These make deployment impossible if violated:
222
+ - Tables without RLS enabled
223
+ - Hardcoded API keys in source code
224
+ - `service_role` exposed in frontend
225
+ - Missing MFA on admin accounts
226
+ - APIs without authentication
227
+ - SQL with string concatenation
228
+ - Critical/high dependency vulnerabilities
229
+ - Secrets detected in codebase
230
+ - Default credentials in production
231
+ - Missing TLS encryption
232
+
233
+ ### Tier 2: Compliance Blockers (7 items)
234
+
235
+ These make deployment illegal in Brazil (LGPD):
236
+ - Missing DPO/Data Protection Officer
237
+ - No breach notification capability
238
+ - Missing consent mechanism
239
+ - No data subject rights portal
240
+ - International transfer without SCCs
241
+ - Children's data without parental consent
242
+ - Missing published privacy policy
243
+
244
+ ### Tier 3: Operational Blockers (8 items)
245
+
246
+ These make deployment irresponsible:
247
+ - No asset inventory
248
+ - No centralized logging
249
+ - No incident response plan
250
+ - No backup verification
251
+ - No vulnerability scanning
252
+ - No network segmentation
253
+ - No vendor security assessment
254
+ - No SSL enforcement on database
255
+
256
+ For the complete checklist and implementation details, see the Constitution at `.sinapse-ai/constitution.md`.
120
257
 
121
258
  ---
122
259
 
123
- *This security policy is effective as of December 2024.*
124
- *Last updated: 2025-12-11*
260
+ *Last updated: 2026-04-03*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinapse-ai",
3
- "version": "7.7.11",
3
+ "version": "8.0.1",
4
4
  "description": "SINAPSE AI: Framework de orquestracao de IA — 18 squads, 175 agentes especializados",
5
5
  "bin": {
6
6
  "sinapse": "bin/sinapse.js",
@@ -0,0 +1,194 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const yaml = require('js-yaml');
7
+
8
+ // Maximum limits to prevent DoS
9
+ const MAX_MANIFEST_SIZE = 10 * 1024 * 1024; // 10MB
10
+ const MAX_FILE_COUNT = 50000;
11
+ const MAX_DIR_DEPTH = 50;
12
+
13
+ /**
14
+ * Validates manifest content for security before YAML parsing.
15
+ * @param {string} rawContent - Raw file content
16
+ * @returns {{ valid: boolean, reason?: string }}
17
+ */
18
+ function validateManifestSecurity(rawContent) {
19
+ // Size check
20
+ if (Buffer.byteLength(rawContent, 'utf8') > MAX_MANIFEST_SIZE) {
21
+ return { valid: false, reason: `Manifest exceeds ${MAX_MANIFEST_SIZE} bytes` };
22
+ }
23
+
24
+ // Null byte check
25
+ if (rawContent.includes('\x00')) {
26
+ return { valid: false, reason: 'Manifest contains null bytes' };
27
+ }
28
+
29
+ return { valid: true };
30
+ }
31
+
32
+ /**
33
+ * Validates paths in parsed manifest for traversal attacks.
34
+ * @param {object} manifest - Parsed YAML manifest
35
+ * @returns {{ valid: boolean, issues: string[] }}
36
+ */
37
+ function validateManifestPaths(manifest) {
38
+ const issues = [];
39
+ let fileCount = 0;
40
+
41
+ function checkPath(filePath, context) {
42
+ fileCount++;
43
+ if (fileCount > MAX_FILE_COUNT) {
44
+ issues.push(`File count exceeds ${MAX_FILE_COUNT}`);
45
+ return;
46
+ }
47
+
48
+ // Path traversal
49
+ if (filePath.includes('..')) {
50
+ issues.push(`Path traversal detected in ${context}: ${filePath}`);
51
+ }
52
+
53
+ // Absolute paths
54
+ if (path.isAbsolute(filePath)) {
55
+ issues.push(`Absolute path in ${context}: ${filePath}`);
56
+ }
57
+
58
+ // Windows ADS
59
+ if (filePath.includes(':') && !filePath.match(/^[a-zA-Z]:/)) {
60
+ issues.push(`Possible ADS in ${context}: ${filePath}`);
61
+ }
62
+
63
+ // Depth check
64
+ const depth = filePath.split(/[/\\]/).length;
65
+ if (depth > MAX_DIR_DEPTH) {
66
+ issues.push(`Path depth ${depth} exceeds ${MAX_DIR_DEPTH} in ${context}`);
67
+ }
68
+ }
69
+
70
+ // Walk manifest structure looking for file paths
71
+ function walk(obj, prefix) {
72
+ if (!obj || typeof obj !== 'object') return;
73
+ for (const [key, value] of Object.entries(obj)) {
74
+ const ctx = prefix ? `${prefix}.${key}` : key;
75
+ if (typeof value === 'string' && (value.includes('/') || value.includes('\\'))) {
76
+ checkPath(value, ctx);
77
+ } else if (typeof value === 'object') {
78
+ walk(value, ctx);
79
+ }
80
+ }
81
+ }
82
+
83
+ walk(manifest, '');
84
+ return { valid: issues.length === 0, issues };
85
+ }
86
+
87
+ /**
88
+ * Generates Ed25519 keypair for signing.
89
+ * @returns {{ publicKey: string, privateKey: string }} Base64-encoded keys
90
+ */
91
+ function generateKeyPair() {
92
+ const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519', {
93
+ publicKeyEncoding: { type: 'spki', format: 'der' },
94
+ privateKeyEncoding: { type: 'pkcs8', format: 'der' },
95
+ });
96
+ return {
97
+ publicKey: publicKey.toString('base64'),
98
+ privateKey: privateKey.toString('base64'),
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Signs manifest content with Ed25519 private key.
104
+ * @param {string} content - Raw manifest content
105
+ * @param {string} privateKeyBase64 - Base64-encoded private key (DER PKCS8)
106
+ * @returns {string} Base64-encoded signature
107
+ */
108
+ function signManifest(content, privateKeyBase64) {
109
+ const privateKey = crypto.createPrivateKey({
110
+ key: Buffer.from(privateKeyBase64, 'base64'),
111
+ format: 'der',
112
+ type: 'pkcs8',
113
+ });
114
+ const signature = crypto.sign(null, Buffer.from(content, 'utf8'), privateKey);
115
+ return signature.toString('base64');
116
+ }
117
+
118
+ /**
119
+ * Verifies manifest signature with Ed25519 public key.
120
+ * @param {string} content - Raw manifest content
121
+ * @param {string} signatureBase64 - Base64-encoded signature
122
+ * @param {string} publicKeyBase64 - Base64-encoded public key (DER SPKI)
123
+ * @returns {boolean}
124
+ */
125
+ function verifyManifest(content, signatureBase64, publicKeyBase64) {
126
+ try {
127
+ const publicKey = crypto.createPublicKey({
128
+ key: Buffer.from(publicKeyBase64, 'base64'),
129
+ format: 'der',
130
+ type: 'spki',
131
+ });
132
+ return crypto.verify(
133
+ null,
134
+ Buffer.from(content, 'utf8'),
135
+ publicKey,
136
+ Buffer.from(signatureBase64, 'base64'),
137
+ );
138
+ } catch {
139
+ return false;
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Loads and validates a manifest file securely.
145
+ * @param {string} manifestPath - Path to manifest YAML
146
+ * @param {string} [signatureBase64] - Optional signature to verify
147
+ * @param {string} [publicKeyBase64] - Optional public key for verification
148
+ * @returns {{ manifest: object, security: object }}
149
+ */
150
+ function loadManifestSecure(manifestPath, signatureBase64, publicKeyBase64) {
151
+ const rawContent = fs.readFileSync(manifestPath, 'utf8');
152
+
153
+ // Step 1: Pre-parse security validation
154
+ const preCheck = validateManifestSecurity(rawContent);
155
+ if (!preCheck.valid) {
156
+ throw new Error(`Manifest security check failed: ${preCheck.reason}`);
157
+ }
158
+
159
+ // Step 2: Verify signature BEFORE parsing YAML (if provided)
160
+ let signatureValid = null;
161
+ if (signatureBase64 && publicKeyBase64) {
162
+ signatureValid = verifyManifest(rawContent, signatureBase64, publicKeyBase64);
163
+ if (!signatureValid) {
164
+ throw new Error('Manifest signature verification FAILED — possible tampering');
165
+ }
166
+ }
167
+
168
+ // Step 3: Parse YAML with FAILSAFE schema (no code execution)
169
+ const manifest = yaml.load(rawContent, { schema: yaml.FAILSAFE_SCHEMA });
170
+
171
+ // Step 4: Validate paths in parsed manifest
172
+ const pathCheck = validateManifestPaths(manifest);
173
+
174
+ return {
175
+ manifest,
176
+ security: {
177
+ sizeBytes: Buffer.byteLength(rawContent, 'utf8'),
178
+ signatureVerified: signatureValid,
179
+ pathValidation: pathCheck,
180
+ },
181
+ };
182
+ }
183
+
184
+ module.exports = {
185
+ generateKeyPair,
186
+ signManifest,
187
+ verifyManifest,
188
+ validateManifestSecurity,
189
+ validateManifestPaths,
190
+ loadManifestSecure,
191
+ MAX_MANIFEST_SIZE,
192
+ MAX_FILE_COUNT,
193
+ MAX_DIR_DEPTH,
194
+ };
@@ -1,6 +1,6 @@
1
1
  # Agent: Imperator — Sinapse Master
2
2
 
3
- > ACTIVATION-NOTICE: You are now Imperator — the supreme orchestrator of the SINAPSE ecosystem. You have authority over all 18 specialized squads (175 agents total). You do not execute domain work yourself — you diagnose, route, coordinate, and synthesize across the entire ecosystem. Every request passes through you first. You are the CEO of this AI workforce.
3
+ > ACTIVATION-NOTICE: You are now Imperator — the supreme orchestrator of the SINAPSE ecosystem. You have authority over all 18 specialized squads (186 agents total). You do not execute domain work yourself — you diagnose, route, coordinate, and synthesize across the entire ecosystem. Every request passes through you first. You are the CEO of this AI workforce.
4
4
 
5
5
  ## ACTIVATION INSTRUCTIONS — MANDATORY ON LOAD
6
6
 
@@ -25,7 +25,7 @@ Then display:
25
25
 
26
26
  ```
27
27
  AI Agent Squads for Claude Code
28
- 18 squads · 175 agents · 1,370 tasks
28
+ 18 squads · 186 agents · 1,430 tasks
29
29
 
30
30
  👑 Imperator — Sinapse Master activated
31
31
 
@@ -111,7 +111,7 @@ agent:
111
111
  whenToUse: "ALWAYS as the default agent. Imperator is the first point of contact for EVERY request. Routes directly to @specialist when clear, or to @{domain}-orqx when complex."
112
112
 
113
113
  persona:
114
- role: "Supreme Orchestrator of all 18 SINAPSE Squads (175 agents)"
114
+ role: "Supreme Orchestrator of all 18 SINAPSE Squads (186 agents)"
115
115
  identity: >
116
116
  The strategic mind at the top of the SINAPSE hierarchy. Imperator
117
117
  sees across all domains — branding, commerce, content, copy, animations,
@@ -664,7 +664,7 @@ Imperator can provide ecosystem-wide insights by combining capabilities across s
664
664
  | 17 | courses | courses | Syllabus | Course creation, workshops, ebooks |
665
665
  | 18 | claude-code-mastery | claude | Nucleus | Claude Code mastery, prompt engineering |
666
666
 
667
- **Total ecosystem:** 18 squads, 175 agents, 1,370 tasks
667
+ **Total ecosystem:** 18 squads, 186 agents, 1,430 tasks
668
668
 
669
669
  ## Cross-Squad Handoffs
670
670
  - **Receives from:** Every squad (escalations, cross-squad requests)
@@ -705,13 +705,13 @@ Type `*help` to see all commands, or `*guide` for comprehensive usage instructio
705
705
 
706
706
  **I collaborate with:**
707
707
 
708
- - **@devops (Gage):** For MCP server management and CI/CD pipeline configuration
709
- - **@architect (Aria):** For system architecture decisions that inform configuration boundaries
710
- - **@developer (Dex):** Receives optimized settings for development workflow efficiency
708
+ - **@devops (Pipeline):** For MCP server management and CI/CD pipeline configuration
709
+ - **@architect (Stratum):** For system architecture decisions that inform configuration boundaries
710
+ - **@developer (Pixel):** Receives optimized settings for development workflow efficiency
711
711
 
712
712
  **I delegate to:**
713
713
 
714
- - **@devops (Gage):** For applying managed-settings.json to infrastructure and MCP administration
714
+ - **@devops (Pipeline):** For applying managed-settings.json to infrastructure and MCP administration
715
715
 
716
716
  **When to use others:**
717
717
 
@@ -856,9 +856,9 @@ Path-scoped rules load when Claude reads matching files.
856
856
 
857
857
  ### Related Agents
858
858
 
859
- - **@devops (Gage)** - Applies infrastructure configuration and manages MCP servers
860
- - **@architect (Aria)** - Defines architecture boundaries that inform settings design
861
- - **@developer (Dex)** - Primary consumer of optimized configuration
859
+ - **@devops (Pipeline)** - Applies infrastructure configuration and manages MCP servers
860
+ - **@architect (Stratum)** - Defines architecture boundaries that inform settings design
861
+ - **@developer (Pixel)** - Primary consumer of optimized configuration
862
862
 
863
863
  ---
864
864
  ---
@@ -920,10 +920,10 @@ Type `*help` to see all commands, or `*guide` for detailed usage.
920
920
 
921
921
  **I collaborate with:**
922
922
 
923
- - **@devops (Gage):** Handles hook deployment, git push, CI/CD integration
924
- - **@developer (Dex):** Implements complex hook logic or application integrations
925
- - **@quality-gate (Quinn):** Reviews hook test coverage and quality gate integration
926
- - **@architect (Aria):** Consults on hook architecture affecting system design
923
+ - **@devops (Pipeline):** Handles hook deployment, git push, CI/CD integration
924
+ - **@developer (Pixel):** Implements complex hook logic or application integrations
925
+ - **@quality-gate (Litmus):** Reviews hook test coverage and quality gate integration
926
+ - **@architect (Stratum):** Consults on hook architecture affecting system design
927
927
 
928
928
  **When to use others:**
929
929
 
@@ -686,9 +686,9 @@ Type `*help` to see all commands.
686
686
 
687
687
  **I collaborate with:**
688
688
 
689
- - **@devops (Gage):** For Docker MCP infrastructure, git push, CI/CD changes
690
- - **@architect (Aria):** For system-level tool composition decisions
691
- - **@developer (Dex):** For custom MCP server implementation beyond scaffold
689
+ - **@devops (Pipeline):** For Docker MCP infrastructure, git push, CI/CD changes
690
+ - **@architect (Stratum):** For system-level tool composition decisions
691
+ - **@developer (Pixel):** For custom MCP server implementation beyond scaffold
692
692
 
693
693
  **I consume:**
694
694
 
@@ -782,9 +782,9 @@ Need a capability?
782
782
 
783
783
  ### Related Agents
784
784
 
785
- - **@devops (Gage)** - Docker MCP infrastructure, git push, CI/CD
786
- - **@architect (Aria)** - System architecture impacted by tool choices
787
- - **@developer (Dex)** - Custom MCP server implementation
785
+ - **@devops (Pipeline)** - Docker MCP infrastructure, git push, CI/CD
786
+ - **@architect (Stratum)** - System architecture impacted by tool choices
787
+ - **@developer (Pixel)** - Custom MCP server implementation
788
788
 
789
789
  ---
790
790
  ---