Skip to content
Back to skills

Boundary Contract

ASecurity

Writes a boundary contract listing the work's objective, allowed and prohibited paths and actions, acceptance criteria, phase and stop conditions, when task-router requires one.

  • 15 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 28, 2026
ai-agentsjavascriptpythongojavashelldebugging

Works with

  • terminal

Security analysis

A100/100

Scanned November 23, 2026

npx -y skills add AidALL/ghost-alice --skill boundary-contract --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Boundary Contract?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Boundary Contract
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aidall-boundary-contract/badge)](https://www.skillsdirectory.com/skills/aidall-boundary-contract)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: boundary-contract
description: "Writes a boundary contract listing the work's objective, allowed and prohibited paths and actions, acceptance criteria, phase and stop conditions, when task-router requires one."
compatibility:
  - "Python 3.11+ standard library"
---

# Boundary Contract

When the response model selects `boundary-contract: required` while following task-router, it uses this skill to declare the work's objective, allowed and prohibited surfaces (paths, layers and actions), acceptance criteria, phase and stop conditions. Writing the contract does not carry out the work. Task-router defines when this skill applies; this skill defines how the response model declares the boundary.

## Authority and renewal

The human user's current and earlier instructions set the objective and bound the actions, targets, side effects and resources that the response model may declare as allowed. In a delegate's session, the assignment from the parent session or parent agent that started the delegate (the parent) supplies the objective, constraints and acceptance criteria within the authority the human user gave the parent; it carries no authority of its own. The response model names the source of each constraint, including the project instructions and the common contract. Recorded input facts, task-router's selection, a wider focus and an agent's implementation plan grant no additional authority.

The response model distinguishes a boundary the human user set from a narrower self-declared implementation limit. When a necessary action exceeds only the narrower implementation limit, the response model renews that contract within what the human user's instructions authorize and continues. When the action exceeds a boundary the human user set or needs a missing decision only the human user can make, the response model asks the human user for that decision before the action. The human user's grant changes only the scope it states. The human user's denial suspends that branch of the work. Without an answer, that branch keeps waiting.

When the user set no explicit resource cap, the response model does not treat a limit it invented as user-approved.

The response model keeps the terminal objective separately from the means of investigating or implementing it. It must not narrow a full surface it committed to down to selected examples. When the request covers every member of a set, the acceptance criterion for coverage states the condition that defines the set. Discovery lists the members; that acceptance criterion does not need the members or their count before discovery.

## Declare the contract

The response model writes the contract from the user's established instructions, the supplied context and the facts it observed in sources. It must not guess filenames or invent allowed surfaces. Unknown targets require discovery. Every acceptance criterion describes a requested outcome; incidental methods, examples, artifact counts and verification mechanics become acceptance criteria only when the user or the applicable contract requires them.

Explanations for the reader follow the user's current language. Keep field names in English, including enum values and literal protocol tokens.

```text
[boundary-contract]
- id: <stable-id>
- phase: discovery | execution | verification
- objective: <terminal work objective>
- explicit-non-goals:
  - <non-goal>
- allowed-surface:
  - <allowed read or write surface>
- prohibited-surface:
  - <prohibited path, layer or action>
- locked-decisions:
  - <decision> [source: user-said | interpreted-as | previous-tool | system-doc | unknown]
- acceptance-criteria:
  - <criterion-id>: <verifiable outcome> [source: user-said | interpreted-as | previous-tool | system-doc]
- open-questions:
  - <unresolved question>
- stop-conditions:
  - <condition stopping dependent work>
- next-allowed-actions:
  - <permitted next action>
```

The response model declares `allowed-surface` and `next-allowed-actions` within what the human user's instructions authorize. A declared item is not by itself the human user's grant, and these fields do not show whether an item restates a boundary the human user set or is the response model's self-declared narrower limit. The response model writes `prohibited-surface` and `explicit-non-goals` from the human user's prohibitions or exclusions, the project instructions and its self-declared narrower limits. These fields give an item no source label, so the entry alone does not show who set the boundary or whether the response model may renew it. Where the source is established, name it under Source rules below. The response model includes stop conditions in every contract. Before using an additional surface, it applies Authority and renewal above.

## Phase rules

The phase states what the response model declares it may do now within the work that the human user's instructions authorize. The targets known at that moment determine the phase; the phases are not a planned sequence.

| Phase | Entry condition | Permitted work |
| --- | --- | --- |
| discovery | Target files, modules or verification methods are unknown | Read-only discovery on the named surfaces; no implementation |
| execution | Discovery or supplied evidence establishes the targets | Work on concrete allowed files and directories under the declared acceptance criteria |
| verification | Implementation is ready for checking | Declared commands, screenshots or visual checks; no undeclared implementation |

A phase change keeps the original acceptance criteria. If verification reveals a needed edit, the response model renews the affected execution contract before editing.

## Source rules

The response model assigns a source to each single statement and splits a statement whose parts have different origins.

- `user-said`: the response model assigns this label when the human user directly supplied the instruction or approval. On a decision or acceptance criterion, the label records the response model's claim about that source; it does not prove that the human user supplied it.
- `interpreted-as`: the response model selected a conservative interpretation for the current phase.
- `previous-tool`: a tool or the runtime supplied the fact or control value, including generated text delivered under the user role such as the parent's assignment. A generated approval digest is not the human user's approval.
- `system-doc`: AGENTS.md, a skill or a policy states the requirement.
- `unknown`: the origin is unresolved; the response model cannot use such a statement as a locked decision in the execution phase.

For example, the response model labels “preserve protected.txt as requested” `user-said` when the human user directly supplied that instruction, while “preserve the hook approval-generation value” is `previous-tool`. Arriving in the same message does not give them the same authority.

## Tool checkpoint

While the contract is active, the response model maps every tool call to an item it declared in `allowed-surface` or `next-allowed-actions` before making it. A displayed tool checkpoint names that declared item; the mapping does not itself grant the human user's authorization:

```text
- contract-ref: <contract ID>
- contract-check: <allowed-surface item or next-allowed-action>
```

If the proposed call maps to neither field, the response model does not make that call and applies Authority and renewal.

## Exact protected-file evidence

When the execution contract protects existing files or requires exact modification-time comparison, the response model invokes `scripts/file_guard.py`, resolved relative to this skill, before dependent writes. Read its help only when invocation details are needed.

```text
python3 <loaded-skill-directory>/scripts/file_guard.py capture --path <protected-file> [--path <another-protected-file>]
python3 <loaded-skill-directory>/scripts/file_guard.py check --token <token returned by capture>
```

The helper captures each file's content, exact timestamp, identity and mode without writing task files. The response model retains the returned string token verbatim and passes it through structured arguments or proper shell quoting. It must not decode or rebuild timestamp fields, transmit nanoseconds or large identity integers as JavaScript numbers, or reconstruct lost precision from rounded values.

The response model captures once before the protected operation, checks immediately before a dependent write, and checks afterward when preservation is an acceptance criterion. A failed comparison stops the dependent write; the response model investigates against the original baseline and does not replace that baseline. If the helper is unavailable, the response model performs capture and comparison in one process that keeps exact integers, or with the original integer strings.

The helper observes regular files at one point in time; it is not an atomic lock, and it proves neither authorization nor completion. It rejects symlinks and parent-directory traversal and does not check which files a directory contains. The response model still runs the other checks the contract requires.

## Failure modes and proof

A peripheral check supports only the acceptance criteria it actually measures.

The response model executes the action under the selected procedure and judges the returned evidence against the acceptance criteria. For discretionary checks, reuse of evidence with its source and time, and completion claims, apply `../coding-convention/verification-before-completion/SKILL.md`. Follow the incident workflow in `../coding-convention/systematic-debugging/SKILL.md#incident-accounting-and-continuation` to count failed repair rounds. Renewing a contract does not reset that count and does not require running completed work again.

Files in this skill

  • SKILL.md9.3 KB
  • scripts/file_guard.py5.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.