@haposoft/cafekit 0.15.1 → 0.16.0-rc.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.
- package/README.md +6 -2
- package/bin/__tests__/codex-hooks.test.js +140 -0
- package/bin/__tests__/codex-native.test.js +230 -2
- package/bin/__tests__/develop-contract.test.js +1120 -0
- package/bin/__tests__/installer-safety.test.js +553 -2
- package/bin/__tests__/package-inventory.test.js +258 -0
- package/bin/__tests__/secret-scanner.test.js +157 -0
- package/bin/__tests__/validator-grounding.test.js +713 -0
- package/bin/install.js +5 -1
- package/bin/lib/codex-install.js +21 -6
- package/bin/lib/context.js +17 -6
- package/bin/lib/copy-utils.js +31 -0
- package/bin/lib/i18n.js +12 -3
- package/bin/lib/instruction-blocks.js +85 -0
- package/bin/lib/managed-writer.js +4 -1
- package/bin/lib/opencode-install.js +75 -30
- package/bin/lib/skill-deps.js +45 -7
- package/bin/phases/claude-runtime.js +103 -4
- package/bin/phases/codex-runtime.js +41 -7
- package/bin/phases/post-install.js +29 -22
- package/bin/phases/root-config.js +89 -10
- package/bin/phases/select-platform.js +23 -0
- package/bin/phases/skills-setup.js +7 -3
- package/package.json +15 -5
- package/src/claude/CLAUDE.md +6 -122
- package/src/claude/agents/code-auditor.md +21 -22
- package/src/claude/agents/debugger.md +3 -3
- package/src/claude/agents/deployer.md +1 -1
- package/src/claude/agents/{god-developer.md → implementer.md} +2 -2
- package/src/claude/agents/project-manager.md +1 -1
- package/src/claude/agents/spec-maker.md +2 -2
- package/src/claude/hooks/__tests__/spec-gate.test.js +356 -5
- package/src/claude/hooks/agent.cjs +7 -14
- package/src/claude/hooks/rules.cjs +33 -53
- package/src/claude/hooks/spec-gate.cjs +66 -21
- package/src/claude/hooks/spec-state.cjs +5 -0
- package/src/claude/migration-manifest.json +9 -2
- package/src/claude/runtime.json +0 -3
- package/src/claude/scripts/generate-skill-catalog.cjs +1 -1
- package/src/claude/scripts/scan-staged-secrets.cjs +170 -0
- package/src/claude/scripts/spec-ground.cjs +189 -83
- package/src/claude/scripts/validate-spec-output.cjs +294 -30
- package/src/claude/scripts/workflow-policy.cjs +609 -0
- package/src/claude/skills/ai-multimodal/SKILL.md +2 -2
- package/src/claude/skills/ai-multimodal/references/audio-processing.md +6 -6
- package/src/claude/skills/ai-multimodal/references/video-analysis.md +1 -1
- package/src/claude/skills/backend-development/SKILL.md +4 -4
- package/src/claude/skills/backend-development/references/backend-architecture.md +1 -1
- package/src/claude/skills/backend-development/references/backend-devops.md +2 -2
- package/src/claude/skills/backend-development/references/backend-mindset.md +3 -3
- package/src/claude/skills/backend-development/references/backend-performance.md +5 -5
- package/src/claude/skills/backend-development/references/backend-security.md +3 -3
- package/src/claude/skills/backend-development/references/backend-technologies.md +5 -5
- package/src/claude/skills/backend-development/references/backend-testing.md +2 -2
- package/src/claude/skills/brainstorm/SKILL.md +2 -3
- package/src/claude/skills/chrome-devtools/scripts/package-lock.json +261 -150
- package/src/claude/skills/chrome-devtools/scripts/package.json +1 -1
- package/src/claude/skills/code-review/SKILL.md +12 -8
- package/src/claude/skills/code-review/references/verification-gate.md +4 -4
- package/src/claude/skills/debug/SKILL.md +2 -0
- package/src/claude/skills/develop/SKILL.md +100 -52
- package/src/claude/skills/develop/references/parallel-waves.md +105 -26
- package/src/claude/skills/develop/references/quality-gate.md +58 -38
- package/src/claude/skills/develop/references/subagent-patterns.md +2 -2
- package/src/claude/skills/git/SKILL.md +44 -50
- package/src/claude/skills/hotfix/SKILL.md +10 -8
- package/src/claude/skills/hotfix/references/parallel-patterns.md +2 -2
- package/src/claude/skills/hotfix/references/review-cycle.md +26 -21
- package/src/claude/skills/inspect/SKILL.md +12 -30
- package/src/claude/skills/mobile-development/SKILL.md +12 -12
- package/src/claude/skills/mobile-development/references/mobile-android.md +7 -7
- package/src/claude/skills/mobile-development/references/mobile-best-practices.md +22 -23
- package/src/claude/skills/mobile-development/references/mobile-frameworks.md +13 -13
- package/src/claude/skills/mobile-development/references/mobile-ios.md +1 -1
- package/src/claude/skills/mobile-development/references/mobile-mindset.md +17 -19
- package/src/claude/skills/pptx/scripts/package-lock.json +868 -0
- package/src/claude/skills/pptx/scripts/package.json +1 -1
- package/src/claude/skills/question/SKILL.md +13 -13
- package/src/claude/skills/research/SKILL.md +2 -2
- package/src/claude/skills/specs/SKILL.md +32 -15
- package/src/claude/skills/specs/references/review.md +3 -3
- package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
- package/src/claude/skills/specs/templates/spec-state.json +7 -3
- package/src/claude/skills/sync/SKILL.md +26 -1
- package/src/claude/skills/sync/references/sync-protocols.md +3 -3
- package/src/claude/skills/test/SKILL.md +12 -4
- package/src/claude/skills/test/references/failure-triage.md +17 -17
- package/src/claude/skills/test/references/test-memory.md +2 -2
- package/src/codex/AGENTS.md +16 -24
- package/src/codex/hooks/lib/spec-receipt.cjs +57 -4
- package/src/codex/hooks/rules.cjs +27 -26
- package/src/codex/hooks/spec-gate.cjs +19 -8
- package/src/codex/hooks/spec-state.cjs +10 -1
- package/src/codex/hooks.json +14 -14
- package/src/common/AGENTS.md +43 -0
- package/src/opencode/AGENTS.md +21 -121
- package/src/opencode/plugins/rules.ts +26 -34
- package/src/opencode/plugins/spec-gate.ts +283 -0
- package/src/claude/skills/inspect/references/external-gemini-inspection.md +0 -169
|
@@ -10,6 +10,28 @@ Green tests are NOT enough. The gate requires four proofs:
|
|
|
10
10
|
|
|
11
11
|
`--flash` is the explicit fast path. It bypasses this full gate and uses the Flash Gate defined below.
|
|
12
12
|
|
|
13
|
+
Executable policy source: `src/claude/scripts/workflow-policy.cjs` (installed as `.claude/scripts/workflow-policy.cjs`). Use its tier delegation, verdict consumer, flash conflict, and promotion semantics; do not duplicate policy in prose or tests.
|
|
14
|
+
|
|
15
|
+
## Tier input (from develop Delegation policy)
|
|
16
|
+
|
|
17
|
+
Quality-gate input MUST include `execution_tier` and `ship_point`:
|
|
18
|
+
|
|
19
|
+
- **Light:** main session runs verification commands and the same spec-compliance checklist. Spawn zero `test-runner` or `code-auditor` subagents.
|
|
20
|
+
- **Standard:** main session runs tests and spec checks. At the ship point, run exactly one combined `code-auditor` review for spec compliance plus code quality.
|
|
21
|
+
- **Deep / `--parallel`:** retain the documented per-worktree Stage A+B chain in Track A. Do not treat that chain as a permanent product contract.
|
|
22
|
+
|
|
23
|
+
Checklist and FAIL conditions stay identical for every tier; tier changes only who executes each check and when.
|
|
24
|
+
|
|
25
|
+
## Spec compliance review
|
|
26
|
+
|
|
27
|
+
Stage A applies same spec compliance review checklist for every tier: scope, requirements, completion criteria, evidence, and runtime reachability. A missing or unreachable deliverable is a FAIL.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
- **Specific-task mode:** requested task is ship point. Review that task packet and its diff exactly once.
|
|
31
|
+
- **Full-spec Standard:** intermediate tasks receive only the main-session gate. After the final task and Final Integration Scout, run one combined auditor over the cumulative feature diff, all acceptance criteria, and runtime reachability.
|
|
32
|
+
- Do not set feature-level `code_done` or completion before combined auditor returns `PASS`.
|
|
33
|
+
- Auditor `FAIL` maps each finding to its owning task/surface. Fix only affected evidence, then rerun affected checks and the combined review; do not replay unrelated gates already passed.
|
|
34
|
+
|
|
13
35
|
## Automation Semantics
|
|
14
36
|
|
|
15
37
|
- If the task names exact commands in `## Evidence` (legacy heading aliases still parse), those exact commands are mandatory and must run before any fallback repo defaults.
|
|
@@ -38,6 +60,8 @@ Use this only when `/hapo:develop ... --flash` is present.
|
|
|
38
60
|
- `Mode: --flash`
|
|
39
61
|
- `Tests: skipped by user request`
|
|
40
62
|
- `Evidence: FLASH_UNVERIFIED`
|
|
63
|
+
- `Status: in_progress`
|
|
64
|
+
- `Blocker: awaiting /hapo:test <feature>`
|
|
41
65
|
- `Next verification: /hapo:test <feature>`
|
|
42
66
|
|
|
43
67
|
Terminal log:
|
|
@@ -65,46 +89,42 @@ START_LOOP:
|
|
|
65
89
|
---------------------------------------------------------------
|
|
66
90
|
STAGE A: Test + SPEC COMPLIANCE review
|
|
67
91
|
---------------------------------------------------------------
|
|
68
|
-
→
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
→
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
CASE
|
|
87
|
-
|
|
92
|
+
→ Light: main session executes exact Evidence commands, spec checklist,
|
|
93
|
+
artifact checks, and reachability checks; spawn 0 subagents.
|
|
94
|
+
→ Standard: main session executes exact Evidence commands and spec checklist;
|
|
95
|
+
defer one combined auditor to the ship point.
|
|
96
|
+
→ Deep / --parallel: run the documented per-task sequence `inspector → implementer → test-runner → code-auditor` in the
|
|
97
|
+
task worktree, then preserve its documented merge/integration gates.
|
|
98
|
+
|
|
99
|
+
Test result and review result use the review enum only: PASS | FAIL | BLOCKED.
|
|
100
|
+
PASS proceeds. FAIL returns actionable findings to implementer. BLOCKED means
|
|
101
|
+
execution proof, permissions, environment, or a user-owned decision is missing:
|
|
102
|
+
stop immediately and do not blind-retry.
|
|
103
|
+
|
|
104
|
+
Standard specific-task ship point:
|
|
105
|
+
→ run exactly one combined code-auditor review after Stage A PASS.
|
|
106
|
+
Standard full-spec ship point:
|
|
107
|
+
→ run exactly one combined code-auditor review after the final task and
|
|
108
|
+
Final Integration Scout over the cumulative feature diff.
|
|
109
|
+
|
|
110
|
+
CASE 1 — PRECHECK_FAIL OR Automated FAIL OR required command missing OR Evidence FAIL / UNVERIFIED OR Reachability FAIL:
|
|
111
|
+
- For FAIL: increment retry_count; return to implementation while retry_count < 3.
|
|
112
|
+
- For BLOCKED: stop without retry; record blocker and await resolution.
|
|
113
|
+
- If retry_count >= 3: COLLAPSE and ask for user intervention.
|
|
114
|
+
|
|
115
|
+
CASE 2 — Test PASS + Evidence PASS + spec checklist PASS:
|
|
116
|
+
→ Proceed to the ship-point review for Standard, or the Deep Stage B review.
|
|
88
117
|
|
|
89
118
|
STAGE B:
|
|
90
119
|
---------------------------------------------------------------
|
|
91
120
|
CODE QUALITY REVIEW (only after spec compliance passes)
|
|
92
121
|
---------------------------------------------------------------
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- If retry_count >= 3:
|
|
100
|
-
→ COLLAPSE! AskUserQuestion: "Code does not meet minimum standards! User intervention required!"
|
|
101
|
-
- If retry_count < 3:
|
|
102
|
-
→ Fix each review issue.
|
|
103
|
-
→ GOTO START_LOOP unless the fix is prose-only and cannot affect evidence; otherwise re-run Stage B.
|
|
104
|
-
|
|
105
|
-
CASE 4 — Test PASS + Evidence PASS + SPEC_PASS + Code quality review PASS (Score >= 9.5 AND Critical = 0):
|
|
106
|
-
→ PASS! Auto-approved.
|
|
107
|
-
→ PROCEED to completion report with a verification receipt summarizing exact commands executed, artifact/runtime/reachability proof, spec review result, and code quality review result.
|
|
122
|
+
Standard uses the combined auditor described above; Deep retains the existing
|
|
123
|
+
Stage B quality review chain inside each worktree.
|
|
124
|
+
→ PASS = no Critical, no High, at most one Medium; proceed to sync.
|
|
125
|
+
→ FAIL = findings mapped to task/surface; fix affected scope and rerun only
|
|
126
|
+
affected evidence plus this combined review.
|
|
127
|
+
→ BLOCKED = missing proof/permission/environment/user decision; stop, no blind retry.
|
|
108
128
|
```
|
|
109
129
|
|
|
110
130
|
## Critical Issue Definitions
|
|
@@ -124,10 +144,10 @@ STAGE B:
|
|
|
124
144
|
|
|
125
145
|
Must log the Quality Gate result to the terminal for user visibility:
|
|
126
146
|
|
|
127
|
-
- **Quick Pass:** `✓ Step 4 Quality Gate: Test PASS + Evidence PASS + Spec PASS + Review
|
|
128
|
-
- **Hard-Won Pass:** `✓ Step 4 Quality Gate: Failed 2 rounds → Test PASS + Evidence PASS + Spec PASS + Review
|
|
147
|
+
- **Quick Pass:** `✓ Step 4 Quality Gate: Test PASS + Evidence PASS + Spec PASS + Review PASS (no Critical, no High, at most one Medium) - Auto-Approved`
|
|
148
|
+
- **Hard-Won Pass:** `✓ Step 4 Quality Gate: Failed 2 rounds → Test PASS + Evidence PASS + Spec PASS + Review PASS (no Critical, no High, at most one Medium)`
|
|
129
149
|
- **Preflight Fail:** `[x] Step 4 Quality Gate: PRECHECK_FAIL → compile/typecheck/build failed before tests mattered`
|
|
130
|
-
- **Fix Needed:** `[~] Step 4 Quality Gate: Tests/spec/evidence failed → returned to
|
|
150
|
+
- **Fix Needed:** `[~] Step 4 Quality Gate: Tests/spec/evidence failed → returned to implementer`
|
|
131
151
|
- **Awaiting Rescue:** `[!] Step 4 Quality Gate: Failed 3 rounds! Awaiting user intervention...`
|
|
132
152
|
|
|
133
153
|
## Working directory (parallel mode)
|
|
@@ -15,7 +15,7 @@ Agent(subagent_type="inspector", prompt="Scan and identify all files related to
|
|
|
15
15
|
|
|
16
16
|
## Code Implementation Phase
|
|
17
17
|
```
|
|
18
|
-
Agent(subagent_type="
|
|
18
|
+
Agent(subagent_type="implementer", prompt="Implement the sub-tasks from [tasks-directory] based on the specification in [spec.json]", description="Code Feature [feature]")
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## UI Implementation Phase
|
|
@@ -25,7 +25,7 @@ Agent(subagent_type="ui-ux-designer", prompt="Implement the frontend code for [f
|
|
|
25
25
|
|
|
26
26
|
## Code Review Phase
|
|
27
27
|
```
|
|
28
|
-
Agent(subagent_type="code-auditor", prompt="Review all recently written code. Check for security holes, performance issues, and adherence to YAGNI/KISS/DRY. Return
|
|
28
|
+
Agent(subagent_type="code-auditor", prompt="Review all recently written code. Check for security holes, performance issues, and adherence to YAGNI/KISS/DRY. Return a verdict (PASS = no Critical, no High, at most one Medium), severity-classified findings, and concrete suggestions.", description="Review [phase]")
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Test Execution Phase
|
|
@@ -8,59 +8,53 @@ keywords: [git, commits, pr, worktree]
|
|
|
8
8
|
argument-hint: "commit | push | pr | finish | worktree <feature-desc>"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
|
-
version: "1.
|
|
11
|
+
version: "1.1.0"
|
|
12
12
|
---
|
|
13
13
|
# Git Operations & Worktree
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Git operations and worktree management using plain `git` commands.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Default (no arguments)
|
|
18
|
+
Present options via AskUserQuestion — header "Git Operation": commit / push / pr / finish / worktree.
|
|
18
19
|
|
|
19
20
|
## Commands
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
- If running inside a git worktree, detect it with `git worktree list` and clean up only the worktree created for this task.
|
|
61
|
-
|
|
62
|
-
## References & Protocols
|
|
63
|
-
|
|
64
|
-
- `references/commit-protocols.md`: Strict rules for analyzing Git Diffs and determining commit splitting behavior.
|
|
65
|
-
- `references/finish-branch.md`: Finish branch / PR / worktree closeout protocol.
|
|
66
|
-
- `references/worktree-blueprint.md`: The 4-step Bash process to accurately construct an out-of-bounds Git Worktree Environment.
|
|
21
|
+
- `commit`: run installed secret scanner → analyze diff → split into conventional commits.
|
|
22
|
+
- `push`: push current branch.
|
|
23
|
+
- `pr`: push + open PR. Target = repo's integration branch — detect via
|
|
24
|
+
`gh repo view --json defaultBranchRef` or `origin/HEAD`; never assume `main`/`develop`.
|
|
25
|
+
- `finish`: fresh `git status` + verification, then present exactly 4 options:
|
|
26
|
+
merge locally / push + PR / keep branch-worktree / discard (typed confirmation).
|
|
27
|
+
- `worktree <desc>`: sibling dir `../<project>-<branch>` for isolated setup.
|
|
28
|
+
|
|
29
|
+
## Secret scan (before every commit)
|
|
30
|
+
```bash
|
|
31
|
+
node .claude/scripts/scan-staged-secrets.cjs
|
|
32
|
+
```
|
|
33
|
+
The helper parses `git diff --cached --unified=0 --no-color --diff-filter=ACMR`, checks added lines only, maps hunks to source lines, and prints only file, line, and identifier. It never prints secret values or context.
|
|
34
|
+
|
|
35
|
+
Match → STOP. For an untracked secret, add an appropriate `.gitignore` rule. For a tracked secret, stop, rotate it, and ask the user before changing history or index state.
|
|
36
|
+
|
|
37
|
+
## Split rules
|
|
38
|
+
Split when: mixed types (feat+fix), mixed scopes, config/deps mixed with code, >10 unrelated files.
|
|
39
|
+
Single commit when: same type+scope, ≤3 files, ≤50 lines.
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
```
|
|
43
|
+
✓ staged: N files (+X/-Y)
|
|
44
|
+
✓ secrets: none
|
|
45
|
+
✓ commit: <hash> type(scope): description
|
|
46
|
+
✓ pushed: yes|no
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Errors
|
|
50
|
+
| Error | Action |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Secrets matched | Block; report only file/source line/identifier. Never show secret value, diff line, or surrounding context. |
|
|
53
|
+
| Nothing staged | Exit cleanly |
|
|
54
|
+
| Push rejected | Suggest `git pull --rebase` |
|
|
55
|
+
| Conflicts | List files; never auto-resolve |
|
|
56
|
+
|
|
57
|
+
Never force-push or delete a worktree without explicit confirmation.
|
|
58
|
+
|
|
59
|
+
## References
|
|
60
|
+
- `references/commit-protocols.md` · `references/finish-branch.md` · `references/worktree-blueprint.md`
|
|
@@ -17,7 +17,7 @@ Kill bugs systematically. No guessing. Evidence first, fix second.
|
|
|
17
17
|
## Arguments
|
|
18
18
|
|
|
19
19
|
- `--quick` - Reduced-depth path for trivial issues (lint, type errors, syntax); still scout-first
|
|
20
|
-
- `--parallel` - Spawn multiple `
|
|
20
|
+
- `--parallel` - Spawn multiple `implementer` agents for independent issues
|
|
21
21
|
- `--from-debug` - Start from an existing `hapo:debug` report and validate its root-cause contract
|
|
22
22
|
|
|
23
23
|
Default: deterministic scout-first hotfix. There is no initial mode selection step.
|
|
@@ -26,6 +26,8 @@ Default: deterministic scout-first hotfix. There is no initial mode selection st
|
|
|
26
26
|
Do NOT propose or implement fixes before completing Steps 1-2 (Scout + `hapo:debug` diagnosis).
|
|
27
27
|
Symptom fixes are FAILURE. Find the root cause first.
|
|
28
28
|
The exact root-cause contract is mandatory: symptom, reproduction, expected/actual, root cause file:line or config/env source, why now, evidence chain, blast radius.
|
|
29
|
+
Answer each item in one concrete sentence.
|
|
30
|
+
If any answer contains 'probably', 'I think', 'something with', or 'maybe' — it is not an answer; gather evidence instead.
|
|
29
31
|
The side-effect gate is mandatory before completion.
|
|
30
32
|
If 3+ fix attempts fail → STOP. Question the architecture. Discuss with user.
|
|
31
33
|
Exception: `--quick` mode only abbreviates depth; it never skips scout, pre-fix evidence, diagnosis, or before/after verification.
|
|
@@ -51,10 +53,10 @@ The fix is not done until Step 5 proves:
|
|
|
51
53
|
5. Public contracts are unchanged unless intentionally called out: function signatures, exported types, response shapes, DB schemas, env vars.
|
|
52
54
|
|
|
53
55
|
If verification reveals a side effect or regression, STOP and present 2-4 concrete options to the user:
|
|
54
|
-
- Revert this fix and try a different root-cause angle
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
- Accept the behavior
|
|
56
|
+
- Revert this fix and try a different root-cause angle
|
|
57
|
+
- Keep the fix and update <dependent files> to match the new contract
|
|
58
|
+
- Narrow the fix to <subset> so the regression disappears
|
|
59
|
+
- Accept the change — the old behavior was itself a bug
|
|
58
60
|
Do not silently patch around the regression.
|
|
59
61
|
</HARD-GATE-NO-SIDE-EFFECTS>
|
|
60
62
|
|
|
@@ -166,7 +168,7 @@ If any field is vague (`probably`, `maybe`, `I think`, or missing file:line/conf
|
|
|
166
168
|
| **Trivial** | Single file, clear error, type/lint/syntax | Quick: straight to fix |
|
|
167
169
|
| **Standard** | Multi-file, root cause identified via diagnosis | Standard: fix + regression test |
|
|
168
170
|
| **Complex** | System-wide, architecture impact, unclear boundaries | Deep: research + plan + fix |
|
|
169
|
-
| **Parallel** | 2+ independent issues OR `--parallel` flag | Spawn `
|
|
171
|
+
| **Parallel** | 2+ independent issues OR `--parallel` flag | Spawn `implementer` agents per issue |
|
|
170
172
|
|
|
171
173
|
**Task Orchestration (Standard+ only):**
|
|
172
174
|
- Use `TaskCreate` with dependencies to track fix phases
|
|
@@ -203,7 +205,7 @@ If any field is vague (`probably`, `maybe`, `I think`, or missing file:line/conf
|
|
|
203
205
|
|
|
204
206
|
### Parallel Workflow
|
|
205
207
|
1. Create separate `TaskCreate` per independent issue
|
|
206
|
-
2. Spawn `
|
|
208
|
+
2. Spawn `implementer` subagents — one per issue
|
|
207
209
|
3. Each agent follows Steps 1-5 independently
|
|
208
210
|
4. Aggregate results upon completion
|
|
209
211
|
|
|
@@ -274,7 +276,7 @@ Unified step markers (emit after each step):
|
|
|
274
276
|
| `hapo:code-review` | After fix, quality check (Step 5) |
|
|
275
277
|
| `git-ops` | Commit changes (Step 6) |
|
|
276
278
|
| `docs-keeper` | Update docs if behavior changed (Step 6) |
|
|
277
|
-
| `
|
|
279
|
+
| `implementer` | Parallel independent issues (each gets own agent) |
|
|
278
280
|
|
|
279
281
|
## Specialized Paths
|
|
280
282
|
|
|
@@ -9,7 +9,7 @@ How to effectively leverage multiple subagents (the `Agent` tool) and native tas
|
|
|
9
9
|
| Searching for root cause across 3+ directories | Parallel scout | `Explore` × 2-3 |
|
|
10
10
|
| Testing 2-3 diagnostic hypotheses simultaneously | Parallel hypothesis test | `Explore` × 2-3 |
|
|
11
11
|
| Verifying fix (typecheck + lint + build + test) | Parallel verification | `Bash` × 3-4 |
|
|
12
|
-
| Fixing 2+ independent bugs in one session | Parallel issue trees | `
|
|
12
|
+
| Fixing 2+ independent bugs in one session | Parallel issue trees | `implementer` × N |
|
|
13
13
|
| Deep workflow: scout + diagnose + research together | Parallel investigation | Mixed |
|
|
14
14
|
|
|
15
15
|
## Pattern A: Parallel Scouting
|
|
@@ -71,7 +71,7 @@ B4 = TaskCreate(subject="[Auth] Verify + test", addBlockedBy=[B3])
|
|
|
71
71
|
TaskCreate(subject="Integration verification", addBlockedBy=[A4, B4])
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Spawn one `
|
|
74
|
+
Spawn one `implementer` agent per issue tree. Each agent claims tasks via `TaskUpdate(status="in_progress")` and completes via `TaskUpdate(status="completed")`.
|
|
75
75
|
|
|
76
76
|
## Pattern E: Deep Workflow — Parallel Investigation Phase
|
|
77
77
|
|
|
@@ -4,53 +4,58 @@ How to handle code review results after a fix is implemented. Ensures quality wi
|
|
|
4
4
|
|
|
5
5
|
## Default Review Handling
|
|
6
6
|
|
|
7
|
-
The agent reviews its own fix using `hapo:code-review` and decides automatically:
|
|
7
|
+
The agent reviews its own fix using `hapo:code-review` and decides automatically. Every review returns exactly one verdict: `PASS | FAIL | BLOCKED`.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
attempt = 0
|
|
11
11
|
LOOP:
|
|
12
|
-
1. Trigger hapo:code-review → receives:
|
|
12
|
+
1. Trigger hapo:code-review → receives: verdict and severity-classified findings
|
|
13
13
|
|
|
14
14
|
2. Evaluate:
|
|
15
|
-
IF
|
|
16
|
-
→ ACCEPT. Log: "✓ Review
|
|
15
|
+
IF verdict == PASS (no Critical, no High, at most one Medium):
|
|
16
|
+
→ ACCEPT. Log: "✓ Review PASS — auto-approved"
|
|
17
17
|
→ Proceed to Step 6 (Finalize)
|
|
18
18
|
|
|
19
|
-
ELSE IF
|
|
20
|
-
→
|
|
19
|
+
ELSE IF verdict == BLOCKED:
|
|
20
|
+
→ TERMINAL STOP. Do not blind-retry.
|
|
21
|
+
→ Present the blocker and required execution proof, permission, environment,
|
|
22
|
+
or user-owned decision to the user.
|
|
23
|
+
|
|
24
|
+
ELSE IF verdict == FAIL AND attempt < 3:
|
|
25
|
+
→ AUTO-REMEDIATE the reported findings
|
|
21
26
|
→ Re-run verification (typecheck + lint + test)
|
|
22
27
|
→ attempt += 1
|
|
23
28
|
→ GOTO LOOP
|
|
24
29
|
|
|
25
|
-
ELSE IF attempt >= 3:
|
|
30
|
+
ELSE IF verdict == FAIL AND attempt >= 3:
|
|
26
31
|
→ HALT. Present findings to user:
|
|
27
|
-
"3 auto-fix cycles exhausted. [N]
|
|
32
|
+
"3 auto-fix cycles exhausted. [N] blocking findings remain."
|
|
28
33
|
Options: "Fix manually" | "Approve with known issues" | "Abort"
|
|
29
|
-
|
|
30
|
-
ELSE (score < 9.0, zero critical):
|
|
31
|
-
→ ACCEPT with advisory. Log: "✓ Review [score]/10 — approved, [N] warnings noted"
|
|
32
|
-
→ Proceed to Step 6
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
`BLOCKED` is terminal for this review cycle. Only `FAIL` may enter remediation retry; never retry a blocked review unchanged.
|
|
37
|
+
|
|
35
38
|
## Required User Pause
|
|
36
39
|
|
|
37
40
|
When the fix touches production-critical code, changes public contracts, introduces a behavior change, or the user explicitly requests review control:
|
|
38
41
|
|
|
39
|
-
1. Run `hapo:code-review` → collect
|
|
42
|
+
1. Run `hapo:code-review` → collect verdict + severity findings
|
|
40
43
|
2. Present a structured summary to user:
|
|
41
44
|
```
|
|
42
45
|
┌──────────────────────────────────┐
|
|
43
|
-
│ Review
|
|
46
|
+
│ Review Verdict: [PASS | FAIL | BLOCKED] │
|
|
44
47
|
├──────────────────────────────────┤
|
|
45
|
-
│ Critical: [list or "none"]
|
|
46
|
-
│
|
|
47
|
-
│
|
|
48
|
+
│ Critical: [list or "none"] │
|
|
49
|
+
│ High: [list or "none"] │
|
|
50
|
+
│ Medium: [list or "none"] │
|
|
51
|
+
│ Low: [list or "none"] │
|
|
48
52
|
└──────────────────────────────────┘
|
|
49
53
|
```
|
|
50
54
|
3. Ask user for direction:
|
|
51
|
-
- If
|
|
52
|
-
- If
|
|
53
|
-
|
|
55
|
+
- If verdict is `BLOCKED` → resolve the blocker; do not retry this review cycle unchanged.
|
|
56
|
+
- If verdict is `FAIL` with Critical or High findings → "Fix blocking findings" | "Fix all" | "Approve anyway" | "Abort"
|
|
57
|
+
- If verdict is `FAIL` with only Medium/Low findings → "Approve" | "Address findings" | "Abort"
|
|
58
|
+
4. Execute user's choice. Max 3 remediation cycles for `FAIL`; `BLOCKED` never enters this retry limit.
|
|
54
59
|
|
|
55
60
|
## When To Pause vs Continue
|
|
56
61
|
|
|
@@ -64,7 +69,7 @@ When the fix touches production-critical code, changes public contracts, introdu
|
|
|
64
69
|
|
|
65
70
|
## Blocking Issues (Never Auto-Approve)
|
|
66
71
|
|
|
67
|
-
Regardless of
|
|
72
|
+
Regardless of verdict, always flag and pause for these:
|
|
68
73
|
- Injection vulnerabilities (SQL, XSS, command injection)
|
|
69
74
|
- Authentication/authorization bypasses
|
|
70
75
|
- Unbounded resource consumption (∞ loops, uncontrolled allocations)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:inspect
|
|
3
|
-
description: "Fast codebase discovery using parallel agents. Use for file discovery, task context gathering, quick searches across directories. Supports internal
|
|
3
|
+
description: "Fast codebase discovery using parallel agents. Use for file discovery, task context gathering, quick searches across directories. Supports internal Explore agents."
|
|
4
4
|
user-invocable: true
|
|
5
5
|
when_to_use: "Invoke for fast parallel codebase discovery and file location."
|
|
6
6
|
category: discovery
|
|
7
7
|
keywords: [discovery, search, explore, context]
|
|
8
|
-
argument-hint: "[search-target]
|
|
8
|
+
argument-hint: "[search-target]"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
|
-
version: "2.
|
|
11
|
+
version: "2.1.0"
|
|
12
12
|
---
|
|
13
13
|
# Inspect
|
|
14
14
|
|
|
@@ -16,7 +16,6 @@ Fast, token-efficient codebase discovery using parallel agents to find files nee
|
|
|
16
16
|
|
|
17
17
|
## Arguments
|
|
18
18
|
- Default: Inspect using built-in Explore subagents in parallel (`./references/internal-inspection.md`)
|
|
19
|
-
- `ext`: Inspect using external Gemini CLI tool in parallel (`./references/external-gemini-inspection.md`)
|
|
20
19
|
|
|
21
20
|
## When to Use
|
|
22
21
|
|
|
@@ -24,9 +23,9 @@ Fast, token-efficient codebase discovery using parallel agents to find files nee
|
|
|
24
23
|
- Debugging that needs file relationships; project structure questions
|
|
25
24
|
- Before multi-area changes, review, debug, or impact analysis
|
|
26
25
|
|
|
27
|
-
## Preflight Scope Gate (MANDATORY
|
|
26
|
+
## Preflight Scope Gate (MANDATORY)
|
|
28
27
|
|
|
29
|
-
Before scanning
|
|
28
|
+
Before scanning:
|
|
30
29
|
1. Detect repo-root or root-wide scans such as `.`, `/`, `./`, `**/*`, `**/*.ts`, or similar broad patterns without a scoped directory.
|
|
31
30
|
2. Apply the built-in no-scan lists below.
|
|
32
31
|
3. Prefer file-type or glob hints whenever possible.
|
|
@@ -38,14 +37,14 @@ Before scanning with ANY mode (internal or external):
|
|
|
38
37
|
Spawn **one scout** to map top-level layout before dividing work:
|
|
39
38
|
1. List immediate children of the scope root (dirs + key config; monorepo markers)
|
|
40
39
|
2. Rough file count per discovered directory
|
|
41
|
-
3. Return a division plan of 1–
|
|
40
|
+
3. Return a division plan of 1–10 logical sub-scopes (path/glob, est. files, focus)
|
|
42
41
|
|
|
43
42
|
Wait for Scout before Phase 2.
|
|
44
43
|
|
|
45
44
|
### Phase 2 — Parallel Explore Agents (Based on Scout Results)
|
|
46
45
|
|
|
47
46
|
1. Follow Scout's plan; merge scopes < 10 files; split scopes > 100 files
|
|
48
|
-
2. Spawn parallel Explore agents
|
|
47
|
+
2. Spawn parallel Explore agents, one per sub-scope
|
|
49
48
|
3. Aggregate into the Inspect Report; offer deeper follow-up on specific areas
|
|
50
49
|
|
|
51
50
|
**Fallback to AskUserQuestion:** if Scout is ambiguous (flat layout, < 3 areas), offer 2–4 concrete scopes from findings, then re-invoke with the chosen scope.
|
|
@@ -60,19 +59,6 @@ Wait for Scout before Phase 2.
|
|
|
60
59
|
- private keys, token dumps, credential exports, `.env` secrets
|
|
61
60
|
- generated bundles, binary blobs
|
|
62
61
|
|
|
63
|
-
## Configuration
|
|
64
|
-
|
|
65
|
-
Read from `.claude/runtime.json`:
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"gemini": {
|
|
69
|
-
"model": "gemma-4-31b-it"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Default model: `gemma-4-31b-it` (installed with `npx @haposoft/cafekit`).
|
|
75
|
-
|
|
76
62
|
## Workflow
|
|
77
63
|
|
|
78
64
|
### 1. Analyze Task
|
|
@@ -86,7 +72,7 @@ SCALE = ceil(estimated_files_to_scan / 50)
|
|
|
86
72
|
|
|
87
73
|
- Min SCALE = 1; Max SCALE = 10
|
|
88
74
|
- SCALE 1-2: focused (< 100 files)
|
|
89
|
-
- SCALE 3-5: medium
|
|
75
|
+
- SCALE 3-5: medium
|
|
90
76
|
- SCALE 6-10: large (internal Explore agents)
|
|
91
77
|
|
|
92
78
|
### 2. Divide and Conquer
|
|
@@ -101,16 +87,13 @@ SCALE = ceil(estimated_files_to_scan / 50)
|
|
|
101
87
|
|
|
102
88
|
| Condition | Mode |
|
|
103
89
|
|---|---|
|
|
104
|
-
|
|
|
105
|
-
| `ext` + SCALE ≤ 5 | Gemini CLI (if available + scope gate passed) |
|
|
106
|
-
| `ext` + SCALE ≥ 6 | Internal Explore agents |
|
|
107
|
-
| Gemini unavailable/fails | Fallback to internal Explore |
|
|
90
|
+
| Always | Internal Explore agents |
|
|
108
91
|
|
|
109
|
-
Load: **Internal** `./references/internal-inspection.md
|
|
92
|
+
Load: **Internal** `./references/internal-inspection.md`.
|
|
110
93
|
|
|
111
94
|
### 5. Spawn Parallel Agents
|
|
112
95
|
|
|
113
|
-
|
|
96
|
+
Dispatch native Explore agents with breadth medium/very-thorough + the Scope Gate above. Details: `./references/internal-inspection.md`.
|
|
114
97
|
|
|
115
98
|
- `TaskUpdate` each task to `in_progress` before spawn
|
|
116
99
|
- Prompt each subagent with exact directories/files; each has < 200K context
|
|
@@ -147,5 +130,4 @@ Load: **Internal** `./references/internal-inspection.md` or **External** `./refe
|
|
|
147
130
|
|
|
148
131
|
## References
|
|
149
132
|
|
|
150
|
-
- `./references/internal-inspection.md` - Using Explore subagents
|
|
151
|
-
- `./references/external-gemini-inspection.md` - Using Gemini CLI
|
|
133
|
+
- `./references/internal-inspection.md` - Using Explore subagents
|
|
@@ -31,8 +31,8 @@ Production-ready mobile development with modern frameworks, best practices, and
|
|
|
31
31
|
## Technology Selection Guide
|
|
32
32
|
|
|
33
33
|
**Cross-Platform Frameworks:**
|
|
34
|
-
- **React Native**: JavaScript expertise, web code sharing, mature ecosystem
|
|
35
|
-
- **Flutter**: Performance-critical apps, complex animations, fastest-growing
|
|
34
|
+
- **React Native**: JavaScript expertise, web code sharing, mature ecosystem
|
|
35
|
+
- **Flutter**: Performance-critical apps, complex animations, fastest-growing
|
|
36
36
|
|
|
37
37
|
**Native Development:**
|
|
38
38
|
- **iOS (Swift/SwiftUI)**: Maximum iOS performance, latest features, Apple ecosystem integration
|
|
@@ -44,7 +44,7 @@ See: `references/mobile-frameworks.md` for detailed framework comparisons
|
|
|
44
44
|
|
|
45
45
|
**The 10 Commandments of Mobile Development:**
|
|
46
46
|
|
|
47
|
-
1. **Performance is Foundation, Not Feature** -
|
|
47
|
+
1. **Performance is Foundation, Not Feature** - Slow load times can drive users away
|
|
48
48
|
2. **Every Kilobyte, Every Millisecond Matters** - Mobile constraints are real
|
|
49
49
|
3. **Offline-First by Default** - Network is unreliable, design for it
|
|
50
50
|
4. **User Context > Developer Environment** - Think real-world usage scenarios
|
|
@@ -72,7 +72,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
72
72
|
## Key Best Practices (2024-2025)
|
|
73
73
|
|
|
74
74
|
**Performance Targets:**
|
|
75
|
-
- App launch: <2 seconds
|
|
75
|
+
- App launch: <2 seconds; slow launches risk abandonment
|
|
76
76
|
- Memory usage: <100MB for typical screens
|
|
77
77
|
- Network requests: Batch and cache aggressively
|
|
78
78
|
- Battery impact: Respect Doze Mode and background restrictions
|
|
@@ -92,7 +92,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
92
92
|
- Implement proper session management
|
|
93
93
|
|
|
94
94
|
**Testing Strategy:**
|
|
95
|
-
- Unit tests:
|
|
95
|
+
- Unit tests: meaningful coverage for business logic
|
|
96
96
|
- Integration tests: Critical user flows
|
|
97
97
|
- E2E tests: Detox (React Native), Appium (cross-platform), XCUITest (iOS), Espresso (Android)
|
|
98
98
|
- Real device testing mandatory before release
|
|
@@ -101,7 +101,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
101
101
|
- Fastlane for automation across platforms
|
|
102
102
|
- Staged rollouts: Internal → Closed → Open → Production
|
|
103
103
|
- Mandatory: iOS 17 SDK (2024), Android 15 API 35 (Aug 2025)
|
|
104
|
-
- CI/CD saves
|
|
104
|
+
- CI/CD saves development time
|
|
105
105
|
|
|
106
106
|
## Quick Decision Matrix
|
|
107
107
|
|
|
@@ -121,9 +121,9 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
121
121
|
|
|
122
122
|
| Criterion | React Native | Flutter | Swift/SwiftUI | Kotlin/Compose |
|
|
123
123
|
|-----------|--------------|---------|---------------|----------------|
|
|
124
|
-
| **
|
|
125
|
-
| **Adoption** |
|
|
126
|
-
| **Performance** |
|
|
124
|
+
| **Community footprint** | Large | Large | Apple ecosystem | Android ecosystem |
|
|
125
|
+
| **Adoption** | Established | Established | iOS only | Android only |
|
|
126
|
+
| **Performance** | Near-native when profiled | Near-native when profiled | Native baseline | Native baseline |
|
|
127
127
|
| **Dev Speed** | Fast (hot reload) | Very fast (hot reload) | Fast (Xcode Previews) | Fast (Live Edit) |
|
|
128
128
|
| **Learning Curve** | Easy (JavaScript) | Medium (Dart) | Medium (Swift) | Medium (Kotlin) |
|
|
129
129
|
| **UI Paradigm** | Component-based | Widget-based | Declarative | Declarative |
|
|
@@ -148,7 +148,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
148
148
|
- Image optimization → Lazy loading → Memory profiling → Network optimization → Battery testing → Launch time optimization
|
|
149
149
|
|
|
150
150
|
**Quality:**
|
|
151
|
-
- Unit tests
|
|
151
|
+
- Unit tests → Integration tests → E2E tests → Accessibility testing → Performance testing → Security audit
|
|
152
152
|
|
|
153
153
|
**Security:**
|
|
154
154
|
- Secure storage → Authentication flow → Network security → Input validation → Session management → Encryption
|
|
@@ -179,7 +179,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
179
179
|
3. **No offline handling** - Network failures will happen
|
|
180
180
|
4. **Poor memory management** - Leads to crashes and poor UX
|
|
181
181
|
5. **Hardcoded credentials** - Security vulnerability
|
|
182
|
-
6. **No accessibility** -
|
|
182
|
+
6. **No accessibility** - Can exclude users
|
|
183
183
|
7. **Premature optimization** - Optimize based on metrics, not assumptions
|
|
184
184
|
8. **Over-engineering** - Start simple, scale as needed
|
|
185
185
|
9. **Skipping real device testing** - Simulators don't show battery/network issues
|
|
@@ -193,7 +193,7 @@ See: `references/mobile-mindset.md` for thinking patterns and decision framework
|
|
|
193
193
|
- **Screen load**: <1 second for cached data
|
|
194
194
|
- **Network request**: <3 seconds for API calls
|
|
195
195
|
- **Memory**: <100MB for typical screens, <200MB peak
|
|
196
|
-
- **Battery**:
|
|
196
|
+
- **Battery**: Minimize drain during active use
|
|
197
197
|
- **Frame rate**: 60 FPS (16.67ms per frame)
|
|
198
198
|
|
|
199
199
|
## Resources
|