Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
id: AILOG-2026-08-14-002
title: guard_closure in remediation AILOGs — GUARD-001 + amend template (#419, PR 3 of CHARTER-02)
status: accepted
created: 2026-08-14
agent: qoder-cli-v1.0
confidence: high
review_required: false
risk_level: medium
eu_ai_act_risk: not_applicable
nist_genai_risks: []
iso_42001_clause: []
files_modified:
- core/src/document.rs
- core/Cargo.toml
- experiment-loom/Cargo.toml
- experiment-baton/Cargo.toml
- cli/src/validation.rs
- cli/src/commands/charter/amend.rs
- cli/Cargo.toml
- Cargo.lock
- cli/tests/charter_amend_test.rs
- STRAYMARK.md
- dist/STRAYMARK.md
- dist/dist-manifest.yml
- dist/.claude/skills/straymark-audit-review/SKILL.md
- dist/.qoder/skills/straymark-audit-review/SKILL.md
- dist/.qwen/skills/straymark-audit-review/SKILL.md
- dist/.codex/skills/straymark-audit-review/SKILL.md
- dist/.agent/skills/straymark-audit-review/SKILL.md
- CHANGELOG.md
- README.md
- docs/i18n/es/README.md
- docs/i18n/zh-CN/README.md
- docs/adopters/CLI-REFERENCE.md
- docs/i18n/es/adopters/CLI-REFERENCE.md
- docs/i18n/zh-CN/adopters/CLI-REFERENCE.md
- dist/.straymark/00-governance/AGENT-RULES.md
- dist/.straymark/00-governance/C4-DIAGRAM-GUIDE.md
- dist/.straymark/00-governance/DOCUMENTATION-POLICY.md
- dist/.straymark/00-governance/FOLLOW-UPS-BACKLOG-PATTERN.md
- dist/.straymark/00-governance/QUICK-REFERENCE.md
- dist/.straymark/00-governance/i18n/es/AGENT-RULES.md
- dist/.straymark/00-governance/i18n/es/C4-DIAGRAM-GUIDE.md
- dist/.straymark/00-governance/i18n/es/DOCUMENTATION-POLICY.md
- dist/.straymark/00-governance/i18n/es/FOLLOW-UPS-BACKLOG-PATTERN.md
- dist/.straymark/00-governance/i18n/es/QUICK-REFERENCE.md
- dist/.straymark/00-governance/i18n/zh-CN/AGENT-RULES.md
- dist/.straymark/00-governance/i18n/zh-CN/C4-DIAGRAM-GUIDE.md
- dist/.straymark/00-governance/i18n/zh-CN/DOCUMENTATION-POLICY.md
- dist/.straymark/00-governance/i18n/zh-CN/FOLLOW-UPS-BACKLOG-PATTERN.md
- dist/.straymark/00-governance/i18n/zh-CN/QUICK-REFERENCE.md
observability_scope: none
tags: [guard-closure, remediation, charter-amend, reference-resolution, adopter-feedback, core, cli, charter-02]
related:
- AILOG-2026-08-14-001
---

# AILOG: guard_closure in remediation AILOGs (#419, PR 3)

## Summary

Issue #419 case 3: a remediation AILOG closed a Critical finding with prose
alone — the fix landed, but no mechanical check stood between the defect and
its recurrence, and nothing asked for one. PRs 1–2 gave id citations and
registry code claims a resolver; this PR makes the *absence of a recurrence
guard* a first-class, validatable fact. CHARTER-02 closes here.

Defect class covered (design constraint 3): **unguarded remediations** —
findings "fixed" with no barrier against recurrence.

## Decision

Remediation AILOGs carry a `guard_closure:` list — one item per finding being
closed, each declaring **exactly one** of:

- `guard:` — the mechanical check (rule id, CLI flag, CI gate) that prevents
recurrence; or
- `unguardable:` — a specific rationale when no mechanical guard exists.

An AILOG counts as a remediation AILOG by the presence of `trigger:`
(`external_audit | production_incident | deferred_implementation`) — the
signature `charter amend` already writes. Detection stays structural: no
heuristic guesses at prose intent.

`GUARD-001` (Warning, warn-first — design constraint 1) fires when:

- a remediation AILOG lacks `guard_closure:` or leaves it empty;
- an item sets both `guard` and `unguardable`, or neither; or
- `unguardable` is generic — a stock phrase ("human review", "n/a", "not
applicable", …) or a rationale under 30 characters. The generic-rationale
check is the precision-sensitive half: it is heuristic by nature, which is
exactly why the rule is a warning and not an error.

Pre-existing remediation AILOGs legitimately lack the field, so the flip to
Error waits for a measured adopter baseline (same discipline as REF-003).

`charter amend` scaffolds the field: the amendment template renders a
commented `guard_closure:` block with one placeholder item, so the operator
fills it at authoring time instead of discovering GUARD-001 at validation
time. The `straymark-audit-review` skill's remediation template now requires
a **Guard** line per item, so external audit cycles feed the field upstream.

## Actions Performed

- `core/src/document.rs`: `GuardClosureItem { finding, guard, unguardable }`;
`Frontmatter` gains `trigger` + `guard_closure` (additive → core 0.10.0;
experiment-loom / experiment-baton pins follow).
- `cli/src/validation.rs`: `check_guard_closure` wired after
`check_type_specific` — the three warning conditions above. 5 unit tests.
- `cli/src/commands/charter/amend.rs`: template renders the commented
`guard_closure:` block after `findings_closed:`.
- `STRAYMARK.md` + `dist/STRAYMARK.md`: §8 frontmatter snippet, §13
type-table note, §15.B guard-closure paragraph.
- `straymark-audit-review` SKILL.md: Guard line required per remediation
item — canonical `.claude` edited; `.qoder` / `.qwen` copied;
`.codex` / `.agent` regenerated via `gen_minimal_skills` (`--check`
clean).
- Framework 4.44.0 / CLI 3.48.0: CHANGELOG entry, `dist-manifest.yml`
version, footer stamp sweep (21 files).
- 1 integration test (amend template renders `guard_closure:` and the
rendered frontmatter parses).

## Risks

- R2 (Charter): GUARD-001 false positives on remediation AILOGs whose guard
genuinely is "a human looks at it". Mitigation: warn-first, and the
`unguardable:` escape hatch only demands specificity (≥30 chars, no stock
phrases), not a different decision. No new instance surfaced during
implementation.
- R4 (new, not in Charter): release-mechanics files not in the original
declaration — the experiment-crate core pins, `dist/dist-manifest.yml`,
and the 21-file footer stamp sweep. Same category as PR 1's Cargo.lock
row: mechanical followers of a version bump, recorded here and added to
the Charter table in this same PR per the drift-check protocol.
- R5 (new, not in Charter): `STRAYMARK.md` (repo root) is declared in the
Charter and was edited on disk — §8, §13, §15.B — but can never appear
in a git drift range: `.gitignore` excludes it (operator-local mirror
kept in sync by `straymark update`). The tracked half of the change is
`dist/STRAYMARK.md`, modified in this PR.

## Validation

- `cargo test --workspace` green (429 unit tests incl. the 5 new GUARD-001
cases; 5/5 `charter_amend` integration tests).
- Dogfood: `straymark validate . --include-charters` — 0 errors; warning
count steady (no GUARD-001 fire: this repository's remediation AILOGs
predate the field, and none is in the changed set — warn-first means even
a fire would not block).
- Dogfood: `charter amend` against a fixture charter renders the
`guard_closure:` block; the rendered frontmatter parses.
- `gen_minimal_skills --check` clean after regeneration.

## Follow-ups

- GUARD-001 severity flip to Error: only after the warn-first baseline is
measured across adopters (tracked alongside REF-003 in the Charter's
out-of-scope note; FU-007 covers the REF-003 side).
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ PR 3 — guard-closure in remediation AILOGs (fw + cli):
| `cli/src/commands/analyze_declared_vs_wired.rs` | Reuse the extracted shared walker instead of its private `collect_symbols` |
| `core/src/document.rs` | `Frontmatter` gains optional `guard_closure` (additive) |
| `cli/src/commands/charter/amend.rs` | Remediation-AILOG template renders `guard_closure` |
| `cli/Cargo.toml` | `regex`+`glob` → required deps; version bumps (3.46.0, 3.47.0, patch for PR 3) |
| `cli/Cargo.toml` | `regex`+`glob` → required deps; version bumps (3.46.0, 3.47.0, 3.48.0) |
| `core/Cargo.toml` | Minor bump for the additive Frontmatter field |
| `experiment-loom/Cargo.toml` | `straymark-core` pin → 0.10.0 (added during PR 3 per closure protocol) |
| `experiment-baton/Cargo.toml` | `straymark-core` pin → 0.10.0 (added during PR 3 per closure protocol) |
| `dist/dist-manifest.yml` | `version:` → 4.44.0 (added during PR 3 per closure protocol) |
| `README.md` | Footer stamp fw-4.43.0 → fw-4.44.0 — follows the framework release like Cargo.lock follows cli bumps (added during PR 3 per closure protocol) |
| `docs/i18n/*/README.md` | Same stamp sweep, localized READMEs (added during PR 3 per closure protocol) |
| `dist/.straymark/00-governance/**` | Same stamp sweep, governance footers incl. i18n (added during PR 3 per closure protocol) |
| `cli/tests/validate_test.rs` | `--commit-msg` pass/fail, REF-003 warning, REF-001 error |
| `cli/tests/followups_test.rs` | `--claims` batch cases over a fixture tree |
| `cli/tests/charter_amend_test.rs` | Template renders `guard_closure` |
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project uses [independent versioning](README.md#versioning) for Framewo

---

## Framework 4.44.0 / CLI 3.48.0 — 2026-08-14

Third and closing PR of CHARTER-02 (#419): a remediation AILOG used to be able to close a Critical finding with prose alone — no mechanical check preventing recurrence, and nothing asked for one. This release makes the absence of a guard a first-class, validatable fact instead of an invisible omission.

### Added (Framework + CLI)

- **`guard_closure:` frontmatter field on remediation AILOGs** (#419, fw-4.44.0 / core 0.10.0): one item per finding being closed, each declaring **exactly one** of `guard:` (the mechanical check — rule id, CLI flag, or CI gate — that prevents recurrence) or `unguardable:` (a specific rationale when no mechanical guard exists). A remediation AILOG is recognized by the presence of `trigger:` (`external_audit | production_incident | deferred_implementation`). Documented in STRAYMARK.md §8 (frontmatter snippet), §13 (type-table note), and §15.B (guard-closure paragraph); the `straymark-audit-review` skill's remediation template now requires a **Guard** line per item so the audit cycle feeds the field.

- **`GUARD-001` validation rule** (#419, warn-first): fires on remediation AILOGs when `guard_closure:` is missing or empty, when an item sets both or neither of `guard`/`unguardable`, or when `unguardable` is generic — stock phrases ("human review", "n/a", "not applicable", …) or a rationale under 30 characters. Warn-first by design constraint: pre-existing remediation AILOGs legitimately lack the field, so the flip to Error waits for a measured adopter baseline. Defect class: unguarded remediations — findings "fixed" with no barrier against recurrence (issue case 3).

- **`charter amend` scaffolds the field**: the amendment AILOG template now renders a commented `guard_closure:` block (one placeholder item, syntax reminder inline) so the operator fills it instead of discovering GUARD-001 at validation time.

## CLI 3.47.0 — 2026-08-14

Second PR of CHARTER-02 (#419): the follow-ups registry also states claims about the tree — and those decay just as silently as id citations do.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ StrayMark uses independent version tags for each component:

| Component | Tag prefix | Example | Includes |
| --- | --- | --- | --- |
| Framework | `fw-` | `fw-4.43.0` | Templates (12 types), governance, directives, Charter template + schema |
| Framework | `fw-` | `fw-4.44.0` | Templates (12 types), governance, directives, Charter template + schema |
| CLI | `cli-` | `cli-3.45.0` | The `straymark` binary |
| Loom (EXPERIMENTAL) | `loom-` | `loom-0.4.2` | The `straymark-loom` visualization server, downloaded on demand by `straymark loom serve` |

Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "straymark-cli"
version = "3.47.0"
version = "3.48.0"
edition = "2021"
description = "CLI for StrayMark — the cognitive discipline your AI-assisted projects need"
license = "MIT"
Expand All @@ -25,7 +25,7 @@ path = "src/bin/gen_minimal_skills.rs"
required-features = ["dev-tools"]

[dependencies]
straymark-core = { version = "0.9.1", path = "../core" }
straymark-core = { version = "0.10.0", path = "../core" }
clap = { version = "4", features = ["derive"] }
reqwest = { version = "0.12", features = ["blocking", "rustls-tls", "json"] }
serde = { version = "1", features = ["derive"] }
Expand Down
6 changes: 6 additions & 0 deletions cli/src/commands/charter/amend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ review_required: true\n\
{amends_line}\
trigger: {trigger}\n\
findings_closed: {findings_closed}\n\
guard_closure:\n\
# Per finding being closed: exactly one of `guard:` (the mechanical check that now\n\
# prevents recurrence — a command, rule, or test) or `unguardable:` (a specific\n\
# rationale; stock phrases like 'human review' trip GUARD-001). One item per finding.\n\
- finding: F1 # replace with the real finding id from the audit review\n\
guard: \"\"\n\
---\n\
\n\
# {title}\n\
Expand Down
Loading