Skip to content

Document Guard Fail-Mode Matrix (Fail-Open vs Fail-Closed)#2180

Merged
Trecek merged 2 commits into
developfrom
document-guard-fail-mode-matrix-fail-open-vs-fail-closed/2045
May 7, 2026
Merged

Document Guard Fail-Mode Matrix (Fail-Open vs Fail-Closed)#2180
Trecek merged 2 commits into
developfrom
document-guard-fail-mode-matrix-fail-open-vs-fail-closed/2045

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 7, 2026

Summary

Surface the actual fail-mode behavior of all guards into two documentation files (hooks/guards/CLAUDE.md and docs/safety/hooks.md) so agents can correctly predict whether an unrecognized session type or runtime error will be approved or denied — without reading guard source code. This is a documentation-only change: no guard code is modified.

Requirements

Required Changes

1. src/autoskillit/hooks/guards/CLAUDE.md

Replace the single-sentence fail-mode description with the expanded fail-mode contract block (matrix table + design principle).

2. docs/safety/hooks.md

Add a "Fail Modes" subsection after the hook descriptions section, with the same matrix and explanation.

3. Guard file docstrings (verification only)

Verify each guard's module docstring already documents its own fail mode:

  • skill_orchestration_guard.py:31 — "fail-closed to skill session"
  • open_kitchen_guard.py:118 — "skill session, unset, or invalid — deny (fail-closed)"
  • skill_command_guard.py:4 — "Unexpected errors: fail-closed (deny)"

No changes needed to guard code — this is purely documentation.

Acceptance Criteria

  • guards/CLAUDE.md contains the fail-mode matrix table
  • docs/safety/hooks.md contains a "Fail Modes" section
  • An agent reading ONLY guards/CLAUDE.md can correctly predict whether an unrecognized session type will be approved or denied by each guard
  • No code changes — this is purely documentation

Closes #2045

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260507-111320-037598/.autoskillit/temp/make-plan/document_guard_fail_mode_matrix_plan_2026-05-07_111320.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan claude-opus-4-6 1 77 7.6k 947.9k 56.8k 56 47.0k 7m 17s
verify claude-opus-4-6 1 31 4.8k 451.4k 44.1k 48 34.7k 3m 21s
implement* MiniMax-M2.7-highspeed 1 391.7k 5.4k 789.7k 48.4k 60 34.7k 2m 45s
prepare_pr* MiniMax-M2.7-highspeed 1 66.5k 4.2k 205.4k 29.8k 22 15.2k 1m 22s
compose_pr* MiniMax-M2.7-highspeed 1 57.6k 1.6k 235.2k 29.8k 16 15.0k 42s
Total 515.9k 23.6k 2.6M 56.8k 146.6k 15m 28s

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
plan 0
verify 0
implement 753 1048.8 46.1 7.2
prepare_pr 0
compose_pr 0
Total 753 3492.1 194.7 31.4

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
claude-opus-4-6 2 108 12.3k 1.4M 81.6k 10m 38s
MiniMax-M2.7-highspeed 3 515.8k 11.3k 1.2M 65.0k 4m 49s

@Trecek Trecek added this pull request to the merge queue May 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch May 7, 2026
Trecek and others added 2 commits May 7, 2026 12:47
Add Fail-Mode Contract section to guards/CLAUDE.md with a matrix table
documenting the three fail-closed guards (skill_command_guard,
open_kitchen_guard, skill_orchestration_guard) and their conditions.

Mirror the same section into docs/safety/hooks.md between SessionStart
and Drift detection sections.

Add tests/docs/test_guard_fail_mode_docs.py verifying both doc files
contain the fail-mode matrix and the old single-sentence description
is removed from guards/CLAUDE.md.

No guard code changes — docstrings already correctly document fail modes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ard and design-principle assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Trecek Trecek force-pushed the document-guard-fail-mode-matrix-fail-open-vs-fail-closed/2045 branch from 599e22c to a5d6d84 Compare May 7, 2026 19:47
@Trecek Trecek added this pull request to the merge queue May 7, 2026
Merged via the queue into develop with commit a0d9749 May 7, 2026
2 checks passed
@Trecek Trecek deleted the document-guard-fail-mode-matrix-fail-open-vs-fail-closed/2045 branch May 7, 2026 20:00
Trecek added a commit that referenced this pull request May 8, 2026
## Summary

Surface the actual fail-mode behavior of all guards into two
documentation files (`hooks/guards/CLAUDE.md` and
`docs/safety/hooks.md`) so agents can correctly predict whether an
unrecognized session type or runtime error will be approved or denied —
without reading guard source code. This is a documentation-only change:
no guard code is modified.

## Requirements

### Required Changes

#### 1. `src/autoskillit/hooks/guards/CLAUDE.md`

Replace the single-sentence fail-mode description with the expanded
fail-mode contract block (matrix table + design principle).

#### 2. `docs/safety/hooks.md`

Add a "Fail Modes" subsection after the hook descriptions section, with
the same matrix and explanation.

#### 3. Guard file docstrings (verification only)

Verify each guard's module docstring already documents its own fail
mode:
- `skill_orchestration_guard.py:31` — "fail-closed to skill session"
- `open_kitchen_guard.py:118` — "skill session, unset, or invalid — deny
(fail-closed)"
- `skill_command_guard.py:4` — "Unexpected errors: fail-closed (deny)"

No changes needed to guard code — this is purely documentation.

## Acceptance Criteria

- `guards/CLAUDE.md` contains the fail-mode matrix table
- `docs/safety/hooks.md` contains a "Fail Modes" section
- An agent reading ONLY `guards/CLAUDE.md` can correctly predict whether
an unrecognized session type will be approved or denied by each guard
- No code changes — this is purely documentation

Closes #2045

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260507-111320-037598/.autoskillit/temp/make-plan/document_guard_fail_mode_matrix_plan_2026-05-07_111320.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->

## Token Usage Summary

| Step | Model | count | uncached | output | cache_read | peak_ctx |
turns | cache_write | time |

|------|-------|-------|----------|--------|------------|----------|-------|-------------|------|
| plan | claude-opus-4-6 | 1 | 77 | 7.6k | 947.9k | 56.8k | 56 | 47.0k |
7m 17s |
| verify | claude-opus-4-6 | 1 | 31 | 4.8k | 451.4k | 44.1k | 48 | 34.7k
| 3m 21s |
| implement* | MiniMax-M2.7-highspeed | 1 | 391.7k | 5.4k | 789.7k |
48.4k | 60 | 34.7k | 2m 45s |
| prepare_pr* | MiniMax-M2.7-highspeed | 1 | 66.5k | 4.2k | 205.4k |
29.8k | 22 | 15.2k | 1m 22s |
| compose_pr* | MiniMax-M2.7-highspeed | 1 | 57.6k | 1.6k | 235.2k |
29.8k | 16 | 15.0k | 42s |
| **Total** | | | 515.9k | 23.6k | 2.6M | 56.8k | | 146.6k | 15m 28s |

\* *Step used a non-Anthropic provider; caching behavior may differ.*

## Token Efficiency

| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| plan | 0 | — | — | — |
| verify | 0 | — | — | — |
| implement | 753 | 1048.8 | 46.1 | 7.2 |
| prepare_pr | 0 | — | — | — |
| compose_pr | 0 | — | — | — |
| **Total** | **753** | 3492.1 | 194.7 | 31.4 |

## Model Usage Breakdown

| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| claude-opus-4-6 | 2 | 108 | 12.3k | 1.4M | 81.6k | 10m 38s |
| MiniMax-M2.7-highspeed | 3 | 515.8k | 11.3k | 1.2M | 65.0k | 4m 49s |

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant