contextos-agents 2.3.1 → 2.3.2

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 (128) hide show
  1. package/.agents/adapters/cursor/export.js +3 -27
  2. package/.agents/adapters/gemini/export.js +5 -7
  3. package/.agents/adapters/shared.js +14 -1
  4. package/.agents/adapters/zed/export.js +4 -16
  5. package/.agents/compiled/registry.v2.json +33 -33
  6. package/.agents/compiled/registry.v2.sha256 +1 -1
  7. package/.agents/compiler/manifest-compiler.js +8 -5
  8. package/.agents/core/skills/context-manager/EXAMPLES.md +5 -17
  9. package/.agents/core/skills/context-manager/SKILL.md +10 -100
  10. package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +6 -6
  11. package/.agents/core/skills/context-manager/VALIDATION.json +115 -4
  12. package/.agents/core/skills/context-manager/references/context-rules.md +3 -57
  13. package/.agents/core/skills/context-manager/skill.yaml +1 -3
  14. package/.agents/core/skills/context-os/EXAMPLES.md +25 -15
  15. package/.agents/core/skills/context-os/SKILL.md +12 -135
  16. package/.agents/core/skills/context-os/TROUBLESHOOTING.md +11 -6
  17. package/.agents/core/skills/context-os/VALIDATION.json +115 -4
  18. package/.agents/core/skills/context-os/packs.yaml +10 -59
  19. package/.agents/core/skills/context-os/references/context-rules.md +27 -59
  20. package/.agents/core/skills/context-os/references/pipeline.md +14 -119
  21. package/.agents/core/skills/context-os/references/project-graph.md +11 -100
  22. package/.agents/core/skills/context-os/rules.yaml +8 -135
  23. package/.agents/core/skills/engineering-workflow/EXAMPLES.md +15 -50
  24. package/.agents/core/skills/engineering-workflow/SKILL.md +10 -10
  25. package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  26. package/.agents/core/skills/engineering-workflow/VALIDATION.json +115 -4
  27. package/.agents/core/skills/engineering-workflow/references/workflow.md +55 -317
  28. package/.agents/core/skills/gemini-precision/EXAMPLES.md +33 -53
  29. package/.agents/core/skills/gemini-precision/SKILL.md +11 -147
  30. package/.agents/core/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  31. package/.agents/core/skills/gemini-precision/VALIDATION.json +115 -4
  32. package/.agents/core/skills/gemini-precision/skill.yaml +1 -1
  33. package/.agents/core/skills/gstack-roles/EXAMPLES.md +5 -21
  34. package/.agents/core/skills/gstack-roles/SKILL.md +10 -12
  35. package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  36. package/.agents/core/skills/gstack-roles/VALIDATION.json +115 -4
  37. package/.agents/core/skills/gstack-roles/references/roles.md +3 -147
  38. package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +12 -45
  39. package/.agents/core/skills/ponytail-mindset/SKILL.md +10 -13
  40. package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  41. package/.agents/core/skills/ponytail-mindset/VALIDATION.json +115 -4
  42. package/.agents/core/skills/ponytail-mindset/references/minimalism.md +58 -174
  43. package/.agents/core/skills/security/EXAMPLES.md +19 -55
  44. package/.agents/core/skills/security/SKILL.md +61 -137
  45. package/.agents/core/skills/security/TROUBLESHOOTING.md +13 -19
  46. package/.agents/core/skills/security/VALIDATION.json +115 -4
  47. package/.agents/core/skills/security/skill.yaml +1 -1
  48. package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +5 -17
  49. package/.agents/generated/claude/skills/context-manager/SKILL.md +9 -96
  50. package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +6 -6
  51. package/.agents/generated/claude/skills/context-manager/VALIDATION.json +115 -4
  52. package/.agents/generated/claude/skills/context-manager/references/context-rules.md +3 -57
  53. package/.agents/generated/claude/skills/context-os/EXAMPLES.md +25 -15
  54. package/.agents/generated/claude/skills/context-os/SKILL.md +11 -133
  55. package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +11 -6
  56. package/.agents/generated/claude/skills/context-os/VALIDATION.json +115 -4
  57. package/.agents/generated/claude/skills/context-os/packs.yaml +10 -59
  58. package/.agents/generated/claude/skills/context-os/references/context-rules.md +27 -59
  59. package/.agents/generated/claude/skills/context-os/references/pipeline.md +14 -119
  60. package/.agents/generated/claude/skills/context-os/references/project-graph.md +11 -100
  61. package/.agents/generated/claude/skills/context-os/rules.yaml +8 -135
  62. package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +15 -50
  63. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +9 -9
  64. package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  65. package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +115 -4
  66. package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +55 -317
  67. package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +33 -53
  68. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +10 -143
  69. package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  70. package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +115 -4
  71. package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +5 -21
  72. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +9 -11
  73. package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  74. package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +115 -4
  75. package/.agents/generated/claude/skills/gstack-roles/references/roles.md +3 -147
  76. package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +12 -45
  77. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +9 -12
  78. package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  79. package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +115 -4
  80. package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +58 -174
  81. package/.agents/generated/claude/skills/security/EXAMPLES.md +19 -55
  82. package/.agents/generated/claude/skills/security/SKILL.md +60 -134
  83. package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +13 -19
  84. package/.agents/generated/claude/skills/security/VALIDATION.json +115 -4
  85. package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +5 -17
  86. package/.agents/generated/gemini/skills/context-manager/SKILL.md +10 -99
  87. package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +6 -6
  88. package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +115 -4
  89. package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +3 -57
  90. package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +25 -15
  91. package/.agents/generated/gemini/skills/context-os/SKILL.md +12 -135
  92. package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +11 -6
  93. package/.agents/generated/gemini/skills/context-os/VALIDATION.json +115 -4
  94. package/.agents/generated/gemini/skills/context-os/packs.yaml +10 -59
  95. package/.agents/generated/gemini/skills/context-os/references/context-rules.md +27 -59
  96. package/.agents/generated/gemini/skills/context-os/references/pipeline.md +14 -119
  97. package/.agents/generated/gemini/skills/context-os/references/project-graph.md +11 -100
  98. package/.agents/generated/gemini/skills/context-os/rules.yaml +8 -135
  99. package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +15 -50
  100. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +10 -11
  101. package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
  102. package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +115 -4
  103. package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +55 -317
  104. package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +33 -53
  105. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +11 -145
  106. package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
  107. package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +115 -4
  108. package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +5 -21
  109. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +10 -13
  110. package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
  111. package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +115 -4
  112. package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +3 -147
  113. package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +12 -45
  114. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +10 -14
  115. package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
  116. package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +115 -4
  117. package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +58 -174
  118. package/.agents/generated/gemini/skills/security/EXAMPLES.md +19 -55
  119. package/.agents/generated/gemini/skills/security/SKILL.md +61 -136
  120. package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +13 -19
  121. package/.agents/generated/gemini/skills/security/VALIDATION.json +115 -4
  122. package/.agents/resolver/canonical-resolver.js +34 -21
  123. package/.agents/rules/rule-catalog.js +5 -5
  124. package/.agents/validate.js +9 -2
  125. package/.agents/validation-evidence.js +89 -0
  126. package/README.md +132 -207
  127. package/catalog/skills/typescript/SKILL.md +16 -2
  128. package/package.json +3 -2
@@ -1,12 +1,123 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "x-contextos-evidence-contract": 1,
4
+ "title": "Scoped verification evidence",
5
+ "description": "Report shape and outcome consistency only; command execution and agent behavior require separate evidence.",
3
6
  "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "status",
10
+ "checks",
11
+ "limitations"
12
+ ],
4
13
  "properties": {
5
- "rules_followed": {
6
- "type": "boolean"
14
+ "status": {
15
+ "enum": [
16
+ "verified",
17
+ "partial",
18
+ "not_run"
19
+ ]
20
+ },
21
+ "checks": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": [
27
+ "command",
28
+ "exitCode",
29
+ "scope"
30
+ ],
31
+ "properties": {
32
+ "command": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "exitCode": {
37
+ "type": [
38
+ "integer",
39
+ "null"
40
+ ]
41
+ },
42
+ "scope": {
43
+ "type": "string",
44
+ "minLength": 1
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "limitations": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string",
53
+ "minLength": 1
54
+ }
7
55
  }
8
56
  },
9
- "required": [
10
- "rules_followed"
57
+ "allOf": [
58
+ {
59
+ "if": {
60
+ "properties": {
61
+ "status": {
62
+ "const": "verified"
63
+ }
64
+ }
65
+ },
66
+ "then": {
67
+ "properties": {
68
+ "checks": {
69
+ "minItems": 1,
70
+ "items": {
71
+ "properties": {
72
+ "exitCode": {
73
+ "const": 0
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ },
81
+ {
82
+ "if": {
83
+ "properties": {
84
+ "status": {
85
+ "enum": [
86
+ "partial",
87
+ "not_run"
88
+ ]
89
+ }
90
+ }
91
+ },
92
+ "then": {
93
+ "properties": {
94
+ "limitations": {
95
+ "minItems": 1
96
+ }
97
+ }
98
+ }
99
+ },
100
+ {
101
+ "if": {
102
+ "properties": {
103
+ "status": {
104
+ "const": "not_run"
105
+ }
106
+ }
107
+ },
108
+ "then": {
109
+ "properties": {
110
+ "checks": {
111
+ "items": {
112
+ "properties": {
113
+ "exitCode": {
114
+ "type": "null"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
11
122
  ]
12
123
  }
@@ -1,336 +1,74 @@
1
+ # Proportional engineering workflow
1
2
 
2
- # engineering-workflow
3
+ ## Choose checks by risk
3
4
 
4
- ## Overview
5
+ | Work | Process | Evidence |
6
+ | --- | --- | --- |
7
+ | Routine docs, formatting, low-risk config | Inspect, edit, targeted verification | Relevant formatter, validator, or smoke check |
8
+ | Feature or bugfix | Short plan, implement, behavior checks, self-review | Changed behavior and callers, relevant integration tests |
9
+ | Auth, payments, migrations, concurrency | Acceptance criteria, plan, bounded change, regression checks, review | Allowed and denied cases, failure paths, relevant project gates |
10
+ | Destructive operation | Confirm existing authority and bounds, backup/rollback, guarded action, verify | State before/after and recovery evidence |
5
11
 
6
- Systematic 6-phase engineering pipeline (DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP) enforcing role declarations, atomic task execution, quality gates, regression prevention, and structured requirements elicitation.
12
+ Risk classification is a routing aid. Inspect the actual operation; do not treat
13
+ an inferred low-risk label as authorization or permission to remove safety checks.
7
14
 
8
- ## When to Use
15
+ ## Define and plan
9
16
 
10
- Activate on all project tasks to orchestrate structured development, spec definition, architectural planning, and verification gates.
17
+ For substantial changes record the outcome, in-scope work, acceptance cases,
18
+ affected code/callers, dependencies, and relevant verification. Resolve only
19
+ missing material decisions. Keep user authorization across phases; do not stop
20
+ again merely because a spec or plan now exists.
11
21
 
12
- ## Rules & Patterns
22
+ Prefer independently useful vertical slices when possible. For a referral
23
+ feature, start with one minimal service/API/UI path, verify it, then add expiry
24
+ and abuse controls. Infrastructure-only work can have infrastructure-only steps.
25
+ Update the plan when an inspected caller must change within the authorized scope.
13
26
 
14
- Inspired by [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) by Addy Osmani (Google Chrome) and [obra/superpowers](https://github.com/obra/superpowers).
27
+ ## Implement and verify
15
28
 
16
- ### Core Principle
29
+ Read before editing. Preserve unrelated work. Use a failing regression test first
30
+ when it clearly captures a bug or logic change; TDD is a technique, not a required
31
+ ceremony for every file. Docs/config may need a validator or smoke run instead.
32
+ Do not add tests that merely repeat implementation or count strings as behavior.
33
+ Do not claim a real integration is implemented using a stub. Commit only when
34
+ requested or required by the repository workflow; an atomic slice does not
35
+ itself require a commit.
17
36
 
18
- > **A junior writes code immediately. A senior writes a spec first.**\
19
- > Establish scope before substantial changes and carry existing authorization forward.
37
+ Run relevant checks, examine failures, and repair introduced regressions. State
38
+ pre-existing failures, unavailable environments, and unrun checks separately.
39
+ Do not silently expand the feature or remove a check to obtain a green result.
20
40
 
21
- ---
41
+ ## Review and simplify
22
42
 
23
- ### The 6-Phase Development Pipeline
43
+ Compare the diff to acceptance criteria, callers, and applicable security and
44
+ performance boundaries. Prefer readable code and existing facilities. A helper
45
+ used once is acceptable when it names a concept, isolates a boundary, or makes
46
+ verification clearer. Reuse counts alone do not determine good abstractions.
47
+ Role changes within one model are self-review, not independent peer review.
24
48
 
25
- ```
26
- DEFINE PLAN BUILD VERIFY REVIEW SHIP
27
- ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
28
- │ Idea │ ───▶ │ Spec │ ───▶ │ Code │ ───▶ │ Test │ ───▶ │ QA │ ───▶ │ Go │
29
- │Refine│ │ PRD │ │ Impl │ │Debug │ │ Gate │ │ Live │
30
- └──────┘ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘
31
- /spec /plan /build /test /review /ship
32
-
33
- [ROLE: Product Manager] [ROLE: Architect] [ROLE: Senior Dev] [ROLE: QA Lead] [ROLE: Staff Eng] [ROLE: Release Eng]
34
- ```
35
-
36
- **Workflow rule**: Scope substantial work before implementation. Existing authorization, standalone requests, and routine fast tracks permit proceeding directly.
37
- **Direct Build & Fast-Track Exception**: When the prompt/caller explicitly requests a standalone implementation, declares `[PHASE: Build]`, or requests routine operational/maintenance tasks (git operations, version bumps, typo fixes, small config tweaks, diagnostic checks), proceed directly to execution without conversational approval pauses.
38
-
39
- ---
40
-
41
- ### Phase 1: DEFINE - /spec
42
-
43
- **Auto-activates → `[ROLE: Product Manager]`**
44
-
45
- Turn vague intent into a precise, executable specification.
46
-
47
- #### Step 1.1: The Interview Protocol (`interview-me`)
48
-
49
- Before writing the spec, if there is ambiguity, high blast radius, or multiple architectural paths, stop and ask the user **one question at a time** (or up to 2 tightly coupled questions):
50
-
51
- 1. **Clarify Business Intent**: What user problem are we solving? What is explicitly out of scope?
52
- 2. **Clarify Constraints**: Runtime versions, database engines, performance bounds.
53
- 3. **Clarify Edge Cases**: What happens on offline state, empty lists, unauthorized requests?
54
-
55
- #### Step 1.2: Spec Template
56
-
57
- ```markdown
58
- ## Feature Spec: [Feature Name]
49
+ ## Prepare delivery
59
50
 
60
- ### Why (Problem)
61
- [What pain does this solve? Who has it? How often?]
51
+ Update relevant documentation and migration/rollback instructions. Publishing,
52
+ deployment, destructive actions, and external messages require authorization for
53
+ that action unless it is already present. Preparation does not prove deployment.
54
+ Durable project learnings can be recorded when authorized; do not add a required
55
+ learning statement or unrelated memory edits to every completion.
62
56
 
63
- ### Scope (What's In / Out)
57
+ ## Report evidence
64
58
 
65
- **In-Scope**:
66
- - [Specific item 1]
67
- - [Specific item 2]
59
+ Name what changed, why, commands/results, tested scope, and remaining limitations.
60
+ VALIDATION.json describes an evidence-report format, not proof that these rules
61
+ were followed. Structural validation, example tests, and live client behavior
62
+ are different evidence scopes.
68
63
 
69
- **Out-of-Scope**:
70
- - [Thing we're NOT doing and why]
64
+ For this source checkout:
71
65
 
72
- ### Technical Approach
73
- [Read the relevant code. Understand what changes where.]
74
- Files affected:
75
- - `src/X.js` - [what changes]
76
- - `src/Y.js` - [what changes]
77
-
78
- ### Acceptance Criteria
79
- - [ ] Given [context], when [action], then [result]
80
- - [ ] Given [context], when [action], then [result]
81
-
82
- ### Open Questions
83
- - [Unresolved decision 1]
84
- - [Unresolved decision 2]
66
+ ```powershell
67
+ node .agents/ctx.js validate
68
+ node bin/index.js scan --staged --enforce --placeholders
85
69
  ```
86
70
 
87
- ---
88
-
89
- ### Phase 2: PLAN - /plan
90
-
91
- **Auto-activates → `[ROLE: Architect]`**
92
-
93
- Break the spec into atomic, independently testable tasks.
94
-
95
- #### Thin Vertical Slices (`incremental-implementation`)
96
-
97
- Organize tasks as **Thin Vertical Slices** rather than horizontal layers:
98
-
99
- - **Bad (Horizontal)**: Task 1: All DB migrations. Task 2: All API routes. Task 3: All UI components. (Nothing works until step 3).
100
- - **Good (Vertical Slices)**: Slice 1: Minimal DB table + minimal API + minimal UI button end-to-end. Verify and commit. Slice 2: Add validation + edge cases. Slice 3: Polish UI & telemetry.
101
-
102
- #### Plan Rules
103
-
104
- - Each task must be **completable in < 2 hours** of focused work.
105
- - Each task must be **independently testable**.
106
- - Tasks must be **ordered by dependency** (blocking tasks first).
107
- - Each task gets a **test requirement** - no task without a test.
108
-
109
- #### Plan Template
110
-
111
- ```markdown
112
- ## Implementation Plan: [Feature Name]
113
-
114
- ### Tasks
115
-
116
- **Task 1: [Slice 1 Name]** (est. 30min)
117
- - What: [Specific implementation detail]
118
- - Files: [file1.js, file2.js]\
119
- - Test: [How will you verify this works?]
120
- - Blocked by: [nothing / Task N]
121
-
122
- **Task 2: [Slice 2 Name]** (est. 45min)
123
- - What: [Specific implementation detail]
124
- - Files: [file3.js]
125
- - Test: [Test description]
126
- - Blocked by: Task 1
127
-
128
- ### Risk Assessment
129
- - [Risk 1]: [Mitigation]
130
- - [Risk 2]: [Mitigation]
131
-
132
- ### STOP - Awaiting Approval
133
- Proceed to BUILD when implementation is authorized; clarify missing scope decisions when needed.
134
- ```
135
-
136
- ---
137
-
138
- ### Phase 3: BUILD - /build
139
-
140
- **Auto-activates → `[ROLE: Senior Developer]`**
141
-
142
- Implement one task at a time. Commit after each task.
143
-
144
- #### Build Rules
145
-
146
- 1. **One task per commit** - atomic, descriptive commit messages.
147
- 2. **Write the test FIRST** (TDD - red-green-refactor).
148
- 3. **No dead code** - if it's not tested, it's not shipped.
149
- 4. **No TODOs in committed code** - resolve or create a tracked issue.
150
- 5. **Read before writing** - understand the surrounding code before changing it.
151
- 6. **Limit the blast radius** - modify ONLY the files explicitly listed in the current task's plan. Do NOT rewrite adjacent components, hooks, or utilities unless strictly required by the authorized outcome.
152
-
153
- #### Commit Message Format
154
-
155
- ```text
156
- type(scope): short description (max 72 chars)
157
-
158
- - Detail 1
159
- - Detail 2
160
-
161
- Refs: #issue-number
162
- ```
163
-
164
- Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
165
-
166
- ---
167
-
168
- ### Phase 4: VERIFY - /test
169
-
170
- **Auto-activates → `[ROLE: QA Lead]`**
171
-
172
- Tests are proof, not an afterthought.
173
-
174
- #### Test Strategy by Code Type
175
-
176
- **Logic & Services (TDD)**:
177
-
178
- ```text
179
- 1. RED: Write a failing test for the next small behavior
180
- 2. GREEN: Write the minimum code to make it pass
181
- 3. REFACTOR: Clean up without breaking tests
182
- 4. REPEAT
183
- ```
184
-
185
- **UI Components & User Flows (BDD)**:
186
-
187
- For complex React components, prioritize testing _user behavior_ over internal state:
188
-
189
- - Use **React Testing Library** (`userEvent`, `screen.getByRole`) - test what the user sees.
190
- - Use **Playwright** for critical user flows (login, checkout, form submit).
191
- - Do NOT test implementation details (internal state, private methods, component structure).
192
- - Focus on: "When user clicks X, does Y appear?" not "Does `useState` hold the right value?"
193
-
194
- ```tsx
195
- // [GOOD] BDD: Test behavior
196
- test("shows error when email is invalid", async () => {
197
- render(<LoginForm />);
198
- await userEvent.type(screen.getByLabelText("Email"), "not-an-email");
199
- await userEvent.click(screen.getByRole("button", { name: /sign in/i }));
200
- expect(screen.getByText(/invalid email/i)).toBeInTheDocument();
201
- });
202
- ```
203
-
204
- #### Test Quality Gates
205
-
206
- Before moving to Review, verify:
207
-
208
- - [ ] All new code has tests
209
- - [ ] Tests are meaningful (not just coverage theater)
210
- - [ ] Edge cases are covered (null, empty, overflow, unauthorized)
211
- - [ ] Tests fail when the implementation is broken (anti-regression)
212
- - [ ] Test names are readable: `it("returns 404 when user not found")`
213
-
214
- ---
215
-
216
- ### Phase 5: REVIEW - /review
217
-
218
- **Auto-activates → `[ROLE: Staff Engineer]` + `[ROLE: Senior Designer]` for UI tasks**
219
-
220
- Review before merging. Always.
221
-
222
- #### Subagent / Peer Code Review Protocol
223
-
224
- Inspired by [obra/superpowers](https://github.com/obra/superpowers):
225
-
226
- 1. **Self-Review First**: The implementer runs git diff and verifies against the original acceptance criteria.
227
- 2. **Review Checklist**:
228
- - **Correctness**: Does it do what the spec says? Are all criteria met?
229
- - **Architecture**: Single Responsibility, DRY without premature abstraction, no business logic in API routes.
230
- - **Security**: No secrets hardcoded, inputs validated via Zod/schemas, auth checked before data access.
231
- - **Performance**: No N+1 queries, expensive operations cached, sets paginated.
232
- - **Design**: If UI, passes `impeccable-design` quick audit (typography, colors, spacing, animations).
233
-
234
- ---
235
-
236
- ### Phase 5.5: SIMPLIFY - /simplify
237
-
238
- **Auto-activates → `[ROLE: Staff Engineer]` (Ponytail Mindset)**
239
-
240
- Before merging, ruthlessly simplify:
241
-
242
- 1. Did we introduce abstractions that are only used once? (Inline them).
243
- 2. Can 3 lines of standard JavaScript replace a 50-line custom utility?
244
- 3. Is any configuration or generic handler premature? (YAGNI).
245
- 4. Is the code obvious to a mid-level engineer without reading a documentation manual?
246
-
247
- ---
248
-
249
- ### Phase 6: SHIP - /ship
250
-
251
- **Auto-activates → `[ROLE: Release Engineer]`**
252
-
253
- Only ship when all gates are green.
254
-
255
- #### Pre-Ship Checklist
256
-
257
- - [ ] All tests pass in CI
258
- - [ ] No lint errors
259
- - [ ] Feature works in staging environment
260
- - [ ] Docs updated (README, API docs, changelogs)
261
- - [ ] Breaking changes documented
262
- - [ ] Rollback plan exists
263
- - [ ] Preview / staging deployment verified (if applicable, e.g. Vercel Preview and Core Web Vitals for frontend deployments)
264
-
265
- #### Operational Self-Improvement
266
-
267
- Before completing a workflow, review the session for durable learnings. Write them to `.agents/learnings.md`. If no durable learning occurred, state "No durable learnings this session" in your final output.
268
-
269
- ---
270
-
271
- ## Code Examples
272
-
273
- ### Vertical Slice Example
274
-
275
- ```javascript
276
- // Slice 1: Minimal functional endpoint
277
- // POST /api/v1/projects -> creates project with basic validation
278
- import { z } from 'zod';
279
- import { projectService } from '@/services/project';
280
-
281
- const CreateProjectSchema = z.object({
282
- name: z.string().min(1).max(100),
283
- description: z.string().optional()
284
- });
285
-
286
- export async function POST(req) {
287
- const session = await auth();
288
- if (!session?.userId) return Response.json({ error: 'Unauthorized' }, { status: 401 });
289
-
290
- const body = await req.json();
291
- const parsed = CreateProjectSchema.parse(body);
292
- const project = await projectService.create({ ...parsed, userId: session.userId });
293
-
294
- return Response.json(project, { status: 201 });
295
- }
296
- ```
297
-
298
- ---
299
-
300
- ## Validation Checklist
301
-
302
- - [ ] Specification exists with clear In-Scope and Out-of-Scope boundaries.
303
- - [ ] Implementation plan broken down into vertical tasks < 2 hours each.
304
- - [ ] Tests written before implementation (TDD/BDD).
305
- - [ ] Code reviewed against correctness, security, performance, and design gates.
306
- - [ ] Staged security and quality check passes (`contextos scan --staged --enforce`).
307
- - [ ] Simplification ladder executed before shipping.
308
-
309
- ---
310
-
311
- ## Common Mistakes
312
-
313
- - **Writing code before approval**: Skipping `/spec` or `/plan` in interactive sessions.
314
- - **Horizontal task splitting**: Building all DB models first without verifying end-to-end integration.
315
- - **Premature refactoring**: Changing unrelated adjacent code during a feature task.
316
- - **Ignoring non-happy paths**: Testing only 200 OK responses while ignoring 400, 401, 404, 500 scenarios.
317
-
318
- ---
319
-
320
- ## Integration Notes
321
-
322
- - Integrates with `gstack-roles` for automated role switching across all 6 phases.
323
- - Triggers `ponytail-mindset` during the BUILD and SIMPLIFY phases.
324
- - Hands off to `impeccable-design` for UI quality review.
325
- - Coordinates with `security` during Phase 5 for pre-merge compliance.
326
-
327
- ---
328
-
329
- ## Completion Status Protocol
330
-
331
- When completing a task or workflow, you must explicitly report your final status as the last part of your output:
332
-
333
- - **DONE** - completed with evidence.
334
- - **DONE_WITH_CONCERNS** - completed, but list concerns.
335
- - **BLOCKED** - cannot proceed; state blocker and what was tried.
336
- - **NEEDS_CONTEXT** - missing info; state exactly what is needed.
71
+ The first command checks skill sources and sync. The second checks staged secrets
72
+ and placeholders. Add --scope <file> only with an actual scope JSON file; an empty
73
+ index does not verify unstaged edits. For a consumer installation use its local
74
+ ContextOS executable rather than assuming these source paths exist.
@@ -1,72 +1,52 @@
1
- # gemini-precision Examples - Anti-patterns vs ContextOS Standard
1
+ # Gemini execution examples
2
2
 
3
- ## Example 1: Read-Before-Write Invariant (Zero Assumptions)
3
+ ## Inspect before integration
4
4
 
5
- ### Anti-pattern: Hallucinated Import and Signature
5
+ Before calling a password helper, read its export and signature. Do not infer a
6
+ package, import path, or return type from an example. Name the checked files and
7
+ run the relevant authentication regression.
6
8
 
7
- ```typescript
8
- // BAD: Assuming the module exists and export is a default function
9
- import hashPassword from 'src/utils/crypto';
10
- const hash = hashPassword(password);
11
- ```
12
-
13
- ### Best practice: ContextOS Standard (Inspected Active Codebase First)
14
-
15
- ```typescript
16
- // GOOD: Inspected src/lib/auth.ts via view_file before writing code
17
- import { hashSecret, ARGON2_CONFIG } from '../lib/auth.js';
18
- const hash = await hashSecret(password, ARGON2_CONFIG);
19
- ```
20
-
21
- ---
22
-
23
- ## Example 2: Zero-Placeholder Invariant (Complete Code Only)
24
-
25
- ### Anti-pattern: Lazy Stubs and Ellipsis Comments
9
+ ## Complete pure calculation with an explicit boundary
26
10
 
27
- ```typescript
28
- // BAD: Emitting incomplete code with TODOs and ellipsis
29
- export function processTransaction(tx: Transaction) {
30
- // TODO: validate transaction balance
31
- // ... rest of implementation stays here ...
32
- return { status: 'ok' };
33
- }
34
- ```
11
+ This block validates integer minor-unit amounts and computes a proposed balance.
12
+ It does not execute or persist a transfer. A real payment operation also needs
13
+ trusted authorization, concurrency control, idempotency, and a transactional
14
+ persistence boundary. Do not report this function as a completed integration.
35
15
 
36
- ### Best practice: ContextOS Standard (100% Drop-in Compilable)
37
-
38
- ```typescript
39
- // GOOD: Fully implemented logic with complete error handling
40
- export function processTransaction(tx: Transaction): TransactionResult {
41
- if (!tx.amount || tx.amount <= 0) {
42
- throw new ValidationError('Transaction amount must be positive');
16
+ <!-- example: gemini-transfer -->
17
+ ```javascript
18
+ export function processTransaction(tx) {
19
+ if (!tx || typeof tx !== 'object' ||
20
+ typeof tx.id !== 'string' || !tx.id ||
21
+ typeof tx.senderId !== 'string' || !tx.senderId) {
22
+ throw new TypeError('Transaction identity required');
43
23
  }
44
- if (tx.senderBalance < tx.amount) {
45
- throw new InsufficientFundsError(tx.senderId, tx.amount);
24
+ if (!Number.isSafeInteger(tx.amount) || tx.amount <= 0 ||
25
+ !Number.isSafeInteger(tx.senderBalance) || tx.senderBalance < 0) {
26
+ throw new TypeError('Amounts must be safe integer minor units');
46
27
  }
28
+ if (tx.senderBalance < tx.amount) throw new RangeError('Insufficient funds');
47
29
  return {
48
- status: 'ok',
30
+ status: 'validated',
49
31
  transactionId: tx.id,
50
32
  newBalance: tx.senderBalance - tx.amount,
51
33
  };
52
34
  }
53
35
  ```
54
36
 
55
- ---
37
+ The example verifier rejects NaN, Infinity, fractional/unsafe amounts, and
38
+ insufficient balances. These cases establish the calculation's stated contract.
56
39
 
57
- ## Example 3: Mandatory Proof-of-Work Invariant
40
+ ## Relevant proof of work
58
41
 
59
- ### Anti-pattern: Claiming Task Complete Without Evidence
42
+ For an authorization fix, run an allowed-user case, a denied-user case, and the
43
+ affected integration checks. In this source checkout, skill consistency and
44
+ staged placeholder checks are separate commands:
60
45
 
61
- ```text
62
- BAD: "I have updated the authentication handler. The code looks correct and is ready to merge."
63
- ```
64
-
65
- ### Best practice: ContextOS Standard (Verified with Automated Gates)
66
-
67
- ```bash
68
- # GOOD: Run test suite, staged scanner, and consistency checks
69
- npm test
70
- contextos scan --staged --enforce
46
+ ```powershell
71
47
  node .agents/ctx.js validate
48
+ node bin/index.js scan --staged --enforce --placeholders
72
49
  ```
50
+
51
+ An empty staged index says nothing about unstaged changes. Supply --scope <file>
52
+ when an actual scope JSON file is part of the task.