sinapse-ai 7.7.2 → 7.7.4

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 (56) hide show
  1. package/.claude/hooks/enforce-git-push-authority.sh +34 -2
  2. package/.claude/rules/safe-collaboration.md +12 -1
  3. package/.codex/catalog.json +157 -0
  4. package/.codex/command-registry.json +441 -0
  5. package/.codex/scripts/generate-codex-greeting.js +101 -0
  6. package/.codex/scripts/resolve-codex-command.js +147 -0
  7. package/.codex/skills/sinapse-analyst/SKILL.md +5 -4
  8. package/.codex/skills/sinapse-architect/SKILL.md +5 -4
  9. package/.codex/skills/sinapse-data-engineer/SKILL.md +5 -4
  10. package/.codex/skills/sinapse-dev/SKILL.md +5 -4
  11. package/.codex/skills/sinapse-devops/SKILL.md +5 -4
  12. package/.codex/skills/sinapse-orqx/SKILL.md +10 -15
  13. package/.codex/skills/sinapse-pm/SKILL.md +5 -4
  14. package/.codex/skills/sinapse-po/SKILL.md +4 -3
  15. package/.codex/skills/sinapse-qa/SKILL.md +12 -11
  16. package/.codex/skills/sinapse-sm/SKILL.md +5 -4
  17. package/.codex/skills/sinapse-squad-creator/SKILL.md +5 -4
  18. package/.codex/skills/sinapse-ux-design-expert/SKILL.md +5 -4
  19. package/.codex/tasks/convene-sinapse-council.md +28 -0
  20. package/.codex/tasks/create-sinapse-strategic-brief.md +29 -0
  21. package/.codex/tasks/onboard-sinapse-codex.md +34 -0
  22. package/.codex/tasks/plan-sinapse-initiative.md +33 -0
  23. package/.codex/tasks/resolve-sinapse-conflict.md +28 -0
  24. package/.codex/tasks/route-sinapse-request.md +33 -0
  25. package/.codex/tasks/status-sinapse-capabilities.md +28 -0
  26. package/.sinapse-ai/core-config.yaml +1 -1
  27. package/.sinapse-ai/data/entity-registry.yaml +903 -805
  28. package/.sinapse-ai/data/registry-update-log.jsonl +10 -0
  29. package/.sinapse-ai/infrastructure/scripts/codex-parity/catalog.js +123 -0
  30. package/.sinapse-ai/infrastructure/scripts/codex-skills-sync/index.js +60 -11
  31. package/.sinapse-ai/infrastructure/scripts/codex-skills-sync/validate.js +44 -16
  32. package/.sinapse-ai/infrastructure/scripts/sync-codex-local-first.js +156 -0
  33. package/.sinapse-ai/infrastructure/scripts/validate-codex-command-registry.js +264 -0
  34. package/.sinapse-ai/infrastructure/scripts/validate-codex-integration.js +15 -6
  35. package/.sinapse-ai/infrastructure/scripts/validate-codex-sync.js +156 -0
  36. package/.sinapse-ai/infrastructure/scripts/validate-parity.js +3 -1
  37. package/.sinapse-ai/infrastructure/scripts/validate-paths.js +8 -10
  38. package/.sinapse-ai/infrastructure/templates/safe-collab/README.md +52 -17
  39. package/.sinapse-ai/infrastructure/templates/safe-collab/apply.sh +85 -0
  40. package/.sinapse-ai/infrastructure/templates/safe-collab/safe-collaboration-rule.md +11 -0
  41. package/.sinapse-ai/install-manifest.yaml +41 -21
  42. package/.sinapse-ai/project-config.yaml +1 -1
  43. package/bin/utils/collab-start.js +267 -0
  44. package/bin/utils/git-branch-guard.js +76 -0
  45. package/bin/utils/pre-push-safety.js +110 -0
  46. package/bin/utils/staged-secret-scan.js +108 -0
  47. package/docs/ORQX-PLAN.md +3 -2
  48. package/docs/codex-parity-program.md +670 -0
  49. package/docs/codex-total-parity-orchestration-plan.md +301 -0
  50. package/docs/codex-workflow-task-parity.md +87 -0
  51. package/docs/collaboration-autonomy-plan.md +243 -0
  52. package/docs/guides/framework-contributor-mode.md +310 -0
  53. package/docs/guides/parallel-collaboration-source-of-truth.md +481 -0
  54. package/package.json +11 -3
  55. package/packages/installer/tests/unit/entity-registry-bootstrap.test.js +2 -2
  56. package/scripts/ensure-manifest.js +9 -0
@@ -0,0 +1,481 @@
1
+ # Parallel Collaboration Source Of Truth
2
+
3
+ **Status:** Active
4
+ **Audience:** Caio, Sawyer/Soier, maintainers, and AI agents operating with SINAPSE
5
+ **Purpose:** Single source of truth for safe parallel collaboration in `sinapse-ai` and in any other repository that adopts the same setup
6
+
7
+ ---
8
+
9
+ ## Why This Document Exists
10
+
11
+ This document defines the canonical operating model for two or more people evolving the same repository in parallel without overwriting code, weakening quality, or depending on informal memory.
12
+
13
+ It exists for two reasons:
14
+
15
+ 1. `sinapse-ai` is a critical framework and must be protected with professional repository discipline.
16
+ 2. The same collaboration model must be portable to other projects that Caio and Sawyer/Soier maintain together.
17
+
18
+ If another document says something different about parallel collaboration, this file wins.
19
+
20
+ ---
21
+
22
+ ## Core Principle
23
+
24
+ **Nobody works directly on `main`.**
25
+
26
+ All meaningful work must happen in an isolated branch, preferably inside an isolated worktree, and must reach `main` only through pull request review plus repository protections.
27
+
28
+ That one rule removes the main source of accidental overwrite.
29
+
30
+ ---
31
+
32
+ ## Non-Negotiables
33
+
34
+ These rules apply to `sinapse-ai` and to any project using this collaboration model.
35
+
36
+ 1. No direct work on `main`.
37
+ 2. No direct push to `main`.
38
+ 3. Every collaborator uses an isolated branch.
39
+ 4. Prefer one isolated worktree per feature, story, or scoped task.
40
+ 5. Every merge to `main` happens through PR review.
41
+ 6. Branches must be up to date with `origin/main` before push or merge.
42
+ 7. Obvious secrets must be blocked before commit.
43
+ 8. Quality gates must run before merge.
44
+ 9. Ownership and reviewer routing must use real GitHub users with write access.
45
+ 10. Destructive Git operations are blocked by default.
46
+
47
+ ---
48
+
49
+ ## What Problem This Solves
50
+
51
+ This model is designed to prevent four common failure modes:
52
+
53
+ 1. Two people edit the same branch and silently overwrite each other.
54
+ 2. Someone starts work on `main`, mixes unrelated changes, and makes later recovery difficult.
55
+ 3. A branch is pushed while behind `origin/main`, making conflicts appear too late.
56
+ 4. Sensitive changes reach the repository without the other maintainer seeing them first.
57
+
58
+ The goal is not "zero conflicts ever."
59
+ The goal is: **conflicts are detected early, contained safely, and never land invisibly in `main`.**
60
+
61
+ ---
62
+
63
+ ## Canonical Workflow
64
+
65
+ ### 1. Starting new work from a clean default branch
66
+
67
+ Use:
68
+
69
+ ```bash
70
+ npm run collab:start -- <story-id> <slug>
71
+ ```
72
+
73
+ Example:
74
+
75
+ ```bash
76
+ npm run collab:start -- 7.7.4 codex-collab-hardening
77
+ ```
78
+
79
+ This command is the standard way to begin work safely. It:
80
+
81
+ - checks that the current branch is the default branch
82
+ - checks that the working tree is clean
83
+ - fetches from `origin`
84
+ - fast-forwards from `origin/main` when needed
85
+ - detects the maintainer prefix
86
+ - creates a dedicated worktree
87
+ - creates a dedicated branch for that work item
88
+
89
+ ### 2. Recovering work that already started on `main`
90
+
91
+ Use:
92
+
93
+ ```bash
94
+ npm run collab:adopt -- <story-id> <slug>
95
+ ```
96
+
97
+ Example:
98
+
99
+ ```bash
100
+ npm run collab:adopt -- codex-runtime codex-functional-upgrade
101
+ ```
102
+
103
+ This is the migration bridge when someone already has local work in `main`. It keeps the current files as they are and moves the work to a safe branch.
104
+
105
+ ### 3. Auditing the current state
106
+
107
+ Use:
108
+
109
+ ```bash
110
+ npm run collab:check
111
+ ```
112
+
113
+ This tells the maintainer:
114
+
115
+ - current branch
116
+ - default branch
117
+ - detected owner prefix
118
+ - whether the tree is clean
119
+
120
+ ---
121
+
122
+ ## Branch Strategy
123
+
124
+ ### Canonical human maintainer branch format
125
+
126
+ ```text
127
+ {owner}/{type}/{story-and-slug}
128
+ ```
129
+
130
+ Examples:
131
+
132
+ - `caio/feat/7-7-4-codex-collab-hardening`
133
+ - `soier/refactor/framework-codex-runtime-hardening`
134
+ - `caio/docs/parallel-collaboration-sot`
135
+
136
+ ### Owner detection
137
+
138
+ The bootstrap detects the owner from local Git identity and environment:
139
+
140
+ - `caio` -> `caio/`
141
+ - `matheus`, `soier`, or `sawyer` -> `soier/`
142
+ - anything else -> `dev/`
143
+
144
+ ### Important note about legacy internal worktree flow
145
+
146
+ `sinapse-ai` still has an internal ADE worktree model using:
147
+
148
+ ```text
149
+ auto-claude/{storyId}
150
+ ```
151
+
152
+ That flow is still valid for internal engine-driven work.
153
+
154
+ The rule is:
155
+
156
+ - use `auto-claude/{storyId}` for the existing internal ADE worktree pipeline
157
+ - use `npm run collab:start` for human maintainer collaboration
158
+
159
+ Do not mix both branch styles in the same change.
160
+
161
+ ---
162
+
163
+ ## Worktree Policy
164
+
165
+ The preferred policy is:
166
+
167
+ - one worktree per active feature or story
168
+ - one branch per worktree
169
+ - one branch owner
170
+
171
+ Why worktrees matter:
172
+
173
+ - each collaborator gets a physically separate working directory
174
+ - switching context becomes safer
175
+ - uncommitted work from one feature does not leak into another
176
+ - `main` can stay clean while several efforts run in parallel
177
+
178
+ For `sinapse-ai`, the standard location is under:
179
+
180
+ ```text
181
+ .sinapse/worktrees/
182
+ ```
183
+
184
+ ---
185
+
186
+ ## What Each Person Does
187
+
188
+ ### Caio
189
+
190
+ - starts work with `collab:start` or `collab:adopt`
191
+ - works inside his own branch or worktree
192
+ - opens PRs for review
193
+ - reviews Soier's PRs
194
+
195
+ ### Sawyer/Soier
196
+
197
+ - starts work with `collab:start` or `collab:adopt`
198
+ - works inside his own branch or worktree
199
+ - opens PRs for review
200
+ - reviews Caio's PRs
201
+
202
+ ### Shared rule
203
+
204
+ The coordination point is the PR, not synchronous chat memory.
205
+
206
+ ---
207
+
208
+ ## Local Safety Rails
209
+
210
+ The local repository should enforce these protections:
211
+
212
+ ### Pre-commit
213
+
214
+ - block commits on `main`
215
+ - block obvious secret leakage from staged files
216
+ - keep existing framework protection checks
217
+
218
+ ### Pre-push
219
+
220
+ - block push from `main`
221
+ - block direct push to `main`
222
+ - block push when the branch is behind `origin/main`
223
+
224
+ These protections make the safe path the easiest path.
225
+
226
+ ---
227
+
228
+ ## GitHub Protection Baseline
229
+
230
+ Every repo using this model should configure the default branch with the following minimum protections:
231
+
232
+ ### Required
233
+
234
+ - PR required before merge
235
+ - at least 1 approval required
236
+ - dismiss stale reviews
237
+ - require the most recent pusher to be approved by someone else
238
+ - require conversation resolution
239
+ - block force push
240
+ - block branch deletion
241
+ - require a validation check or CI summary check
242
+
243
+ ### Recommended
244
+
245
+ - enforce admins
246
+ - auto-delete merged branches
247
+ - auto-merge when checks and approval are complete
248
+ - CODEOWNERS enforcement after valid ownership is present in the default branch
249
+ - secret scanning and push protection
250
+
251
+ ### Important sequencing rule
252
+
253
+ Only enable GitHub's `require_code_owner_reviews` after the `CODEOWNERS` file already merged into the default branch is valid and references real collaborators with write access.
254
+
255
+ Otherwise the repository can lock itself into a broken review state.
256
+
257
+ ---
258
+
259
+ ## CODEOWNERS Policy
260
+
261
+ `CODEOWNERS` is not just documentation. It is operational ownership.
262
+
263
+ Rules:
264
+
265
+ 1. Use real GitHub usernames only.
266
+ 2. Every listed owner must already have write access.
267
+ 3. Critical surfaces should require both maintainers as owners.
268
+ 4. Broad fallback ownership is acceptable, but sensitive paths must still be explicit.
269
+
270
+ Recommended critical paths:
271
+
272
+ - `.github/`
273
+ - `.husky/`
274
+ - `.claude/hooks/`
275
+ - `.claude/rules/`
276
+ - `.sinapse-ai/core/`
277
+ - `.sinapse-ai/infrastructure/`
278
+ - `bin/`
279
+ - `packages/`
280
+ - `package.json`
281
+ - `package-lock.json`
282
+
283
+ ---
284
+
285
+ ## Merge And Review Model
286
+
287
+ The standard model is:
288
+
289
+ 1. Maintainer opens feature branch or worktree
290
+ 2. Maintainer works locally
291
+ 3. Maintainer pushes only their feature branch
292
+ 4. Maintainer opens PR to `main`
293
+ 5. The other maintainer reviews
294
+ 6. CI and repository rules pass
295
+ 7. PR merges into `main`
296
+ 8. Local branches and worktrees are cleaned up
297
+
298
+ ### Review expectations
299
+
300
+ The reviewer checks:
301
+
302
+ - scope matches the branch intent
303
+ - no unrelated files leaked in
304
+ - required sync commands were run
305
+ - docs and manifests stayed aligned when needed
306
+ - the branch is safe to merge
307
+
308
+ ---
309
+
310
+ ## Conflict Handling
311
+
312
+ ### If both collaborators edit different files
313
+
314
+ Usually there is no issue. Separate branches and PRs are enough.
315
+
316
+ ### If both collaborators edit the same file, different sections
317
+
318
+ Git usually merges this automatically or the PR detects it safely before merge.
319
+
320
+ ### If both collaborators edit the same lines
321
+
322
+ This becomes a visible branch or PR conflict and must be resolved before merge.
323
+
324
+ That is acceptable. The point of this model is that the conflict appears in a contained place instead of silently overwriting someone else's work.
325
+
326
+ ---
327
+
328
+ ## Quality Gates
329
+
330
+ For `sinapse-ai`, the baseline quality gates remain:
331
+
332
+ ```bash
333
+ npm run lint
334
+ npm run typecheck
335
+ npm test
336
+ ```
337
+
338
+ Additional sync or validation commands should run when relevant:
339
+
340
+ ```bash
341
+ npm run sync:ide
342
+ npm run validate:codex-sync
343
+ npm run sync:skills:codex
344
+ npm run validate:codex-skills
345
+ npm run generate:manifest
346
+ npm run validate:manifest
347
+ ```
348
+
349
+ Projects that reuse this model should define their own equivalent minimum gates, but the principle remains the same:
350
+
351
+ - no merge without local validation
352
+ - no merge without remote validation
353
+
354
+ ---
355
+
356
+ ## `sinapse-ai` Specific Additions
357
+
358
+ Inside `sinapse-ai`, collaboration also interacts with framework boundaries.
359
+
360
+ ### Autonomous lane
361
+
362
+ Changes can usually proceed without waiting for the other maintainer when they stay within supported extension surfaces like:
363
+
364
+ - `.sinapse-ai/development/agents/`
365
+ - `.sinapse-ai/development/tasks/`
366
+ - `.sinapse-ai/development/workflows/`
367
+ - `.sinapse-ai/product/`
368
+ - `docs/guides/`
369
+ - `docs/framework/`
370
+
371
+ ### Coordinated lane
372
+
373
+ Changes should be aligned first when they affect:
374
+
375
+ - `.sinapse-ai/core/**`
376
+ - `.sinapse-ai/infrastructure/**`
377
+ - `bin/**`
378
+ - `.husky/**`
379
+ - `.claude/hooks/**`
380
+ - release/versioning behavior
381
+ - global framework policy
382
+
383
+ This distinction is specific to `sinapse-ai`, but the same idea can be reused in other repos: define "safe solo surfaces" and "coordinate-first surfaces."
384
+
385
+ ---
386
+
387
+ ## How To Reuse This In Other Projects
388
+
389
+ When applying this model to another repo, keep the following portable baseline:
390
+
391
+ ### Portable baseline
392
+
393
+ - branch per maintainer
394
+ - worktree per feature or story
395
+ - no work on `main`
396
+ - no direct push to `main`
397
+ - PR review required
398
+ - CI required
399
+ - CODEOWNERS with real users
400
+ - secret scan before commit
401
+ - behind-main check before push
402
+
403
+ ### Repo-specific pieces to customize
404
+
405
+ - branch owner prefixes
406
+ - quality gates
407
+ - critical paths in `CODEOWNERS`
408
+ - CI check names
409
+ - file sync commands
410
+ - release rules
411
+
412
+ ### Adoption checklist for another repo
413
+
414
+ 1. Add maintainer bootstrap command
415
+ 2. Add pre-commit and pre-push safety hooks
416
+ 3. Add `CODEOWNERS`
417
+ 4. Configure GitHub branch protection
418
+ 5. Define repo-specific quality gates
419
+ 6. Document autonomous vs coordinated paths if the repo has a framework layer
420
+
421
+ ---
422
+
423
+ ## Anti-Patterns
424
+
425
+ These are forbidden:
426
+
427
+ - starting serious work directly on `main`
428
+ - pushing directly to `main`
429
+ - sharing one long-lived branch between two people
430
+ - opening PRs from outdated branches
431
+ - relying on memory instead of explicit PR handoff
432
+ - committing `.env` files or obvious secrets
433
+ - using force push as a normal workflow
434
+ - changing critical repository policy without coordinated review
435
+
436
+ ---
437
+
438
+ ## Recovery Rules
439
+
440
+ ### If someone already started in `main`
441
+
442
+ Use `collab:adopt`.
443
+
444
+ ### If a branch is behind `origin/main`
445
+
446
+ Update it before push or merge.
447
+
448
+ ### If a conflict appears
449
+
450
+ Resolve it in the feature branch or PR, never by bypassing protections on `main`.
451
+
452
+ ### If `CODEOWNERS` or GitHub protections are misconfigured
453
+
454
+ Fix ownership first, then activate stricter review enforcement.
455
+
456
+ ---
457
+
458
+ ## Decision Summary
459
+
460
+ The canonical answer to "how do two maintainers work in sync without overwriting code?" is:
461
+
462
+ - isolated branch
463
+ - isolated worktree
464
+ - no work on `main`
465
+ - PR review before merge
466
+ - GitHub protection on `main`
467
+ - local safety hooks
468
+ - quality gates before merge
469
+
470
+ Everything else is optimization on top of that base.
471
+
472
+ ---
473
+
474
+ ## Related Documents
475
+
476
+ These documents support this source of truth, but do not override it:
477
+
478
+ - [Framework Contributor Mode](./framework-contributor-mode.md)
479
+ - [Parallel Workflow](./parallel-workflow.md)
480
+ - [Safe Collaboration Rule](../../.claude/rules/safe-collaboration.md)
481
+ - [Safe Collaboration Template README](../../.sinapse-ai/infrastructure/templates/safe-collab/README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinapse-ai",
3
- "version": "7.7.2",
3
+ "version": "7.7.4",
4
4
  "description": "SINAPSE AI: Framework de orquestracao de IA — 18 squads, 175 agentes especializados",
5
5
  "bin": {
6
6
  "sinapse": "bin/sinapse.js",
@@ -20,9 +20,13 @@
20
20
  ".claude/CLAUDE.md",
21
21
  ".claude/rules/",
22
22
  ".claude/hooks/",
23
+ ".codex/catalog.json",
24
+ ".codex/command-registry.json",
23
25
  ".codex/instructions.md",
24
26
  ".codex/agents/",
27
+ ".codex/scripts/",
25
28
  ".codex/skills/",
29
+ ".codex/tasks/",
26
30
  "squads/squad-*/**",
27
31
  "squads/claude-code-mastery/**",
28
32
  "squads/sinapse/**",
@@ -72,16 +76,20 @@
72
76
  "sync:ide:validate": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js validate",
73
77
  "sync:ide:check": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js validate --strict",
74
78
  "sync:ide:claude": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js sync --ide claude-code",
75
- "sync:ide:codex": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js sync --ide codex",
79
+ "sync:ide:codex": "node .sinapse-ai/infrastructure/scripts/sync-codex-local-first.js",
76
80
  "validate:claude-sync": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js validate --ide claude-code --strict",
77
81
  "validate:claude-integration": "node .sinapse-ai/infrastructure/scripts/validate-claude-integration.js",
78
- "validate:codex-sync": "node .sinapse-ai/infrastructure/scripts/ide-sync/index.js validate --ide codex --strict",
82
+ "validate:codex-sync": "node .sinapse-ai/infrastructure/scripts/validate-codex-sync.js",
79
83
  "validate:codex-integration": "node .sinapse-ai/infrastructure/scripts/validate-codex-integration.js",
84
+ "validate:codex-commands": "node .sinapse-ai/infrastructure/scripts/validate-codex-command-registry.js",
80
85
  "sync:skills:codex": "node .sinapse-ai/infrastructure/scripts/codex-skills-sync/index.js",
81
86
  "sync:skills:codex:global": "node .sinapse-ai/infrastructure/scripts/codex-skills-sync/index.js --global --global-only",
82
87
  "validate:codex-skills": "node .sinapse-ai/infrastructure/scripts/codex-skills-sync/validate.js --strict",
83
88
  "validate:paths": "node .sinapse-ai/infrastructure/scripts/validate-paths.js",
84
89
  "validate:parity": "node .sinapse-ai/infrastructure/scripts/validate-parity.js",
90
+ "collab:adopt": "node bin/utils/collab-start.js --adopt-current",
91
+ "collab:check": "node bin/utils/collab-start.js --check",
92
+ "collab:start": "node bin/utils/collab-start.js",
85
93
  "validate:semantic-lint": "node scripts/semantic-lint.js",
86
94
  "manifest:ensure": "node scripts/ensure-manifest.js",
87
95
  "validate:publish": "node bin/utils/validate-publish.js",
@@ -97,9 +97,9 @@ describe('Entity Registry Bootstrap (Story INS-4.6)', () => {
97
97
  });
98
98
 
99
99
  describe('AC3: No duplication with pre-push hook', () => {
100
- test('pre-push hook calls ids-pre-push.js (incremental), not populate script', () => {
100
+ test('pre-push hook calls pre-push-safety.js, not populate script', () => {
101
101
  const hookContent = fs.readFileSync(PRE_PUSH_HOOK, 'utf8');
102
- expect(hookContent).toContain('ids-pre-push.js');
102
+ expect(hookContent).toContain('pre-push-safety.js');
103
103
  expect(hookContent).not.toContain('populate-entity-registry.js');
104
104
  });
105
105
 
@@ -37,6 +37,15 @@ async function main() {
37
37
  return;
38
38
  }
39
39
 
40
+ // In pre-commit: validate-only to prevent merge conflicts (Art. IX)
41
+ // Regeneration happens via `npm run generate:manifest` or prepublishOnly
42
+ const validateOnly = process.argv.includes('--validate-only');
43
+
44
+ if (validateOnly) {
45
+ console.log('⚠️ manifest: outdated — run `npm run generate:manifest` to update');
46
+ return;
47
+ }
48
+
40
49
  console.log('🔄 manifest: outdated, regenerating...');
41
50
  const manifest = await generateManifest();
42
51
  await writeManifest(manifest);