@meyverick/agentic 5.0.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 (77) hide show
  1. package/AGENTS.md +234 -0
  2. package/CHANGELOG.md +236 -0
  3. package/README.md +50 -0
  4. package/install.ts +349 -0
  5. package/package.json +37 -0
  6. package/scripts/check-deps.mjs +587 -0
  7. package/scripts/git-dl.mjs +100 -0
  8. package/skills/check/SKILL.md +108 -0
  9. package/skills/check/evals/benchmark.json +40 -0
  10. package/skills/check/evals/evals.json +38 -0
  11. package/skills/check/references/diagnostic-matrix.md +170 -0
  12. package/skills/check/references/script-anatomy.md +154 -0
  13. package/skills/create-skill/SKILL.md +291 -0
  14. package/skills/create-skill/assets/templates/SKILL.md.template +118 -0
  15. package/skills/create-skill/assets/templates/evals.json.template +36 -0
  16. package/skills/create-skill/assets/templates/grading.json.template +26 -0
  17. package/skills/create-skill/evals/benchmark.json +41 -0
  18. package/skills/create-skill/evals/evals.json +50 -0
  19. package/skills/create-skill/evals/grading-template.json +36 -0
  20. package/skills/create-skill/evals/near-misses.json +35 -0
  21. package/skills/create-skill/evals/trigger-queries.json +80 -0
  22. package/skills/create-skill/references/antipatterns.md +123 -0
  23. package/skills/create-skill/references/component-decomposition.md +130 -0
  24. package/skills/create-skill/references/content-quality-criteria.md +61 -0
  25. package/skills/create-skill/references/description-optimization.md +90 -0
  26. package/skills/create-skill/references/eval-methodology.md +100 -0
  27. package/skills/create-skill/references/fragility-matching.md +88 -0
  28. package/skills/create-skill/references/gotchas-patterns.md +80 -0
  29. package/skills/create-skill/references/specification.md +77 -0
  30. package/skills/create-skill/scripts/audit-antipatterns.mjs +164 -0
  31. package/skills/create-skill/scripts/compute-benchmark.mjs +111 -0
  32. package/skills/create-skill/scripts/run-cold-eval.mjs +118 -0
  33. package/skills/create-skill/scripts/scaffold-skill.mjs +86 -0
  34. package/skills/create-skill/scripts/validate-routing.mjs +137 -0
  35. package/skills/create-skill/scripts/validate-structure.mjs +223 -0
  36. package/skills/design-craft/SKILL.md +134 -0
  37. package/skills/design-craft/evals/benchmark.json +41 -0
  38. package/skills/design-craft/evals/evals.json +81 -0
  39. package/skills/design-craft/references/anti-slop-patterns.md +49 -0
  40. package/skills/design-craft/references/art-direction.md +89 -0
  41. package/skills/design-craft/references/design-engineering.md +122 -0
  42. package/skills/design-craft/references/motion-craft.md +124 -0
  43. package/skills/design-craft/references/process.md +47 -0
  44. package/skills/design-craft/references/review-checklist.md +121 -0
  45. package/skills/guardrails/SKILL.md +118 -0
  46. package/skills/guardrails/evals/benchmark.json +40 -0
  47. package/skills/guardrails/evals/evals.json +49 -0
  48. package/skills/guardrails/references/guardrails-patterns.md +43 -0
  49. package/skills/okf-docs/SKILL.md +79 -0
  50. package/skills/okf-docs/evals/benchmark.json +21 -0
  51. package/skills/okf-docs/evals/evals.json +37 -0
  52. package/skills/okf-docs/references/okf-spec.md +56 -0
  53. package/skills/okf-docs/scripts/validate-frontmatter.mjs +130 -0
  54. package/skills/openspec-harden/SKILL.md +138 -0
  55. package/skills/openspec-harden/evals/benchmark.json +40 -0
  56. package/skills/openspec-harden/evals/evals.json +38 -0
  57. package/skills/openspec-learn/SKILL.md +216 -0
  58. package/skills/openspec-learn/evals/benchmark.json +44 -0
  59. package/skills/openspec-learn/evals/evals.json +48 -0
  60. package/skills/openspec-learn/evals/retrieval-bench.json +27 -0
  61. package/skills/openspec-learn/references/conflict-handling.md +20 -0
  62. package/skills/openspec-learn/references/evaluation-methodology.md +126 -0
  63. package/skills/openspec-learn/references/examples.md +37 -0
  64. package/skills/openspec-learn/references/improvement-patterns.md +155 -0
  65. package/skills/openspec-learn/references/report-analysis.md +104 -0
  66. package/skills/openspec-learn/references/skill-quality.md +103 -0
  67. package/skills/openspec-learn/references/tool-type-detection.md +30 -0
  68. package/skills/openspec-report/SKILL.md +104 -0
  69. package/skills/openspec-report/assets/templates/assessment.md.template +84 -0
  70. package/skills/openspec-report/assets/templates/report.md.template +92 -0
  71. package/skills/openspec-report/evals/benchmark.json +44 -0
  72. package/skills/openspec-report/evals/evals.json +46 -0
  73. package/skills/qmd-research/SKILL.md +89 -0
  74. package/skills/qmd-research/evals/benchmark.json +40 -0
  75. package/skills/qmd-research/evals/evals.json +38 -0
  76. package/skills/qmd-research/references/index-management.md +69 -0
  77. package/skills/qmd-research/references/query-craft.md +82 -0
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: check
3
+ description: >
4
+ Execute and interpret local workspace and submodule check-gates to verify project integrity before push.
5
+ Use when verifying code changes, running pre-flight gates, diagnosing check.sh failures, or confirming clean-clone buildability.
6
+ Do NOT use when only reading or exploring code without modifications, or when planning changes before implementation.
7
+ allowed-tools: Bash(*)
8
+ license: MIT
9
+ compatibility: Requires bash and git.
10
+ metadata:
11
+ author: agentic
12
+ version: "1.0.0"
13
+ positive_triggers:
14
+ - "verify workspace integrity and run check gate"
15
+ - "execute check.sh and interpret gate failures"
16
+ - "run pre-flight check gate before completion"
17
+ - "diagnose clean-clone build or pointer desync failure"
18
+ anti_triggers:
19
+ - "only reading or exploring code without modifying it"
20
+ - "planning a change before implementation begins"
21
+ ---
22
+
23
+ # Check Gate Handbook
24
+
25
+ A specialized reference manual and textbook instructing AI agents on how to execute local workspace check-gates, observe the two-speed verification protocol, interpret gate failure diagnostics, and apply autonomous self-healing recipes.
26
+
27
+ ## Activation Boundary
28
+
29
+ **Consult this textbook when:**
30
+ - Executing `./scripts/check.sh` during the Pre-response self-audit (`project/AGENTS.md` §10).
31
+ - Diagnosing why a local check gate, clean-clone build, or submodule pointer verification failed.
32
+ - Confirming that all subprojects and orchestrators pass before reporting task completion.
33
+
34
+ **Do NOT consult when:**
35
+ - Only reading, searching, or exploring the codebase without making mutations.
36
+ - Authoring plans, proposals, or designs prior to implementation.
37
+
38
+ ## The Two-Speed Gate Protocol
39
+
40
+ Local verification operates at two distinct speeds to balance development velocity with release hermeticity:
41
+
42
+ ```
43
+ Fast Loop (--quick) Full Pre-Flight Gate (Default)
44
+ Speed: 3 - 10 seconds Speed: 20 - 45 seconds
45
+ When: Active development iteration When: Task completion / Pre-push
46
+ Runs: Runs:
47
+ [1] Code format verification [1] Code format verification
48
+ [2] Strict linter execution [2] Strict linter execution
49
+ [3] Fast unit/integration tests [3] Fast unit/integration tests
50
+ [4] Static cross-boundary contracts [4] Static cross-boundary contracts
51
+ [5] Tracked compile-time includes [5] Tracked compile-time includes
52
+ [6] Hermetic clean-clone sandbox
53
+ [7] Runtime smoke / browser test
54
+ ```
55
+
56
+ ### 1. The Fast Loop (`--quick`)
57
+ Pass `--quick` as the first argument when validating intermediate code edits:
58
+ ```bash
59
+ ./scripts/check.sh --quick
60
+ # Or for a specific submodule:
61
+ ./<submodule-path>/scripts/check.sh --quick
62
+ ```
63
+ This executes all native linters, compilers, and static asset checks, but skips the clean-clone build and browser smoke tests, returning actionable feedback in seconds.
64
+
65
+ ### 2. The Full Pre-Flight Gate
66
+ Always execute the unflagged gate before marking any code-modifying task `[Completed]`:
67
+ ```bash
68
+ ./scripts/check.sh
69
+ ```
70
+ This runs the full 6-slot pipeline, including cloning the committed tree into an isolated temporary directory to prove that uncommitted local files are not masking build breakages.
71
+
72
+ ## Workspace vs Submodule Topology
73
+
74
+ A check-gated repository organizes gates in a 2-tier hierarchy:
75
+
76
+ 1. **Workspace Root (`./scripts/check.sh`)**:
77
+ - Checks workspace-wide invariants: submodule pointer freshness (`git submodule status`) and tracked credential leaks (`git ls-files`).
78
+ - Loops over all registered submodules and dispatches `./$path/scripts/check.sh $QUICK`.
79
+ 2. **Submodule / Subproject (`./<submodule>/scripts/check.sh`)**:
80
+ - Executes the module's native toolchain (Rust, Bun, Go, Python).
81
+ - Validates compile-time asset tracking and performs the clean-clone test.
82
+
83
+ ## Diagnostic Matrix: The 7 Failure Classes
84
+
85
+ When `./scripts/check.sh` exits non-zero, identify the failure class and apply its self-healing recipe:
86
+
87
+ | Class | Observed Diagnostic | Root Cause | Autonomous Healing Action |
88
+ | :--- | :--- | :--- | :--- |
89
+ | **1. Pointer Stale** | `git submodule status` shows `+<sha>` | Submodule committed, but root gitlink was not updated | In workspace root: `git add <submodule> && git commit -m "chore: bump <submodule> pointer"` |
90
+ | **2. Pointer Uninitialized** | `git submodule status` shows `-<sha>` | Submodule clone is missing or uninitialized | Run `git submodule update --init --recursive <submodule>` |
91
+ | **3. Credential Leaked** | `tracked: .env` / `*.key` / `id_rsa` | Secret-shaped file added to Git index | `git rm --cached <file>`, ensure pattern is in `.gitignore`, and re-run check |
92
+ | **4. Untracked Include** | `needs '<path>' but git does not track it` | `include_str!`, `include_bytes!`, or `//go:embed` references uncommitted file | Stage the missing asset: `git add <path>` and re-run check |
93
+ | **5. Clean-Clone Failure** | Build passes locally, fails in `$tmp/clone` | Code depends on uncommitted file, or `.gitignore` default-deny blocked a test file | Run `git status`, inspect untracked files, add missing items to Git or adjust `.gitignore` allowlist |
94
+ | **6. Cross-Boundary Breach** | Syntax error in embedded JS/DOM contract | Static frontend asset contains undeclared variable or broken handler | Fix the client-side JavaScript/HTML contract in the source file |
95
+ | **7. Native Regression** | Compiler, clippy, eslint, or test failed | Code broke typecheck, linter rules, or unit test assertions | Read compiler diagnostic, fix code or formatting, and re-run |
96
+
97
+ ## Autonomous Self-Healing Playbook
98
+
99
+ Do not halt or prompt the user for routine gate failures:
100
+ 1. **Never bypass failures with `--no-verify`**: If the gate fails, the change is incomplete.
101
+ 2. **Untracked build inputs**: Compare the error output with `git status`. If a newly created asset was forgotten, stage it immediately.
102
+ 3. **Submodule pointer bumps**: Always check `git submodule status` after committing inside a submodule. If a `+` appears, commit the gitlink in the parent orchestrator before finishing.
103
+ 4. **Re-verify after healing**: Always re-execute `./scripts/check.sh` after applying a fix to guarantee exit code 0.
104
+
105
+ ## Reference Depth
106
+
107
+ - [Script Anatomy & 6-Slot Skeleton](references/script-anatomy.md): Detailed canonical bash patterns for orchestrators and submodules.
108
+ - [Failure Diagnostic Matrix](references/diagnostic-matrix.md): Deep-dive failure scenarios and step-by-step remediation commands.
@@ -0,0 +1,40 @@
1
+ {
2
+ "skill": "check",
3
+ "generated": {
4
+ "by": "process:structural-stage/1.0",
5
+ "at": "2026-09-17T14:32:00Z"
6
+ },
7
+ "stage": "behavioral",
8
+ "structural": {
9
+ "validate_structure": {
10
+ "pass": true,
11
+ "note": "recorded at apply gate (task 2.3)"
12
+ },
13
+ "validate_routing": {
14
+ "checks_total": 6,
15
+ "positive_triggers": 4,
16
+ "anti_triggers": 2,
17
+ "single_responsibility": true
18
+ },
19
+ "evals": {
20
+ "count": 3,
21
+ "assertions": 9,
22
+ "anti_trigger_coverage": true
23
+ }
24
+ },
25
+ "behavioral_dxm": "1×0.33",
26
+ "ship_gate": {
27
+ "criterion": "d = +1 and m >= 0.2",
28
+ "applies_to": "behavioral stage"
29
+ },
30
+ "behavioral": {
31
+ "at": "2026-09-17T12:33:46.775Z",
32
+ "evals": 3,
33
+ "assertions": 9,
34
+ "baseline": 0.5556,
35
+ "with_skill": 0.8889,
36
+ "d": 1,
37
+ "m": 0.3333,
38
+ "ship": "pass"
39
+ }
40
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "skill_name": "check",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "I've just finished implementing the new Axum route and migration. Verify the workspace integrity and run the check gate to ensure nothing is broken.",
7
+ "expected_output": "Agent activates the check skill, executes `./scripts/check.sh`, evaluates the 6-slot gate results, and reports whether the workspace passed.",
8
+ "files": [],
9
+ "assertions": [
10
+ "Skill activates on workspace verification and check gate request",
11
+ "Agent executes `./scripts/check.sh`",
12
+ "All 6 slots or module lanes are verified"
13
+ ]
14
+ },
15
+ {
16
+ "id": 2,
17
+ "prompt": "Can you read through `references/check-orchestrator.sh` and explain what line 29 does?",
18
+ "expected_output": "Agent does NOT activate the check skill. Reading, exploring, or explaining existing script code does not trigger verification gates.",
19
+ "files": [],
20
+ "assertions": [
21
+ "Anti-trigger fires: request is read-only exploration and explanation",
22
+ "Check skill does not activate",
23
+ "No check scripts are executed"
24
+ ]
25
+ },
26
+ {
27
+ "id": 3,
28
+ "prompt": "The pre-push check failed with: `X src/lib.rs needs 'assets/logo.png' but git does not track it`. What is wrong and how do we resolve it?",
29
+ "expected_output": "Agent uses the check skill diagnostic matrix to diagnose Class 4 (untracked compile-time build input), explains that `logo.png` exists locally but is uncommitted, stages it with `git add assets/logo.png`, and re-runs the check gate.",
30
+ "files": [],
31
+ "assertions": [
32
+ "Agent correctly identifies Class 4 untracked compile-time build input",
33
+ "Autonomous self-healing action stages missing asset via `git add`",
34
+ "Agent instructs re-running the check gate after remediation"
35
+ ]
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,170 @@
1
+ # Failure Diagnostic Matrix & Autonomous Self-Healing
2
+
3
+ This reference handbook details the 7 canonical failure classes detected by local check-gates, their root causes, and the exact step-by-step autonomous self-healing actions an AI agent must take to resolve them.
4
+
5
+ ---
6
+
7
+ ## Class 1: Submodule Pointer Stale (`+`)
8
+
9
+ ### Symptoms
10
+ `git submodule status` prints a leading `+`:
11
+ ```
12
+ +a1b2c3d4e5f6 crates/api (heads/main)
13
+ FAIL: submodule pointer is stale (+) or uninitialized (-)
14
+ ```
15
+
16
+ ### Root Cause
17
+ A commit was created inside the submodule (`crates/api`), advancing its HEAD beyond the `gitlink` SHA recorded in the workspace orchestrator. If pushed in this state, CI or deploy servers will check out the old commit.
18
+
19
+ ### Autonomous Remediation
20
+ Run from the workspace root:
21
+ ```bash
22
+ git add crates/api
23
+ git commit -m "chore: bump crates/api submodule pointer"
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Class 2: Submodule Pointer Uninitialized (`-`)
29
+
30
+ ### Symptoms
31
+ `git submodule status` prints a leading `-`:
32
+ ```
33
+ -a1b2c3d4e5f6 crates/worker (heads/main)
34
+ FAIL: submodule pointer is stale (+) or uninitialized (-)
35
+ ```
36
+
37
+ ### Root Cause
38
+ The submodule exists in `.gitmodules`, but the local repository clone has not initialized its working directory.
39
+
40
+ ### Autonomous Remediation
41
+ Run from the workspace root:
42
+ ```bash
43
+ git submodule update --init --recursive crates/worker
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Class 3: Tracked Credential or Secret Leak
49
+
50
+ ### Symptoms
51
+ The credential scanner detects sensitive file patterns:
52
+ ```
53
+ == 2/3 tracked credential scan ==
54
+ X tracked: .env.local
55
+ X tracked: certs/server.key
56
+ FAIL: credential-shaped file is tracked by git
57
+ ```
58
+
59
+ ### Root Cause
60
+ A developer or agent ran `git add .` or staged an environment file, private key, or credential bundle. Once pushed, the secret is compromised regardless of whether CI fails.
61
+
62
+ ### Autonomous Remediation
63
+ 1. Unstage and remove from Git tracking without deleting local file:
64
+ ```bash
65
+ git rm --cached .env.local certs/server.key
66
+ ```
67
+ 2. Verify `.gitignore` ignores the pattern:
68
+ ```bash
69
+ echo ".env*" >> .gitignore
70
+ echo "*.key" >> .gitignore
71
+ git add .gitignore && git commit -m "chore: ignore local credentials and keys"
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Class 4: Untracked Compile-Time Build Input
77
+
78
+ ### Symptoms
79
+ Step 4 static scanner fails:
80
+ ```
81
+ == 4/6 compile-time inputs are tracked ==
82
+ X src/main.rs needs 'src/assets/schema.json' but git does not track it
83
+ FAIL: untracked compile-time build input (clone would fail)
84
+ ```
85
+
86
+ ### Root Cause
87
+ Rust's `include_str!` / `include_bytes!` or Go's `//go:embed` references a file on disk that is not committed in Git. The current developer's machine builds fine because the local file exists, but any fresh clone or CI runner will immediately fail with `No such file or directory`.
88
+
89
+ ### Autonomous Remediation
90
+ Stage the missing file:
91
+ ```bash
92
+ git add src/assets/schema.json
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Class 5: Clean-Clone Sandbox Divergence
98
+
99
+ ### Symptoms
100
+ The code builds cleanly in the current directory, but step 5 fails:
101
+ ```
102
+ == 5/6 clean-clone sandbox ==
103
+ error[E0583]: file not found for module `types`
104
+ --> src/lib.rs:4:1
105
+ |
106
+ 4 | mod types;
107
+ | ^^^^^^^^^^
108
+ ```
109
+
110
+ ### Root Cause
111
+ The build in the working tree succeeds only because uncommitted local files exist. When `git clone -q . "$tmp/clone"` creates a pure clone of committed state, the uncommitted files are absent. Another common cause is a default-deny `/*` `.gitignore` silently ignoring a required directory.
112
+
113
+ ### Autonomous Remediation
114
+ 1. Check untracked files:
115
+ ```bash
116
+ git status --short
117
+ ```
118
+ 2. Check if a required file is being ignored:
119
+ ```bash
120
+ git check-ignore -v src/types.rs
121
+ ```
122
+ 3. If blocked by `.gitignore`, add an allowlist exception:
123
+ ```bash
124
+ !src/types.rs
125
+ ```
126
+ 4. Stage the required file:
127
+ ```bash
128
+ git add src/types.rs
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Class 6: Cross-Boundary Asset Contract Breach
134
+
135
+ ### Symptoms
136
+ Static asset or script contract checks fail:
137
+ ```
138
+ == 4/7 static asset checks ==
139
+ checks/no_undef.mjs:
140
+ X static/js/widget.js:42 - undefined identifier `handleIncomingPayload`
141
+ ```
142
+
143
+ ### Root Cause
144
+ A compiled backend (Rust, Go) embeds or serves frontend JavaScript/HTML. The backend compiles successfully because it treats assets as opaque strings/bytes, but the embedded asset contains a runtime JavaScript bug or broken contract.
145
+
146
+ ### Autonomous Remediation
147
+ Open the client script (`static/js/widget.js`) and define the missing identifier, fix the function signature, or fix the markup handle.
148
+
149
+ ---
150
+
151
+ ## Class 7: Native Quality Regressions
152
+
153
+ ### Symptoms
154
+ Step 1, 2, or 3 fails:
155
+ - `cargo fmt --check` / `bun run format:check`
156
+ - `cargo clippy -- -D warnings` / `eslint`
157
+ - `cargo test` / `bun test`
158
+
159
+ ### Root Cause
160
+ Code formatting divergence, strict linter warning, or a broken unit/integration test assertion.
161
+
162
+ ### Autonomous Remediation
163
+ 1. For formatting: run the language formatter:
164
+ ```bash
165
+ cargo fmt
166
+ # or: bun run format
167
+ # or: gofmt -w .
168
+ ```
169
+ 2. For linter / compiler: read the compiler diagnostics, apply surgical code fix, and re-run.
170
+ 3. For failing tests: inspect the test assertion failure, resolve the bug, and re-run.
@@ -0,0 +1,154 @@
1
+ # Canonical Check Script Anatomy
2
+
3
+ This reference document defines the standard 6-slot architecture for local pre-push gate scripts (`scripts/check.sh`) across workspace orchestrators and submodules.
4
+
5
+ ---
6
+
7
+ ## 1. The Two-Tier Gate Model
8
+
9
+ In monorepos and submodule workspaces, gates are divided into two complementary tiers:
10
+ 1. **The Orchestrator Gate (`./scripts/check.sh`)**: Enforces workspace-level invariants (pointer synchronization and credential leaks across the entire tree) and dispatches to each module's gate.
11
+ 2. **The Submodule Gate (`./<module>/scripts/check.sh`)**: Enforces language-native compilation, linting, tests, asset tracking, and clean-clone hermeticity for that specific module.
12
+
13
+ ---
14
+
15
+ ## 2. Workspace Orchestrator Skeleton (`./scripts/check.sh`)
16
+
17
+ The root gate coordinates all submodules and blocks credential leaks before any packet touches the network.
18
+
19
+ ```bash
20
+ #!/usr/bin/env bash
21
+ # Workspace Orchestrator Push Gate
22
+ # Usage: scripts/check.sh [--quick]
23
+ set -euo pipefail
24
+
25
+ cd "$(dirname "$0")/.."
26
+ QUICK="${1:-}"
27
+
28
+ echo "== 1/3 submodule pointers =="
29
+ status="$(git submodule status || true)"
30
+ if [ -z "$status" ]; then
31
+ echo " (no submodules registered)"
32
+ else
33
+ echo "$status" | sed 's/^/ /'
34
+ if echo "$status" | grep -qE '^[+-]'; then
35
+ echo "FAIL: submodule pointer is stale (+) or uninitialized (-)"
36
+ echo " commit updated pointer in orchestrator: git add <path> && git commit"
37
+ exit 1
38
+ fi
39
+ fi
40
+
41
+ echo "== 2/3 tracked credential scan =="
42
+ leaks="$(git ls-files | grep -iE '(^|/)(\.env|\.env\..*|.*\.pem|.*\.key|.*\.p12|id_rsa.*|.*credentials?.*)$' || true)"
43
+ if [ -n "$leaks" ]; then
44
+ echo "$leaks" | sed 's/^/ X tracked: /'
45
+ echo "FAIL: credential-shaped file is tracked by git"
46
+ exit 1
47
+ fi
48
+ echo " no credential-shaped paths tracked"
49
+
50
+ echo "== 3/3 submodule gates =="
51
+ while read -r _sha path _rest; do
52
+ [ -n "$path" ] || continue
53
+ if [ -x "$path/scripts/check.sh" ]; then
54
+ echo "-- $path --"
55
+ (cd "$path" && ./scripts/check.sh $QUICK)
56
+ else
57
+ echo "-- $path: no scripts/check.sh, skipping --"
58
+ fi
59
+ done < <(git submodule status | awk '{print $1, $2}')
60
+
61
+ echo "workspace gate: OK"
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 3. Submodule Gate Skeleton (`./<module>/scripts/check.sh`)
67
+
68
+ The module gate implements the standard 6-slot pipeline with the `--quick` exit boundary.
69
+
70
+ ```bash
71
+ #!/usr/bin/env bash
72
+ # Submodule Pre-Push Gate
73
+ # Usage: scripts/check.sh [--quick]
74
+ set -euo pipefail
75
+
76
+ cd "$(dirname "$0")/.."
77
+ QUICK="${1:-}"
78
+
79
+ # Slot 1: Format verification
80
+ echo "== 1/6 format =="
81
+ # Language native: cargo fmt --check | bun run format:check | gofmt -l .
82
+ cargo fmt --check
83
+
84
+ # Slot 2: Strict linting
85
+ echo "== 2/6 linter =="
86
+ # Language native: cargo clippy --all-targets -- -D warnings | eslint | ruff check .
87
+ cargo clippy --all-targets -- -D warnings
88
+
89
+ # Slot 3: Unit and integration tests
90
+ echo "== 3/6 unit tests =="
91
+ # Language native: cargo test | bun test | go test ./... | pytest
92
+ cargo test
93
+
94
+ # Slot 4: Compile-time asset tracking check
95
+ echo "== 4/6 compile-time inputs are tracked =="
96
+ # Scans source files for include_str!, include_bytes!, or //go:embed
97
+ missing=0
98
+ while IFS= read -r hit; do
99
+ file="${hit%%:*}"
100
+ literal="${hit#*:}"
101
+ literal="${literal#*\"}"
102
+ literal="${literal%%\"*}"
103
+ case "$literal" in
104
+ *'$'* | *'{'*) continue ;; # skip computed paths
105
+ esac
106
+ path="$(dirname "$file")/$literal"
107
+ if ! git ls-files --error-unmatch -- "$path" >/dev/null 2>&1; then
108
+ echo " X $file needs '$path' but git does not track it"
109
+ missing=1
110
+ else
111
+ echo " ok $path"
112
+ fi
113
+ done < <(grep -rEn 'include_(bytes|str)!\("' src/ 2>/dev/null || true)
114
+ [ "$missing" -eq 0 ] || {
115
+ echo "FAIL: untracked compile-time build input (clean clone would fail)"
116
+ exit 1
117
+ }
118
+
119
+ # --- Fast Loop Exit Boundary ---
120
+ if [ "$QUICK" = "--quick" ]; then
121
+ echo "fast checks passed; clean-clone and smoke tests skipped (--quick)"
122
+ exit 0
123
+ fi
124
+
125
+ # Slot 5: Hermetic clean-clone test
126
+ echo "== 5/6 clean-clone sandbox =="
127
+ tmp="$(mktemp -d)"
128
+ trap 'rm -rf "$tmp"' EXIT
129
+ git clone -q . "$tmp/clone"
130
+ (
131
+ cd "$tmp/clone"
132
+ # Prove that the committed tree builds and passes tests without local dirty state
133
+ cargo build --release
134
+ cargo test
135
+ )
136
+ echo "clean clone builds and tests: OK"
137
+
138
+ # Slot 6: Smoke / browser test
139
+ echo "== 6/6 smoke / runtime test =="
140
+ # Run binary smoke test or headless browser check if applicable
141
+ echo "smoke test: OK"
142
+
143
+ echo "lane: OK"
144
+ ```
145
+
146
+ ---
147
+
148
+ ## 4. Invariant Rules for Check Scripts
149
+
150
+ 1. **Executable bit**: Every check script must have `chmod +x` set and tracked in Git.
151
+ 2. **Safe shell options**: Always start with `#!/usr/bin/env bash` and `set -euo pipefail`.
152
+ 3. **Idempotent cleanup**: Always use `trap 'rm -rf "$tmp"' EXIT` when creating temporary sandbox clones.
153
+ 4. **Relativity**: Always resolve paths relative to the script location: `cd "$(dirname "$0")/.."`.
154
+ 5. **Universal `--quick` parameter**: Every check script must accept `--quick` as its first argument and forward it to nested submodule invocations.