rungate 0.2.0
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/.claude/agents/aditi.md +47 -0
- package/.claude/agents/marcus.md +50 -0
- package/.claude/agents/quinn.md +58 -0
- package/.claude/agents/rook.md +47 -0
- package/.claude/agents/serena.md +46 -0
- package/.claude/rungate.json +11 -0
- package/.fallowrc.json +28 -0
- package/.github/copilot-instructions.md +20 -0
- package/.rungate/conformity-findings.json +648 -0
- package/AGENTS.md +106 -0
- package/CODE-MAP.md +50 -0
- package/HARNESS.md +88 -0
- package/bun.lock +26 -0
- package/bunfig.toml +2 -0
- package/config/brief-policies.json +28 -0
- package/config/ceremony-profiles.json +212 -0
- package/config/consumer-cascade-map.json +24 -0
- package/config/doc-cascade-map.json +24 -0
- package/config/eval.json +84 -0
- package/config/profiles/account-plan.yaml +36 -0
- package/config/profiles/campaign.yaml +94 -0
- package/config/prove-evidence.schema.json +65 -0
- package/config/spec-policies.json +36 -0
- package/config/workflow-schema.json +281 -0
- package/gates/SCHEMA-GUIDE.md +121 -0
- package/gates/ac-quality.test.ts +106 -0
- package/gates/adversarial.test.ts +274 -0
- package/gates/brief-assembler.test.ts +429 -0
- package/gates/brief-assembler.ts +334 -0
- package/gates/bunfig.toml +2 -0
- package/gates/chain.test.ts +91 -0
- package/gates/e2e-smoke.test.ts +234 -0
- package/gates/error-classifier.test.ts +249 -0
- package/gates/error-classifier.ts +89 -0
- package/gates/orchestrator.test.ts +950 -0
- package/gates/orchestrator.ts +569 -0
- package/gates/preload.ts +77 -0
- package/gates/prompts/ac-adversary.md +20 -0
- package/gates/prompts/evidence-validator.md +22 -0
- package/gates/prompts/prove-reproducer.md +53 -0
- package/gates/prove.test.ts +164 -0
- package/gates/run-gate.ts +936 -0
- package/gates/schema-parity.test.ts +197 -0
- package/gates/schema.ts +362 -0
- package/gates/self-heal.test.ts +511 -0
- package/gates/self-heal.ts +121 -0
- package/gates/ship-orchestrator.test.ts +379 -0
- package/gates/ship-orchestrator.ts +363 -0
- package/gates/test-fixtures/broken-no-environments.json +60 -0
- package/gates/test-fixtures/valid-standard.json +54 -0
- package/gates/test-utils.ts +43 -0
- package/gates/witness.ts +220 -0
- package/gates/workflow.test.ts +1053 -0
- package/hooks/AgentBriefGuard.hook.ts +586 -0
- package/hooks/AgentVerdictCapture.hook.ts +134 -0
- package/hooks/AutoVerifyGate.hook.ts +76 -0
- package/hooks/GateEnforcement.hook.ts +273 -0
- package/hooks/IssueCloseGuard.hook.ts +116 -0
- package/hooks/MergeGuard.hook.ts +55 -0
- package/hooks/StaleTTLCleanup.hook.ts +133 -0
- package/hooks/VerifyPhaseLock.hook.ts +81 -0
- package/hooks/WorkflowStateGuard.hook.ts +37 -0
- package/hooks/lib/agentDetection.ts +70 -0
- package/hooks/lib/findWorkflow.ts +101 -0
- package/hooks/lib/parseStdin.ts +37 -0
- package/hooks/lib/paths.ts +111 -0
- package/hooks/lib/utils.ts +81 -0
- package/lib/conformity.ts +959 -0
- package/lib/paths.ts +23 -0
- package/lib/rungate-schema.ts +60 -0
- package/lib/signal-phrases.ts +7 -0
- package/package.json +20 -0
- package/prompts/ac-adversary.md +20 -0
- package/prompts/ac-format.md +34 -0
- package/prompts/aditi.md +29 -0
- package/prompts/blast-radius.md +29 -0
- package/prompts/coding-principles.md +34 -0
- package/prompts/container-rebuild.md +29 -0
- package/prompts/container-verify.md +28 -0
- package/prompts/discovery.md +27 -0
- package/prompts/environment.md +28 -0
- package/prompts/escalation-decision-tree.md +38 -0
- package/prompts/evidence-hierarchy.md +31 -0
- package/prompts/evidence-validator.md +22 -0
- package/prompts/marcus.md +29 -0
- package/prompts/prevention.md +26 -0
- package/prompts/prove-reproducer.md +43 -0
- package/prompts/quinn-decision-tree.md +31 -0
- package/prompts/quinn-ui-brief.md +106 -0
- package/prompts/quinn.md +29 -0
- package/prompts/rca.md +28 -0
- package/prompts/read-before-write.md +30 -0
- package/prompts/regression.md +26 -0
- package/prompts/rook.md +29 -0
- package/prompts/serena.md +28 -0
- package/prompts/testing-strategy.md +34 -0
- package/reference/migration-manifest.json +554 -0
- package/reference/prompts/agent-aditi.md +38 -0
- package/reference/prompts/agent-marcus.md +38 -0
- package/reference/prompts/agent-quinn.md +38 -0
- package/reference/prompts/agent-rook.md +37 -0
- package/reference/prompts/agent-serena.md +37 -0
- package/reference/prompts/council-skill.md +170 -0
- package/reference/prompts/goal-skill.md +235 -0
- package/reference/prompts/prove-skill.md +283 -0
- package/reference/prompts/quinn-standard.md +246 -0
- package/reference/prompts/ship-convergence.md +65 -0
- package/reference/prompts/ship-escalation.md +43 -0
- package/reference/prompts/ship-iteration.md +382 -0
- package/reference/prompts/ship-pending-patches.md +246 -0
- package/reference/prompts/ship-reference.md +250 -0
- package/reference/prompts/ship-skill.md +347 -0
- package/reference/prompts/ship-templates.md +215 -0
- package/reference/scripts/batch-status.sh +68 -0
- package/reference/scripts/chain-compat-check.sh +67 -0
- package/reference/scripts/context-audit.sh +314 -0
- package/reference/scripts/dead-export-check.sh +61 -0
- package/reference/scripts/generate-qc-tables.sh +92 -0
- package/reference/scripts/harness-init.sh +111 -0
- package/reference/scripts/pai-054-baseline-check.sh +40 -0
- package/reference/scripts/prove-smoke-test.sh +112 -0
- package/reference/scripts/setup-keychain-salt.sh +12 -0
- package/reference/scripts/skill-optimizer-friday.sh +88 -0
- package/reference/scripts/skill-qc-test.sh +351 -0
- package/reference/scripts/skill-synthesize-tonight.sh +66 -0
- package/reference/specs/HARNESS-EXTRACTION-SPEC.md +263 -0
- package/reference/specs/harness-v3-bash-deletion-plan.md +65 -0
- package/reference/specs/harness-v3-migration-plan.md +188 -0
- package/scripts/decision-reconcile.sh +74 -0
- package/scripts/decision-reconcile.ts +152 -0
- package/scripts/extract-constraints.ts +260 -0
- package/scripts/generate-code-map.ts +339 -0
- package/scripts/git-hooks/pre-commit +76 -0
- package/scripts/git-hooks/pre-push +271 -0
- package/scripts/harness-skill-check.sh +52 -0
- package/scripts/lib/gap-emit.sh +65 -0
- package/scripts/lib/jq-update.sh +30 -0
- package/scripts/lib/resolve-slug.sh +30 -0
- package/scripts/lib/verify-spec-compliance.sh +102 -0
- package/scripts/prove-backfill.sh +87 -0
- package/scripts/scaffold-project.ts +1488 -0
- package/scripts/scaffold-rungate-config.ts +91 -0
- package/scripts/self-containment-check.sh +109 -0
- package/scripts/skill-qc-validator.sh +402 -0
- package/scripts/slug-resolver.sh +14 -0
- package/scripts/sync-spec-tests.ts +236 -0
- package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +2493 -0
- package/specs/BOOTSTRAP-TEST-PLAN.md +571 -0
- package/specs/HARNESS-GATES.md +256 -0
- package/specs/HARNESS-SKILL-CHAIN.md +286 -0
- package/specs/HARNESS-SKILL-CONTRACT.md +93 -0
- package/specs/HARNESS-STANDARD.md +488 -0
- package/specs/SPEC-TEMPLATE.md +53 -0
- package/specs/bootstrap-data-flow.png +0 -0
- package/specs/harness-automation-matrix.md +314 -0
- package/specs/harness-automation-matrix.rules.json +64 -0
- package/test/anti.test.ts +80 -0
- package/test/contract-negative.test.ts +86 -0
- package/test/contract.test.ts +158 -0
- package/test/external-deps.test.ts +48 -0
- package/test/fixtures/golden-project/.env.example +3 -0
- package/test/fixtures/golden-project/Makefile +7 -0
- package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +23 -0
- package/test/fixtures/golden-project/docs/setup-guide.md +10 -0
- package/test/fixtures/golden-project/package.json +10 -0
- package/test/fixtures/golden-project/specs/api-spec.md +20 -0
- package/test/fixtures/golden-project/src/auth.ts +8 -0
- package/test/fixtures/golden-project/src/db.ts +11 -0
- package/test/fixtures/golden-project/src/index.ts +19 -0
- package/test/fixtures/golden-project/src/utils/format.ts +3 -0
- package/test/fixtures/golden-project/test/auth.test.ts +15 -0
- package/test/fixtures/golden-project/tsconfig.json +12 -0
- package/test/meta-sc-coverage.test.ts +159 -0
- package/test/phase-0.test.ts +846 -0
- package/test/phase-1.test.ts +617 -0
- package/test/phase-2.test.ts +620 -0
- package/test/phase-3.test.ts +99 -0
- package/test/scaffold-conformity.test.ts +8 -0
- package/test/schema-canary.test.ts +51 -0
- package/test/spec-compliance-auto.test.ts +64 -0
- package/test/spec-compliance.test.ts +295 -0
- package/test/spec-discovery.test.ts +68 -0
- package/test/spec-drift.test.ts +5 -0
- package/test/structure.test.ts +165 -0
- package/test/unit/agent-brief-guard-ship.test.ts +293 -0
- package/test/unit/extract-constraints.test.ts +145 -0
- package/test/unit/issue-close-guard.test.ts +204 -0
- package/test/unit/scaffold-project.test.ts +417 -0
- package/test/unit/skill-cooccurrence.test.ts +177 -0
- package/test/unit/skill-sequence-logger.test.ts +244 -0
- package/test/unit/workflow-state-guard.test.ts +95 -0
- package/workflows/batch-ship.js +295 -0
- package/workflows/council.js +481 -0
- package/workflows/prove.js +560 -0
- package/workflows/ship.js +789 -0
- package/workflows/verify.js +236 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: reference
|
|
3
|
+
status: active
|
|
4
|
+
owner: jason
|
|
5
|
+
updated: 2026-07-28
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ship Templates
|
|
9
|
+
|
|
10
|
+
Structured templates for artifacts produced during ship. Gates validate these structures exist on the issue.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## AC Template — CODE (8 required fields + 1 optional)
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
## AC-N
|
|
18
|
+
- **Type:** REPLACE:CODE_OR_OUTCOME
|
|
19
|
+
- **Statement:** REPLACE:specific_verifiable_statement
|
|
20
|
+
- **Call Site:** REPLACE:file_and_line_where_this_is_called_from_and_trigger_event
|
|
21
|
+
- **Metric:** REPLACE:measurable_count_or_boolean
|
|
22
|
+
- **Threshold:** REPLACE:number_or_explicit_boolean
|
|
23
|
+
- **Baseline:** REPLACE:current_measured_value
|
|
24
|
+
- **Evidence Method:** REPLACE:grep_curl_screenshot_or_test
|
|
25
|
+
- **Pass Criteria:** REPLACE:exact_condition_that_proves_pass
|
|
26
|
+
- **Source:** REPLACE:architecture_adr_or_issue_reference
|
|
27
|
+
- **Data Flow:** REPLACE:state_file_path | verification_command (OPTIONAL — for wiring/integration ACs only)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Data Flow rule:** For ACs that wire cross-system pipelines (hook A calls function B, pipeline feeds downstream state), include the Data Flow field. Format: `state_file_path | shell_command_that_returns_0_on_success`. verify-gate runs the command and checks the state file was modified. Omit for pure logic, test, or config ACs. Example: `~/.agentgrit/state/rule-stats.json | bun -e 'require("./src/capture/rating").parseRating("/rate M:4 S:4 Q:4")' `
|
|
31
|
+
|
|
32
|
+
> **Call Site rule:** Every new function must specify WHERE it is called from (file:line) and WHEN it fires (trigger event). A function with tests but no call site is dead code. Evidence must show the call site exists via grep. If the AC is for a test-only or config change with no new callable function, use `Call Site: N/A — no new function`.
|
|
33
|
+
|
|
34
|
+
## AC Template — OUTCOME (10 required fields)
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
## AC-N
|
|
38
|
+
- **Type:** REPLACE:CODE_OR_OUTCOME
|
|
39
|
+
- **Statement:** REPLACE:what_user_sees_or_gets
|
|
40
|
+
- **Metric:** REPLACE:count_percentage_time_or_field_presence
|
|
41
|
+
- **Threshold:** REPLACE:specific_number_or_condition
|
|
42
|
+
- **Baseline:** REPLACE:current_state_or_NA_for_new
|
|
43
|
+
- **Evidence Method:** REPLACE:curl_command_screenshot_or_playwright
|
|
44
|
+
- **Pass Criteria:** REPLACE:what_evidence_output_must_show
|
|
45
|
+
- **Source:** REPLACE:principles_goal_or_issue_reference
|
|
46
|
+
- **User:** REPLACE:who_uses_this
|
|
47
|
+
- **Conversation:** REPLACE:what_this_enables
|
|
48
|
+
- **Action:** REPLACE:specific_verb_and_context
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ATTEMPT Comment Template
|
|
54
|
+
|
|
55
|
+
Posted to issue after every failed iteration. Required fields enforced by iteration-gate.
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
## ATTEMPT N
|
|
59
|
+
- **Approach:** REPLACE:specific_files_and_changes
|
|
60
|
+
- **Files Changed:** REPLACE:list_of_files_with_changes
|
|
61
|
+
- **Result:** FAIL
|
|
62
|
+
- **Evidence:** REPLACE:curl_output_screenshot_or_error
|
|
63
|
+
- **Why It Failed:** REPLACE:root_cause_or_unknown
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Sizing Declaration Template
|
|
69
|
+
|
|
70
|
+
Posted to issue during SCOPE. Compared to actuals at CLOSE.
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
## Sizing Declaration
|
|
74
|
+
- **Predicted:** REPLACE:XS_S_M_or_L
|
|
75
|
+
- **Files:** REPLACE:count_and_names
|
|
76
|
+
- **Reasoning:** REPLACE:why_this_size
|
|
77
|
+
- **Expected time:** REPLACE:hours
|
|
78
|
+
- **Expected boundaries:** REPLACE:directories_or_none
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Sizing Outcome Template
|
|
84
|
+
|
|
85
|
+
Posted to issue at CLOSE. Compared to declaration for accuracy tracking.
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
## Sizing Outcome
|
|
89
|
+
- **Declared:** REPLACE:size_from_declaration
|
|
90
|
+
- **Actual:** REPLACE:actual_files_changed_count
|
|
91
|
+
- **Actual directories:** REPLACE:unique_top_level_dir_count
|
|
92
|
+
- **Actual time:** REPLACE:hours_from_checkpoint
|
|
93
|
+
- **Mismatch:** REPLACE:YES_or_NO
|
|
94
|
+
- **Docs read:** REPLACE:count_and_names
|
|
95
|
+
- **Lines loaded:** REPLACE:total_lines_across_all_docs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Completion Report Template
|
|
101
|
+
|
|
102
|
+
Posted to issue at CLOSE. score-issue.sh generates the scorecard section.
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
## Completion Report
|
|
106
|
+
|
|
107
|
+
### Evidence per AC
|
|
108
|
+
- AC-1: → REPLACE:evidence_type REPLACE:evidence_detail
|
|
109
|
+
- AC-2: → REPLACE:evidence_type REPLACE:evidence_detail
|
|
110
|
+
|
|
111
|
+
### Ship Scorecard
|
|
112
|
+
| Step | Score | Detail |
|
|
113
|
+
|------|-------|--------|
|
|
114
|
+
| SCOPE | REPLACE:score | REPLACE:detail |
|
|
115
|
+
| BUILD | REPLACE:score | REPLACE:detail |
|
|
116
|
+
| VERIFY | REPLACE:score | REPLACE:detail |
|
|
117
|
+
| DURABILITY | REPLACE:score | REPLACE:detail |
|
|
118
|
+
| CLOSE | REPLACE:score | REPLACE:detail |
|
|
119
|
+
|
|
120
|
+
| Metric | Value |
|
|
121
|
+
|--------|-------|
|
|
122
|
+
| First-pass rate | REPLACE:percentage |
|
|
123
|
+
| Iterations | REPLACE:count |
|
|
124
|
+
| Sizing accuracy | REPLACE:match_or_mismatch |
|
|
125
|
+
| Time | REPLACE:hours |
|
|
126
|
+
| Grade | REPLACE:letter_grade |
|
|
127
|
+
|
|
128
|
+
### Files changed
|
|
129
|
+
- REPLACE:file_line_description
|
|
130
|
+
|
|
131
|
+
### Follow-ups created
|
|
132
|
+
- REPLACE:issue_refs_or_NONE
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## DISCOVERY Comment Template
|
|
138
|
+
|
|
139
|
+
Posted to issue during SCOPE. scope-gate validates this exists.
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
## DISCOVERY
|
|
143
|
+
|
|
144
|
+
### Docs read
|
|
145
|
+
- REPLACE:doc_name (modified: REPLACE:date) — REPLACE:key_constraints
|
|
146
|
+
- REPLACE:doc_name (modified: REPLACE:date) — REPLACE:relevant_modules
|
|
147
|
+
|
|
148
|
+
### Source spec
|
|
149
|
+
- REPLACE:path_and_section_or_none
|
|
150
|
+
|
|
151
|
+
### Issue context
|
|
152
|
+
- Related: REPLACE:issue_references
|
|
153
|
+
- Checkpoint: REPLACE:resuming_or_fresh
|
|
154
|
+
|
|
155
|
+
### Research decision
|
|
156
|
+
- REPLACE:unknowns_or_no_unknowns
|
|
157
|
+
|
|
158
|
+
### Constraints
|
|
159
|
+
- REPLACE:constraint_with_citation
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Anti-Gaming Table Template
|
|
165
|
+
|
|
166
|
+
Posted to issue during SCOPE after writing ACs. scope-gate validates defenses exist. DA creates this manually or via quick adversarial agent -- gate validates, doesn't create.
|
|
167
|
+
|
|
168
|
+
~~~markdown
|
|
169
|
+
## Anti-Gaming
|
|
170
|
+
|
|
171
|
+
| # | Shortcut | Why It Games | Defense Command | Expected |
|
|
172
|
+
|---|---|---|---|---|
|
|
173
|
+
| AG-1 | REPLACE:shortcut_description | REPLACE:why_it_games | REPLACE:defense_command | REPLACE:expected_result |
|
|
174
|
+
| AG-2 | REPLACE:shortcut_description | REPLACE:why_it_games | REPLACE:defense_command | REPLACE:expected_result |
|
|
175
|
+
~~~
|
|
176
|
+
|
|
177
|
+
> **Defense Command** should use a known ag-test-runner pattern or a raw shell command:
|
|
178
|
+
>
|
|
179
|
+
> Known patterns (run via `bash skills/ship/ag-test-runner.sh --type PATTERN ...`):
|
|
180
|
+
> - `GREP_CHECK --file FILE --pattern PAT --op (eq|gte|lte) --count N` — count grep matches
|
|
181
|
+
> - `CURL_API --url URL --jq FILTER --op (eq|gte|contains) --expected VAL` — check API response
|
|
182
|
+
> - `FILE_EXISTS --path PATH` — verify file/glob exists
|
|
183
|
+
> - `TEST_RUN --command CMD` — run command, check exit 0
|
|
184
|
+
> - `HARDCODE_CHECK --file FILE --pattern PAT` — verify pattern has 0 matches
|
|
185
|
+
> - `CHANGE_DETECT --add FILE --endpoint URL --jq FIELD` — verify endpoint detects file changes
|
|
186
|
+
> - `THRESHOLD_CHECK --command CMD --op OP --value N` — verify numeric output meets threshold
|
|
187
|
+
>
|
|
188
|
+
> Raw shell commands (grep, curl, ls, bun, etc.) are also accepted. verify-gate Check 10 executes these at VERIFY time.
|
|
189
|
+
|
|
190
|
+
> **Prompt for adversarial agent (optional):** "Given this goal statement and these ACs, list every way someone could claim success without actually delivering the goal. For each shortcut, propose a mechanical defense command. You must NOT see the implementation code -- attack from the 'lazy implementer' perspective."
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Checkpoint Compaction Template
|
|
195
|
+
|
|
196
|
+
Required fields for context recovery. iteration-gate validates these exist.
|
|
197
|
+
|
|
198
|
+
```markdown
|
|
199
|
+
## Current State
|
|
200
|
+
- Phase: [SCOPE | BUILD | VERIFY | ITERATION]
|
|
201
|
+
- ACs: N/M passed (AC-1 ✓, AC-2 ✗, AC-3 pending)
|
|
202
|
+
- Last failure: [AC-N — what failed and why]
|
|
203
|
+
- Iterations: N (Tier 1 at 3, Tier 2 at 6)
|
|
204
|
+
|
|
205
|
+
## Next Action
|
|
206
|
+
[Exact next step — not vague, not a plan, one specific action]
|
|
207
|
+
|
|
208
|
+
## Files Changed
|
|
209
|
+
- [file:line — what changed]
|
|
210
|
+
|
|
211
|
+
## Gate Status
|
|
212
|
+
- scope-gate: [PASS | FAIL (which check)]
|
|
213
|
+
- verify-gate: [PASS | FAIL | not yet run]
|
|
214
|
+
- durability-gate: [PASS | FAIL | not yet run]
|
|
215
|
+
```
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# batch-status.sh — Track issue status during AFK batch execution
|
|
3
|
+
# Usage:
|
|
4
|
+
# bash batch-status.sh init <batch-id>
|
|
5
|
+
# bash batch-status.sh update <batch-id> <issue> <phase> <status>
|
|
6
|
+
# bash batch-status.sh report <batch-id>
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
RUNGATE_DIR="${RUNGATE_WORK_DIR:-$HOME/.rungate}"
|
|
10
|
+
ACTION="${1:?Usage: batch-status.sh <init|update|report> ...}"
|
|
11
|
+
BATCH_ID="${2:?Usage: batch-status.sh $ACTION <batch-id> ...}"
|
|
12
|
+
STATUS_FILE="$RUNGATE_DIR/batch-$BATCH_ID/batch-status.json"
|
|
13
|
+
|
|
14
|
+
case "$ACTION" in
|
|
15
|
+
init)
|
|
16
|
+
mkdir -p "$RUNGATE_DIR/batch-$BATCH_ID"
|
|
17
|
+
echo '{"batchId":"'"$BATCH_ID"'","startedAt":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","issues":[]}' > "$STATUS_FILE"
|
|
18
|
+
echo "PASS: Initialized batch $BATCH_ID at $STATUS_FILE"
|
|
19
|
+
;;
|
|
20
|
+
update)
|
|
21
|
+
ISSUE="${3:?Usage: batch-status.sh update <batch-id> <issue> <phase> <status>}"
|
|
22
|
+
PHASE="${4:?Usage: batch-status.sh update <batch-id> <issue> <phase> <status>}"
|
|
23
|
+
STATUS="${5:?Usage: batch-status.sh update <batch-id> <issue> <phase> <status>}"
|
|
24
|
+
|
|
25
|
+
if [[ ! -f "$STATUS_FILE" ]]; then
|
|
26
|
+
echo "FAIL: batch $BATCH_ID not initialized" >&2; exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
TMP_FILE="$STATUS_FILE.tmp.$$"
|
|
30
|
+
python3 -c "
|
|
31
|
+
import json, sys
|
|
32
|
+
data = json.load(open('$STATUS_FILE'))
|
|
33
|
+
issues = data.get('issues', [])
|
|
34
|
+
updated = False
|
|
35
|
+
for i in issues:
|
|
36
|
+
if i['issue'] == $ISSUE:
|
|
37
|
+
i['phase'] = '$PHASE'
|
|
38
|
+
i['status'] = '$STATUS'
|
|
39
|
+
i['updatedAt'] = '$(date -u +%Y-%m-%dT%H:%M:%SZ)'
|
|
40
|
+
updated = True
|
|
41
|
+
break
|
|
42
|
+
if not updated:
|
|
43
|
+
issues.append({'issue': $ISSUE, 'phase': '$PHASE', 'status': '$STATUS', 'updatedAt': '$(date -u +%Y-%m-%dT%H:%M:%SZ)'})
|
|
44
|
+
data['issues'] = issues
|
|
45
|
+
json.dump(data, open('$TMP_FILE', 'w'), indent=2)
|
|
46
|
+
"
|
|
47
|
+
mv "$TMP_FILE" "$STATUS_FILE"
|
|
48
|
+
echo "PASS: Updated issue $ISSUE → $PHASE/$STATUS"
|
|
49
|
+
;;
|
|
50
|
+
report)
|
|
51
|
+
if [[ ! -f "$STATUS_FILE" ]]; then
|
|
52
|
+
echo "FAIL: batch $BATCH_ID not initialized" >&2; exit 1
|
|
53
|
+
fi
|
|
54
|
+
python3 -c "
|
|
55
|
+
import json
|
|
56
|
+
data = json.load(open('$STATUS_FILE'))
|
|
57
|
+
print(f'Batch: {data[\"batchId\"]} (started {data[\"startedAt\"]})')
|
|
58
|
+
for i in data.get('issues', []):
|
|
59
|
+
print(f' #{i[\"issue\"]}: {i[\"phase\"]}/{i[\"status\"]} (updated {i.get(\"updatedAt\", \"?\")})')
|
|
60
|
+
total = len(data.get('issues', []))
|
|
61
|
+
done = len([i for i in data.get('issues', []) if i['status'] == 'DONE'])
|
|
62
|
+
print(f'Progress: {done}/{total}')
|
|
63
|
+
"
|
|
64
|
+
;;
|
|
65
|
+
*)
|
|
66
|
+
echo "FAIL: unknown action '$ACTION' — use init|update|report" >&2; exit 1
|
|
67
|
+
;;
|
|
68
|
+
esac
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# chain-compat-check.sh — L3 cross-skill compatibility checking
|
|
3
|
+
# Verifies output of skill N matches input expectations of skill N+1
|
|
4
|
+
# Usage: chain-compat-check.sh [chain-yaml]
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
+
|
|
9
|
+
echo "=== L3 Chain Compatibility Check ==="
|
|
10
|
+
|
|
11
|
+
# Format: upstream_skill:upstream_artifact:downstream_skill:expected_field
|
|
12
|
+
HANDOFFS=(
|
|
13
|
+
"goal:goal-record.json:ship:successCriteria"
|
|
14
|
+
"goal:goal-record.json:prove:successCriteria"
|
|
15
|
+
"ship:ship-evidence.json:prove:mergeCommitSha"
|
|
16
|
+
"prove:prove-evidence.json:release:verdict"
|
|
17
|
+
"prove:prove-evidence.json:release:commitSHA"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
PASSES=0
|
|
21
|
+
FAILS=0
|
|
22
|
+
|
|
23
|
+
for handoff in "${HANDOFFS[@]}"; do
|
|
24
|
+
IFS=':' read -r upstream artifact downstream field <<< "$handoff"
|
|
25
|
+
|
|
26
|
+
SCHEMA_FILE=""
|
|
27
|
+
case "$artifact" in
|
|
28
|
+
goal-record.json) SCHEMA_FILE="$REPO_ROOT/schemas/goal-record.schema.json" ;;
|
|
29
|
+
ship-evidence.json) SCHEMA_FILE="$REPO_ROOT/schemas/ship-evidence.schema.json" ;;
|
|
30
|
+
prove-evidence.json) SCHEMA_FILE="$REPO_ROOT/skills/prove/prove-evidence.schema.json" ;;
|
|
31
|
+
release-proof.json) SCHEMA_FILE="$REPO_ROOT/schemas/release-proof.schema.json" ;;
|
|
32
|
+
esac
|
|
33
|
+
|
|
34
|
+
if [[ ! -f "$SCHEMA_FILE" ]]; then
|
|
35
|
+
echo " FAIL ${upstream}->${downstream}: schema $SCHEMA_FILE not found"
|
|
36
|
+
FAILS=$((FAILS + 1))
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
HAS_FIELD=$(python3 -c "
|
|
41
|
+
import json
|
|
42
|
+
schema = json.load(open('$SCHEMA_FILE'))
|
|
43
|
+
props = schema.get('properties', {})
|
|
44
|
+
if '$field' in props:
|
|
45
|
+
print('YES')
|
|
46
|
+
else:
|
|
47
|
+
for prop_name, prop_def in props.items():
|
|
48
|
+
if isinstance(prop_def, dict) and 'properties' in prop_def:
|
|
49
|
+
if '$field' in prop_def['properties']:
|
|
50
|
+
print('YES')
|
|
51
|
+
break
|
|
52
|
+
else:
|
|
53
|
+
print('NO')
|
|
54
|
+
" 2>/dev/null || echo "ERROR")
|
|
55
|
+
|
|
56
|
+
if [[ "$HAS_FIELD" == "YES" ]]; then
|
|
57
|
+
echo " PASS ${upstream}->${downstream}: '$field' exists in $artifact schema"
|
|
58
|
+
PASSES=$((PASSES + 1))
|
|
59
|
+
else
|
|
60
|
+
echo " FAIL ${upstream}->${downstream}: '$field' NOT in $artifact schema"
|
|
61
|
+
FAILS=$((FAILS + 1))
|
|
62
|
+
fi
|
|
63
|
+
done
|
|
64
|
+
|
|
65
|
+
echo ""
|
|
66
|
+
echo "=== Compatibility: $PASSES pass, $FAILS fail ==="
|
|
67
|
+
[[ $FAILS -eq 0 ]] && exit 0 || exit 1
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# context-audit.sh — Pipeline transparency for context injection
|
|
3
|
+
# Usage: bash ~/.claude/scripts/context-audit.sh
|
|
4
|
+
# or via skill: /context-audit
|
|
5
|
+
# Rewritten for #147: surfaces filter stages, domain balance, precision trend
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
CLAUDE_DIR="${HOME}/.claude"
|
|
10
|
+
STATE_DIR="${CLAUDE_DIR}/MEMORY/STATE"
|
|
11
|
+
AGENTGRIT_STATE="${HOME}/.agentgrit/state"
|
|
12
|
+
SESSION_CTX="${STATE_DIR}/session-context.json"
|
|
13
|
+
AGENTGRIT_CTX="${AGENTGRIT_STATE}/session-context.json"
|
|
14
|
+
RULE_DOMAINS="${CLAUDE_DIR}/MEMORY/LEARNING/STATE/rule-domains.json"
|
|
15
|
+
RECALL_SCORES="${CLAUDE_DIR}/MEMORY/LEARNING/STATE/recall-scores.json"
|
|
16
|
+
RULE_STATS="${AGENTGRIT_STATE}/rule-stats.json"
|
|
17
|
+
|
|
18
|
+
echo ""
|
|
19
|
+
echo "════════════════════════════════════════════════"
|
|
20
|
+
echo " CONTEXT AUDIT"
|
|
21
|
+
echo "════════════════════════════════════════════════"
|
|
22
|
+
echo ""
|
|
23
|
+
|
|
24
|
+
# ── 1. SESSION ──
|
|
25
|
+
if [[ -f "$SESSION_CTX" ]]; then
|
|
26
|
+
python3 -c "
|
|
27
|
+
import json
|
|
28
|
+
from datetime import datetime, timezone
|
|
29
|
+
|
|
30
|
+
with open('$SESSION_CTX') as f:
|
|
31
|
+
ctx = json.load(f)
|
|
32
|
+
|
|
33
|
+
ts = ctx.get('timestamp','')
|
|
34
|
+
domains = ctx.get('domains', [])
|
|
35
|
+
source = ctx.get('domain_source', '?')
|
|
36
|
+
signals = ctx.get('detection_signals', [])
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
created = datetime.fromisoformat(ts.replace('Z', '+00:00'))
|
|
40
|
+
age_h = (datetime.now(timezone.utc) - created).total_seconds() / 3600
|
|
41
|
+
expired = age_h > 24
|
|
42
|
+
except:
|
|
43
|
+
age_h = 0
|
|
44
|
+
expired = False
|
|
45
|
+
|
|
46
|
+
print('-- SESSION --')
|
|
47
|
+
print(f' Created: {ts[:19]}')
|
|
48
|
+
print(f' Age: {age_h:.1f}h {\"!! EXPIRED\" if expired else \"\"}')
|
|
49
|
+
print(f' Domains: {len(domains)} -- {\", \".join(domains)}')
|
|
50
|
+
print(f' Source: {source}')
|
|
51
|
+
print(f' Signals: {\", \".join(signals) if signals else \"none\"}')
|
|
52
|
+
print()
|
|
53
|
+
"
|
|
54
|
+
else
|
|
55
|
+
echo "-- SESSION --"
|
|
56
|
+
echo " No session-context.json found at ${SESSION_CTX}"
|
|
57
|
+
echo ""
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# ── 2. PIPELINE ──
|
|
61
|
+
if [[ -f "$SESSION_CTX" ]]; then
|
|
62
|
+
python3 -c "
|
|
63
|
+
import json
|
|
64
|
+
|
|
65
|
+
with open('$SESSION_CTX') as f:
|
|
66
|
+
ctx = json.load(f)
|
|
67
|
+
|
|
68
|
+
pipeline = ctx.get('pipeline', {})
|
|
69
|
+
if not pipeline:
|
|
70
|
+
print('-- PIPELINE --')
|
|
71
|
+
print(' No pipeline metadata (session predates #147)')
|
|
72
|
+
print()
|
|
73
|
+
else:
|
|
74
|
+
raw_clusters = pipeline.get('rawCandidateCount', 0)
|
|
75
|
+
raw_ag = pipeline.get('rawAgentgritCount', 0)
|
|
76
|
+
suppressed = pipeline.get('suppressed', [])
|
|
77
|
+
diversity = pipeline.get('diversityDropped', [])
|
|
78
|
+
bm25 = pipeline.get('bm25Stats', {})
|
|
79
|
+
final_rules = ctx.get('loaded_rule_ids', [])
|
|
80
|
+
bm25_total = bm25.get('total', 0)
|
|
81
|
+
bm25_passed = bm25.get('passed', 0)
|
|
82
|
+
|
|
83
|
+
sup_count = len(suppressed)
|
|
84
|
+
div_count = len(diversity)
|
|
85
|
+
|
|
86
|
+
print('-- PIPELINE --')
|
|
87
|
+
print(f' Graph clusters: {raw_clusters} raw')
|
|
88
|
+
print(f' AgentGrit rules: {raw_ag} raw')
|
|
89
|
+
print(f' Always-on suppressed: -{sup_count:>3} (from both sources)')
|
|
90
|
+
print(f' Diversity enforced: -{div_count:>3} (cap {3}/domain per-source)')
|
|
91
|
+
print(f' BM25 (learned): {bm25_total} total -> {bm25_passed} passed')
|
|
92
|
+
print(f' Final injected: {len(final_rules)}')
|
|
93
|
+
print(f' Sources: clusters + agentgrit + learned')
|
|
94
|
+
print()
|
|
95
|
+
|
|
96
|
+
if suppressed:
|
|
97
|
+
print(' Suppressed IDs:')
|
|
98
|
+
for rid in suppressed:
|
|
99
|
+
print(f' - {rid}')
|
|
100
|
+
print()
|
|
101
|
+
|
|
102
|
+
if diversity:
|
|
103
|
+
print(' Diversity-dropped IDs:')
|
|
104
|
+
for rid in diversity:
|
|
105
|
+
print(f' - {rid}')
|
|
106
|
+
print()
|
|
107
|
+
"
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# ── 3. DOMAIN BALANCE ──
|
|
111
|
+
if [[ -f "$SESSION_CTX" ]]; then
|
|
112
|
+
python3 -c "
|
|
113
|
+
import json
|
|
114
|
+
|
|
115
|
+
with open('$SESSION_CTX') as f:
|
|
116
|
+
ctx = json.load(f)
|
|
117
|
+
|
|
118
|
+
pipeline = ctx.get('pipeline', {})
|
|
119
|
+
dist = pipeline.get('domainDistribution', {})
|
|
120
|
+
domains = ctx.get('domains', [])
|
|
121
|
+
|
|
122
|
+
if not dist:
|
|
123
|
+
# Fall back: compute from loaded_rule_ids + rule-domains.json
|
|
124
|
+
try:
|
|
125
|
+
with open('$RULE_DOMAINS') as f:
|
|
126
|
+
rd = json.load(f)
|
|
127
|
+
rules_meta = rd.get('rules', {})
|
|
128
|
+
dist = {}
|
|
129
|
+
for rid in ctx.get('loaded_rule_ids', []):
|
|
130
|
+
d = rules_meta.get(rid, {}).get('domains', ['unknown'])[0]
|
|
131
|
+
dist[d] = dist.get(d, 0) + 1
|
|
132
|
+
except:
|
|
133
|
+
pass
|
|
134
|
+
|
|
135
|
+
if dist:
|
|
136
|
+
print('-- DOMAIN BALANCE --')
|
|
137
|
+
max_count = max(dist.values()) if dist else 0
|
|
138
|
+
cap = 3 # MAX_PER_DOMAIN from GraphContext.hook.ts
|
|
139
|
+
sorted_domains = sorted(dist.items(), key=lambda x: -x[1])
|
|
140
|
+
for domain, count in sorted_domains:
|
|
141
|
+
bar = '#' * count
|
|
142
|
+
over = ' !! >3 combined (cap is per-source)' if count > cap else ''
|
|
143
|
+
match = ' (detected)' if domain in domains else ''
|
|
144
|
+
print(f' {domain:<20} {bar:<15} {count}{over}{match}')
|
|
145
|
+
print()
|
|
146
|
+
"
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# ── 4. INJECTED RULES (with relevance) ──
|
|
150
|
+
if [[ -f "$SESSION_CTX" ]]; then
|
|
151
|
+
python3 -c "
|
|
152
|
+
import json, os
|
|
153
|
+
|
|
154
|
+
with open('$SESSION_CTX') as f:
|
|
155
|
+
ctx = json.load(f)
|
|
156
|
+
|
|
157
|
+
# Load rule domains for relevance check
|
|
158
|
+
rule_domains = {}
|
|
159
|
+
try:
|
|
160
|
+
with open('$RULE_DOMAINS') as f:
|
|
161
|
+
rd = json.load(f)
|
|
162
|
+
rule_domains = rd.get('rules', {})
|
|
163
|
+
except:
|
|
164
|
+
pass
|
|
165
|
+
|
|
166
|
+
# Load rule stats for quality metrics
|
|
167
|
+
stats_map = {}
|
|
168
|
+
try:
|
|
169
|
+
with open('$RULE_STATS') as f:
|
|
170
|
+
stats = json.load(f)
|
|
171
|
+
stats_map = {s['ruleId']: s for s in stats}
|
|
172
|
+
except:
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
session_domains = set(ctx.get('domains', []))
|
|
176
|
+
rules = ctx.get('loaded_rule_ids', [])
|
|
177
|
+
|
|
178
|
+
print('-- INJECTED RULES --')
|
|
179
|
+
print(f' {\"#\":<3} {\"Rule\":<55} {\"Avg\":>5} {\"Sess\":>4} Relevance')
|
|
180
|
+
print(f' {\"-\"*3} {\"-\"*55} {\"-\"*5} {\"-\"*4} {\"-\"*10}')
|
|
181
|
+
|
|
182
|
+
match_count = 0
|
|
183
|
+
mismatch_count = 0
|
|
184
|
+
|
|
185
|
+
for i, rid in enumerate(rules, 1):
|
|
186
|
+
stat = stats_map.get(rid, {})
|
|
187
|
+
avg = stat.get('avgCorrelatedRating', 0)
|
|
188
|
+
sessions = len(stat.get('sessionRatings', []))
|
|
189
|
+
|
|
190
|
+
name = rid[:55]
|
|
191
|
+
|
|
192
|
+
# Relevance: check if rule's domains overlap with session domains
|
|
193
|
+
rule_meta = rule_domains.get(rid, {})
|
|
194
|
+
rule_doms = set(rule_meta.get('domains', []))
|
|
195
|
+
if rule_doms & session_domains:
|
|
196
|
+
relevance = 'MATCH'
|
|
197
|
+
match_count += 1
|
|
198
|
+
elif not rule_doms:
|
|
199
|
+
relevance = '? no domain'
|
|
200
|
+
mismatch_count += 1
|
|
201
|
+
else:
|
|
202
|
+
relevance = 'MISMATCH'
|
|
203
|
+
mismatch_count += 1
|
|
204
|
+
|
|
205
|
+
print(f' {i:<3} {name:<55} {avg:>5.1f} {sessions:>4} {relevance}')
|
|
206
|
+
|
|
207
|
+
print()
|
|
208
|
+
print(f' Relevance: {match_count} MATCH, {mismatch_count} MISMATCH/unknown')
|
|
209
|
+
print()
|
|
210
|
+
"
|
|
211
|
+
fi
|
|
212
|
+
|
|
213
|
+
# ── 5. PRECISION TREND ──
|
|
214
|
+
if [[ -f "$RECALL_SCORES" ]]; then
|
|
215
|
+
python3 -c "
|
|
216
|
+
import json
|
|
217
|
+
|
|
218
|
+
with open('$RECALL_SCORES') as f:
|
|
219
|
+
scores = json.load(f)
|
|
220
|
+
|
|
221
|
+
p5 = scores.get('mean_precision5', 0)
|
|
222
|
+
target = 0.64
|
|
223
|
+
r5 = scores.get('mean_recall5', 0)
|
|
224
|
+
r10 = scores.get('mean_recall10', 0)
|
|
225
|
+
mrr = scores.get('mean_mrr', 0)
|
|
226
|
+
sessions = scores.get('sessions_evaluated', 0)
|
|
227
|
+
last_int = scores.get('last_intervention', 'unknown')[:10]
|
|
228
|
+
|
|
229
|
+
delta = p5 - target
|
|
230
|
+
direction = '+' if delta >= 0 else ''
|
|
231
|
+
|
|
232
|
+
print('-- PRECISION TREND --')
|
|
233
|
+
print(f' precision@5: {p5:.3f} (target: {target}, delta: {direction}{delta:.3f})')
|
|
234
|
+
print(f' recall@5: {r5:.3f}')
|
|
235
|
+
print(f' recall@10: {r10:.3f}')
|
|
236
|
+
print(f' MRR: {mrr:.3f}')
|
|
237
|
+
print(f' Sessions evaluated:{sessions}')
|
|
238
|
+
print(f' Last intervention: {last_int}')
|
|
239
|
+
print()
|
|
240
|
+
"
|
|
241
|
+
else
|
|
242
|
+
echo "-- PRECISION TREND --"
|
|
243
|
+
echo " No recall-scores.json found"
|
|
244
|
+
echo ""
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
# ── 6. SUPPRESSED RULES ──
|
|
248
|
+
python3 -c "
|
|
249
|
+
import json
|
|
250
|
+
|
|
251
|
+
# Read suppressed list from pipeline metadata if available
|
|
252
|
+
suppressed_ids = []
|
|
253
|
+
try:
|
|
254
|
+
with open('$SESSION_CTX') as f:
|
|
255
|
+
ctx = json.load(f)
|
|
256
|
+
suppressed_ids = ctx.get('pipeline', {}).get('suppressed', [])
|
|
257
|
+
except:
|
|
258
|
+
pass
|
|
259
|
+
|
|
260
|
+
# Also show the static ALWAYS_ON_SUPPRESSED list for reference
|
|
261
|
+
always_on = [
|
|
262
|
+
'feedback_capture_decisions_immediately',
|
|
263
|
+
'feedback_always_update_docs',
|
|
264
|
+
'feedback_verify_before_answering',
|
|
265
|
+
'feedback_iterative_quality_loop',
|
|
266
|
+
'success_real-data-honest-gaps',
|
|
267
|
+
'feedback_exhaustive-search-before-claiming-nonexistence',
|
|
268
|
+
'feedback_read-background-task-output',
|
|
269
|
+
'feedback_avoid-unnecessary-doc-regeneration',
|
|
270
|
+
'feedback_proactive-spot-check-patterns',
|
|
271
|
+
'success_technical-explanation-direct-and-structu',
|
|
272
|
+
]
|
|
273
|
+
|
|
274
|
+
# Load rule names from knowledge graph if available
|
|
275
|
+
rule_names = {}
|
|
276
|
+
try:
|
|
277
|
+
with open('${AGENTGRIT_STATE}/knowledge-graph.json') as f:
|
|
278
|
+
graph = json.load(f)
|
|
279
|
+
for node in graph.get('nodes', []):
|
|
280
|
+
rule_names[node.get('id', '')] = node.get('text', '')[:60]
|
|
281
|
+
except:
|
|
282
|
+
pass
|
|
283
|
+
|
|
284
|
+
print('-- SUPPRESSED RULES --')
|
|
285
|
+
print(f' Always-on suppression list ({len(always_on)} rules):')
|
|
286
|
+
for rid in always_on:
|
|
287
|
+
hit = ' (was in candidates)' if rid in suppressed_ids else ''
|
|
288
|
+
name = rule_names.get(rid, '')
|
|
289
|
+
label = f' -- {name}' if name else ''
|
|
290
|
+
print(f' {rid}{label}{hit}')
|
|
291
|
+
print()
|
|
292
|
+
"
|
|
293
|
+
|
|
294
|
+
# ── RECENT SESSIONS ──
|
|
295
|
+
if [[ -f "${AGENTGRIT_STATE}/session-context-history.jsonl" ]]; then
|
|
296
|
+
echo "-- RECENT SESSIONS --"
|
|
297
|
+
tail -5 "${AGENTGRIT_STATE}/session-context-history.jsonl" | python3 -c "
|
|
298
|
+
import sys, json
|
|
299
|
+
for line in sys.stdin:
|
|
300
|
+
line = line.strip()
|
|
301
|
+
if not line: continue
|
|
302
|
+
try:
|
|
303
|
+
d = json.loads(line)
|
|
304
|
+
ts = d.get('timestamp','')[:16]
|
|
305
|
+
rules = d.get('rulesInjectedCount', '?')
|
|
306
|
+
kb = d.get('rulesInjectedKB', '?')
|
|
307
|
+
domains = len(d.get('domains', []))
|
|
308
|
+
print(f' {ts} | {rules} rules | {kb} KB | {domains} domains')
|
|
309
|
+
except: pass
|
|
310
|
+
"
|
|
311
|
+
echo ""
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
echo "════════════════════════════════════════════════"
|