-
Notifications
You must be signed in to change notification settings - Fork 2
feat(governance): block agent edits to goals/priorities/directives (Layer 1) #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kokevidaurre
wants to merge
2
commits into
main
Choose a base branch
from
feature/governance-guardrail
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Squad governance model | ||
|
|
||
| Squads are autonomous within bounds. Governance files set those bounds — and the founder owns them. | ||
|
|
||
| ## Authority by file | ||
|
|
||
| | File | Owner | Updated by | Frequency | | ||
| |------|-------|-----------|-----------| | ||
| | `directives.md` | Founder + Cofounder | Founder | When strategy shifts | | ||
| | `goals.md` (per squad) | Founder + Cofounder | Founder | Per release / quarter | | ||
| | `priorities.md` (per squad) | Founder + Cofounder | Founder | Weekly review | | ||
| | `SQUAD.md` | Founder | Founder | Rarely (atemporal identity) | | ||
| | `state.md` | Squad agents | Workers + lead | Every run | | ||
| | `learnings/` | Squad agents | Workers | Every run | | ||
| | GitHub issues (tasks) | COO + agents | Anyone | Continuously | | ||
|
|
||
| ## Why the split | ||
|
|
||
| Governance files set the **target**. Memory files capture the **trajectory**. If agents could rewrite both, they'd drift away from the founder's intent run by run — and fast. Letting agents write memory but not governance is the minimum viable separation. | ||
|
|
||
| ## How it's enforced | ||
|
|
||
| The bundled `templates/guardrail.json` includes a PreToolUse hook that blocks `Edit`, `Write`, and `MultiEdit` to: | ||
| - `**/goals.md` | ||
| - `**/priorities.md` | ||
| - `**/directives.md` | ||
| - `**/SQUAD.md` | ||
|
|
||
| When an agent tries to write one of these, the hook exits with code 2 and a message redirecting to `.squads/proposed/`. | ||
|
|
||
| The founder's own Claude Code sessions don't pass through the agent guardrail, so direct edits work normally for governance owners. | ||
|
|
||
| ## How agents propose changes | ||
|
|
||
| Instead of editing the canonical file, agents write to `.squads/proposed/<source-file>-<date>-<slug>.md`. See `.squads/proposed/README.md` for the format. | ||
|
|
||
| The founder reviews proposals on a cadence (weekly, or per release) and merges accepted ones into the canonical files. | ||
|
|
||
| ## Coherence checks | ||
|
|
||
| Run `squads coherence` (coming in the next release) to surface drift: | ||
| - Are squad goals aligned with `directives.md`? | ||
| - Are priorities grounded in goals? | ||
| - Are governance files stale (>14 days)? | ||
| - Are there pending proposals awaiting founder review? | ||
|
|
||
| ## Override | ||
|
|
||
| In emergencies (security incident, broken release) the founder can edit governance files without going through proposals. There's no audit trail beyond git history — keep that as the source of truth. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Proposed governance changes | ||
|
|
||
| Agents cannot edit governance files directly (`goals.md`, `priorities.md`, `directives.md`, `SQUAD.md`). The PreToolUse guardrail blocks those writes. | ||
|
|
||
| When an agent believes a governance file should change, it writes a proposal here instead. | ||
|
|
||
| ## Naming convention | ||
|
|
||
| ``` | ||
| .squads/proposed/<source-file>-<YYYYMMDD>-<short-slug>.md | ||
| ``` | ||
|
|
||
| Examples: | ||
| - `goals-engineering-20260425-add-cross-platform.md` | ||
| - `priorities-marketing-20260425-deprioritize-outbound.md` | ||
| - `directives-20260425-shift-to-inbound-only.md` | ||
|
|
||
| ## Proposal format | ||
|
|
||
| ```markdown | ||
| # Proposal: <one-line summary> | ||
|
|
||
| **Target file:** `.agents/memory/<squad>/goals.md` | ||
| **Source agent:** `<squad>/<agent>` | ||
| **Reason:** <why this change is needed — link to data, executions, learnings> | ||
|
|
||
| ## Proposed change | ||
| <exact diff or new content> | ||
|
|
||
| ## Impact | ||
| <what this changes about the squad's behaviour> | ||
|
|
||
| ## Founder decision | ||
| - [ ] Accepted — merged to canonical file on YYYY-MM-DD | ||
| - [ ] Rejected — reason: ... | ||
| - [ ] Deferred — revisit on YYYY-MM-DD | ||
| ``` | ||
|
|
||
| ## Founder workflow | ||
|
|
||
| Weekly (or per-release), the founder reviews proposals: | ||
|
|
||
| ```bash | ||
| ls .squads/proposed/ # see what's queued | ||
| squads coherence # check for drift before deciding | ||
| # review each proposal, decide | ||
| # accepted: merge into canonical file, then move proposal to .squads/proposed/accepted/ | ||
| # rejected: move to .squads/proposed/rejected/ with reason in the file | ||
| ``` | ||
|
|
||
| The proposal channel is a **defer**, not a **block** — agents keep contributing ideas, the founder keeps governance authority. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guardrail implementation has several technical issues that could lead to bypasses or poor user experience:
*/goals.md) only match files in subdirectories. Governance files located in the root directory (e.g.,goals.md,SQUAD.md) will not be blocked, which contradicts the documentation indocs/governance.mdimplying**/coverage.file_path, but many agent tools (including standard Claude Code tools) use the keypath. This would cause the guardrail to miss the target file entirely.MultiEdittool typically operates on a list of files. This one-liner only checks a single top-level field, allowing governance files to be modified if they are part of a batch edit.goals.md-YYYYMMDD.md, whereas the convention intemplates/proposed/README.mduses a slug and avoids double extensions (e.g.,goals-YYYYMMDD-slug.md).