@sockulags/agent-os 0.9.0 → 0.11.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/README.md +65 -41
- package/cli/index.mjs +735 -412
- package/cli/index.test.mjs +300 -142
- package/package.json +32 -31
- package/policy.md +6 -6
- package/skills/batch-work/SKILL.md +43 -0
- package/skills/batch-work/agents/openai.yaml +2 -0
- package/skills/batch-work/references/manifest.md +100 -0
- package/skills/batch-work/scripts/manifest-hash.mjs +263 -0
- package/skills/batch-work/scripts/test-manifest-hash.mjs +132 -0
- package/skills/chart-work/SKILL.md +37 -0
- package/skills/chart-work/agents/openai.yaml +2 -0
- package/skills/chart-work/references/elicitation.md +25 -0
- package/skills/chart-work/references/map.md +84 -0
- package/skills/chart-work/references/prototypes.md +21 -0
- package/skills/deliver-work/SKILL.md +12 -0
- package/skills/deliver-work/agents/openai.yaml +2 -0
- package/skills/deliver-work/workflow.md +113 -0
- package/skills/diagnose-before-fix/SKILL.md +24 -0
- package/skills/dispatch-next/SKILL.md +28 -0
- package/skills/dispatch-next/agents/openai.yaml +2 -0
- package/skills/explain-work/SKILL.md +27 -0
- package/skills/explain-work/agents/openai.yaml +2 -0
- package/skills/guide-me/SKILL.md +36 -0
- package/skills/guide-me/agents/openai.yaml +2 -0
- package/skills/init-agent-os/SKILL.md +39 -0
- package/skills/init-agent-os/agents/openai.yaml +2 -0
- package/skills/init-agent-os/scripts/policy-block.ps1 +87 -87
- package/skills/list-skills/SKILL.md +42 -0
- package/skills/list-skills/agents/openai.yaml +2 -0
- package/skills/notice-lesson/SKILL.md +20 -0
- package/skills/proportional-testing/SKILL.md +30 -0
- package/skills/proportional-testing/references/strategy.md +75 -0
- package/skills/record-lesson/SKILL.md +31 -0
- package/skills/record-lesson/agents/openai.yaml +2 -0
- package/skills/scope-guard/SKILL.md +21 -0
- package/skills/shape-work/SKILL.md +39 -0
- package/skills/shape-work/agents/openai.yaml +2 -0
- package/skills/shape-work/references/implementation-issues.md +69 -0
- package/skills/shape-work/references/mockups.md +23 -0
- package/skills/simplifier/SKILL.md +34 -0
- package/skills/simplifier/agents/openai.yaml +2 -0
- package/skills/simplifier-audit/SKILL.md +28 -0
- package/skills/simplifier-audit/agents/openai.yaml +2 -0
- package/skills/simplifier-review/SKILL.md +29 -0
- package/skills/understand-work/SKILL.md +31 -0
- package/skills/understand-work/agents/openai.yaml +2 -0
- package/skills/verify-before-done/SKILL.md +29 -0
- package/skills/writing-skills/SKILL.md +68 -0
- package/skills/writing-skills/agents/openai.yaml +2 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Delivery contract
|
|
2
|
+
|
|
3
|
+
## Establish the contract
|
|
4
|
+
|
|
5
|
+
Read the request, repository policy, relevant code, and working-tree state. Preserve existing work.
|
|
6
|
+
Resolve discoverable facts yourself. Before editing, know:
|
|
7
|
+
|
|
8
|
+
- **Outcome:** the observable change requested.
|
|
9
|
+
- **Boundaries:** explicit non-goals and the smallest plausible change surface.
|
|
10
|
+
- **Ground truth:** tests or observations that can prove the outcome.
|
|
11
|
+
- **Delivery target:** local changes, commit, pull request, merge, or deployment as requested.
|
|
12
|
+
|
|
13
|
+
An implementation request authorizes in-scope repository edits. Ask one focused question only when
|
|
14
|
+
an unresolved product decision has materially different outcomes. Reversible implementation choices
|
|
15
|
+
belong to the implementer.
|
|
16
|
+
|
|
17
|
+
## Confirm one delivery unit
|
|
18
|
+
|
|
19
|
+
Before editing, verify that the target is one coherent implementation issue or an equivalently
|
|
20
|
+
bounded direct request: one observable outcome, one reviewable change boundary, explicit ground
|
|
21
|
+
truth, and satisfied dependencies. If the target contains several separately closable outcomes,
|
|
22
|
+
different delivery targets, or unresolved product choices, stop before mutation and return it for
|
|
23
|
+
shaping into implementation-ready issues. Do not choose `batch-work`; execution strategy belongs to
|
|
24
|
+
the developer.
|
|
25
|
+
|
|
26
|
+
## Work loop
|
|
27
|
+
|
|
28
|
+
1. Inspect enough of the affected system to choose a coherent change.
|
|
29
|
+
2. Classify the review gate before editing. If review is required, confirm the current tool list
|
|
30
|
+
contains a real reviewer launch tool before mutation. Re-evaluate the gate against the completed
|
|
31
|
+
diff.
|
|
32
|
+
3. Make the smallest complete implementation. Use `diagnose-before-fix` when the cause is unknown and
|
|
33
|
+
`scope-guard` when discoveries threaten the boundary.
|
|
34
|
+
4. Apply [`proportional-testing`](../proportional-testing/SKILL.md) when selecting or creating tests.
|
|
35
|
+
Run fast, relevant checks while working and adapt from their results.
|
|
36
|
+
5. Review the resulting diff for correctness, unnecessary complexity, and scope. Apply the
|
|
37
|
+
[`simplifier-review`](../simplifier-review/SKILL.md) lens and fix supported simplification
|
|
38
|
+
findings before freezing the candidate.
|
|
39
|
+
6. Complete the review gate below.
|
|
40
|
+
7. Apply `verify-before-done` to the final candidate and deliver only to the requested boundary.
|
|
41
|
+
|
|
42
|
+
Ground truth governs the loop; no prescribed implementation sequence substitutes for it.
|
|
43
|
+
|
|
44
|
+
## Review gate
|
|
45
|
+
|
|
46
|
+
Independent review is required unless the final candidate is a small fix and all of these are true:
|
|
47
|
+
|
|
48
|
+
- it corrects one localized defect with a supported cause and adds no capability;
|
|
49
|
+
- it changes no public API, schema, protocol, or compatibility boundary;
|
|
50
|
+
- it touches no security, authentication, authorization, credentials, secrets, tokens, billing,
|
|
51
|
+
external writes, destructive data change, migration, or concurrency behavior;
|
|
52
|
+
- direct regression evidence covers the changed behavior.
|
|
53
|
+
|
|
54
|
+
A developer or project policy may require review for any change. Only an explicit instruction may
|
|
55
|
+
waive required review; do not solicit a waiver. When review is required:
|
|
56
|
+
|
|
57
|
+
1. Before editing, verify that the current session exposes `spawn_agent` or an equivalent reviewer
|
|
58
|
+
launch tool. A wait tool alone is not a launch mechanism. If no launch tool exists, stop before
|
|
59
|
+
mutation with a review-required handoff.
|
|
60
|
+
2. Freeze the candidate. Identify it by commit when available, otherwise by the current diff and
|
|
61
|
+
changed-file set.
|
|
62
|
+
3. Launch at least one read-only reviewer in a context that has not inherited the implementation
|
|
63
|
+
conversation. On Codex, the next review tool action after freezing the candidate must be
|
|
64
|
+
`spawn_agent`; copy its returned ID, then call `wait_agent` with that ID. If `spawn_agent` is not
|
|
65
|
+
callable or returns no ID, stop without calling a wait tool. Never call a wait tool with empty
|
|
66
|
+
receiver IDs or construct a `/root/...` reviewer label yourself. Use the host's equivalent launch
|
|
67
|
+
receipt elsewhere. Give the reviewer the outcome, boundaries, ground truth, candidate diff, and
|
|
68
|
+
verification evidence — not the implementer's reasoning.
|
|
69
|
+
4. Use one general adversarial reviewer by default. Add a focused security or compatibility reviewer
|
|
70
|
+
only when a distinct risk needs that lens; do not create a panel by default.
|
|
71
|
+
5. Accept review only when that launched identity returns a result. Record the reviewer identity and
|
|
72
|
+
role, candidate identity, reviewed scope, findings, and disposition. This is completion evidence,
|
|
73
|
+
not an approval ledger.
|
|
74
|
+
6. Fix supported in-scope findings. If the candidate changes, run targeted re-review before final
|
|
75
|
+
verification.
|
|
76
|
+
|
|
77
|
+
A reviewer label written by the implementer, a wait call with no launched receiver, a self-review,
|
|
78
|
+
or an unreturned reviewer is not independent review. If the host exposes no launch tool, launch
|
|
79
|
+
fails, or no launched reviewer returns a result, stop before delivery with a review handoff
|
|
80
|
+
containing the frozen candidate, review scope including unnecessary solution complexity, and
|
|
81
|
+
required ground truth. Self-review never
|
|
82
|
+
substitutes for required independent review.
|
|
83
|
+
|
|
84
|
+
## Resume only when useful
|
|
85
|
+
|
|
86
|
+
Ordinary work needs no workflow record. For work expected to span sessions, keep a compact
|
|
87
|
+
`.agent-os/work/<slug>.md`:
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
---
|
|
91
|
+
agent_os_work: 2
|
|
92
|
+
title: <work title>
|
|
93
|
+
status: active
|
|
94
|
+
next_action: <concrete continuation>
|
|
95
|
+
---
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Record only Outcome, Boundaries, Ground truth, Decisions, and Evidence. Use `blocked`, `verified`, or
|
|
99
|
+
`delivered` when those words help the next session resume accurately. The record is working memory,
|
|
100
|
+
not an approval ledger.
|
|
101
|
+
|
|
102
|
+
## Batch workers
|
|
103
|
+
|
|
104
|
+
A batch task definition supplies the outcome, scope, dependencies, and checks. Work only in the
|
|
105
|
+
assigned task workspace, commit there, and return the head SHA, changed files, checks, and remaining
|
|
106
|
+
uncertainty to the coordinator. The coordinator owns integration, aggregate review, and aggregate
|
|
107
|
+
verification.
|
|
108
|
+
|
|
109
|
+
## Stop conditions
|
|
110
|
+
|
|
111
|
+
Stop with the exact decision or external action needed when the request does not cover it. Stop a
|
|
112
|
+
completion claim when ground truth fails or cannot be exercised. Otherwise continue until the
|
|
113
|
+
requested delivery target is reached.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose-before-fix
|
|
3
|
+
description: Finds the root cause of reproducible technical failures before code is changed. It activates when investigating a bug, regression, failing test, crash, or unexpected behavior whose cause is not yet established, before proposing or applying a fix. It skips known-cause mechanical edits, feature implementation, general review, and post-fix verification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose before fix
|
|
7
|
+
|
|
8
|
+
Find the smallest supported explanation that accounts for the failure and predicts a useful check.
|
|
9
|
+
|
|
10
|
+
## Contract
|
|
11
|
+
|
|
12
|
+
- **Ground truth:** the narrowest reliable reproduction or observed failure.
|
|
13
|
+
- **Working surface:** tests, diagnostics, logs, and instrumentation inside the task scope.
|
|
14
|
+
- **Boundary:** do not commit a production fix whose causal story is still guesswork.
|
|
15
|
+
|
|
16
|
+
## Loop
|
|
17
|
+
|
|
18
|
+
Reproduce, reduce, trace the nearest seam, and compare plausible causes with high-information checks.
|
|
19
|
+
Use temporary instrumentation when it helps. Once evidence supports a cause, implement the smallest
|
|
20
|
+
fix and add a regression check when practical. Re-run the original failing path.
|
|
21
|
+
|
|
22
|
+
If the failure cannot be reproduced or competing explanations cannot be distinguished, report the
|
|
23
|
+
bounded uncertainty and the next discriminating check. Do not turn a plausible hypothesis into a
|
|
24
|
+
confirmed diagnosis.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dispatch-next
|
|
3
|
+
description: Reads live project state and selects one decision-ready next action. User-invoked for queue triage or dispatch. Not for an already selected task.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# dispatch-next
|
|
8
|
+
|
|
9
|
+
Choose one next action from live state. The wording of the request decides whether to report the
|
|
10
|
+
choice or dispatch it.
|
|
11
|
+
|
|
12
|
+
## Loop
|
|
13
|
+
|
|
14
|
+
Read project policy, queue conventions, issues, pull requests, and CI. Prioritize work already in
|
|
15
|
+
flight when it has an actionable review or failure. Select one target using the repository's
|
|
16
|
+
priority rules and explain why it wins.
|
|
17
|
+
|
|
18
|
+
Route broad decision work to `chart-work`, a bounded open decision to `shape-work`, and one selected
|
|
19
|
+
implementation-ready issue to `deliver-work`. Route to `batch-work` only when the developer
|
|
20
|
+
explicitly asks to execute an existing ready issue graph as an integrated batch; issue count alone
|
|
21
|
+
does not choose the workflow.
|
|
22
|
+
|
|
23
|
+
“What should I do next?” is a read-only selection request. “Dispatch the next task” authorizes the
|
|
24
|
+
project-state changes and one launch needed to dispatch the selected target. Do not infer merge,
|
|
25
|
+
closure, or unrelated tracker authority from dispatch.
|
|
26
|
+
|
|
27
|
+
If nothing is decision-ready, report the closest blocker. One invocation selects at most one target;
|
|
28
|
+
the worker or coordinator does the work.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explain-work
|
|
3
|
+
description: Explains the current task or plan in plain language with no technical vocabulary, so the developer can judge it beyond the jargon. User-invoked directly or as the closing gate of guide-me. Not a substitute for technical review or verification.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Explain work
|
|
8
|
+
|
|
9
|
+
Say what the work solves as if the reader knows no technical terms — then let the developer judge
|
|
10
|
+
it.
|
|
11
|
+
|
|
12
|
+
## The summary
|
|
13
|
+
|
|
14
|
+
Cover, in everyday language: the problem it solves, who feels that problem, what changes in their
|
|
15
|
+
day when it works, and what it deliberately will not do. No technical vocabulary at all — if the
|
|
16
|
+
summary cannot stand without a technical term, the understanding is not finished; go back and
|
|
17
|
+
understand before explaining. Keep it short enough to read in under a minute: a TLDR, not a report.
|
|
18
|
+
|
|
19
|
+
## The gate
|
|
20
|
+
|
|
21
|
+
Present the summary and ask the developer to approve or challenge it. A challenge means the
|
|
22
|
+
understanding was wrong somewhere: name what was misunderstood and reopen the questioning or the
|
|
23
|
+
plan at that point rather than defending the summary. Under guide-me, approval closes the gate and
|
|
24
|
+
the summary becomes the `## TLDR` at the top of the receiving planning artifact.
|
|
25
|
+
|
|
26
|
+
Standalone, explain-work can run against any plan, diff, or pull request; the deliverable is the
|
|
27
|
+
plain-language summary itself and the developer's verdict on it.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: guide-me
|
|
3
|
+
description: Guides the developer from a vague desire to work they did not know they wanted, through questioning and a plain-language gate, then continues into chart-work or shape-work. User-invoked when the developer cannot yet state what they want. Not for bounded choices, mapped decision work, or implementation-ready requests.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Guide me
|
|
8
|
+
|
|
9
|
+
Take a developer who cannot yet state what they want to an approved goal and into the right
|
|
10
|
+
planning workflow. Guide-me writes no product code and no implementation issues.
|
|
11
|
+
|
|
12
|
+
## Understand
|
|
13
|
+
|
|
14
|
+
Run the questioning loop in [understand-work](../understand-work/SKILL.md) until the goal stops
|
|
15
|
+
moving or the developer says it is done.
|
|
16
|
+
|
|
17
|
+
## Explain
|
|
18
|
+
|
|
19
|
+
Run the plain-language gate in [explain-work](../explain-work/SKILL.md) on the settled
|
|
20
|
+
understanding. A challenge reopens understand-work at the misunderstood point. Do not continue
|
|
21
|
+
without an approved summary.
|
|
22
|
+
|
|
23
|
+
## Continue
|
|
24
|
+
|
|
25
|
+
The approved summary decides the route:
|
|
26
|
+
|
|
27
|
+
- several independent decision threads → continue into `chart-work`;
|
|
28
|
+
- one bounded idea with material product choices left → continue into `shape-work`;
|
|
29
|
+
- something already small and clear → hand the developer a ready-to-send direct request instead of
|
|
30
|
+
a workflow.
|
|
31
|
+
|
|
32
|
+
The developer's approval at the gate is the opt-in for this continuation. Announce the route, then
|
|
33
|
+
proceed with the approved summary and the settled understanding as the handoff. Place the approved
|
|
34
|
+
summary as a `## TLDR` at the top of the artifact the next workflow creates, so the map or shape
|
|
35
|
+
opens with what the work solves in plain language. Ruled-out directions and open questions travel
|
|
36
|
+
with the handoff; nothing already answered is asked again.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-agent-os
|
|
3
|
+
description: Sets up agent-os globally on a machine, or initializes a repo's living project policy through an interview. User-invoked only, at machine setup or when onboarding a repo. Not for ordinary tasks.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# init-agent-os
|
|
8
|
+
|
|
9
|
+
The invocation authorizes setup writes for the named target. Use one mode per run.
|
|
10
|
+
|
|
11
|
+
## Mode: `global` (once per machine)
|
|
12
|
+
|
|
13
|
+
Invoked as `init-agent-os global`.
|
|
14
|
+
|
|
15
|
+
1. Verify the plugin is visible on this platform (skills listed under the `agent-os` namespace). Report what you find.
|
|
16
|
+
2. Run `scripts/policy-block.ps1 -Check` and report drift between `policy.md` and the managed blocks in `~/.claude/CLAUDE.md` and `~/.codex/AGENTS.md`.
|
|
17
|
+
3. Run `scripts/policy-block.ps1` to apply the managed blocks and show the resulting diff. This
|
|
18
|
+
deterministic writer shares its marker contract with the npm installer's policy writer.
|
|
19
|
+
|
|
20
|
+
## Mode: repo init (default)
|
|
21
|
+
|
|
22
|
+
Invoked in a repo working directory.
|
|
23
|
+
|
|
24
|
+
1. Read the repo first: existing `CLAUDE.md`/`AGENTS.md`, README, package/build files, CI config. Do not ask about anything the repo already answers.
|
|
25
|
+
2. Ask only about material facts the repository does not answer, with a recommendation:
|
|
26
|
+
- **Delivery defaults** — branch, PR, merge, and deploy conventions.
|
|
27
|
+
- **Verify commands** — the exact commands that prove the project works (test, build, lint, run).
|
|
28
|
+
- **Design system** — where tokens and components live.
|
|
29
|
+
- **Planning surface** — tracker or local folders, decision-ticket conventions, and
|
|
30
|
+
implementation-issue readiness states or labels.
|
|
31
|
+
- **Batch execution** — concurrency, worktree naming, retries, and integration strategy.
|
|
32
|
+
- **Conventions and gotchas** worth recording now.
|
|
33
|
+
3. Write the smallest useful policy section to the repo's existing instruction file, or a new
|
|
34
|
+
`policy.md` when none exists, and show the resulting diff.
|
|
35
|
+
|
|
36
|
+
Block handling remains deterministic: add one missing block, update only well-formed managed content,
|
|
37
|
+
and stop on duplicate or malformed markers. Global mode touches no repository files; repo mode
|
|
38
|
+
touches one repository. The direct request or recorded delivery defaults govern merge and deploy
|
|
39
|
+
actions.
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# Manages the AGENT OS block in global instruction files.
|
|
2
|
-
# Source of truth: policy.md at the plugin root (two levels up from this script).
|
|
3
|
-
#
|
|
4
|
-
# Semantics (locked in the agent-os plan, M3):
|
|
5
|
-
# - No block in target -> append exactly one block, preserve everything else.
|
|
6
|
-
# - Empty target file -> treated as "no block"; the block becomes the whole file.
|
|
7
|
-
# - Exactly one well-formed -> replace only the content between the markers.
|
|
8
|
-
# - Duplicated, crossed, or half-open markers -> abort without mutation, exit 2.
|
|
9
|
-
# - -Check -> read-only; exit 0 in sync, exit 1 on drift/missing, never writes.
|
|
10
|
-
# - Text outside the block is never touched or normalized.
|
|
11
|
-
|
|
12
|
-
[CmdletBinding()]
|
|
13
|
-
param(
|
|
14
|
-
[switch]$Check,
|
|
15
|
-
[string[]]$Targets = @(
|
|
16
|
-
(Join-Path (Join-Path $HOME '.claude') 'CLAUDE.md'),
|
|
17
|
-
(Join-Path (Join-Path $HOME '.codex') 'AGENTS.md')
|
|
18
|
-
)
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
$ErrorActionPreference = 'Stop'
|
|
22
|
-
$BeginMarker = '<!-- BEGIN AGENT OS -->'
|
|
23
|
-
$EndMarker = '<!-- END AGENT OS -->'
|
|
24
|
-
|
|
25
|
-
$policyPath = Join-Path $PSScriptRoot '..\..\..\policy.md' | Resolve-Path
|
|
26
|
-
$policy = (Get-Content -Raw -Path $policyPath).TrimEnd()
|
|
27
|
-
$block = "$BeginMarker`n$policy`n$EndMarker"
|
|
28
|
-
|
|
29
|
-
$exit = 0
|
|
30
|
-
|
|
31
|
-
foreach ($target in $Targets) {
|
|
32
|
-
$label = $target
|
|
33
|
-
if (-not (Test-Path $target)) {
|
|
34
|
-
if ($Check) {
|
|
35
|
-
Write-Output "DRIFT $label : file missing"
|
|
36
|
-
$exit = 1
|
|
37
|
-
} else {
|
|
38
|
-
$dir = Split-Path $target
|
|
39
|
-
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Force -Path $dir | Out-Null }
|
|
40
|
-
Set-Content -NoNewline -Path $target -Value ($block + "`n")
|
|
41
|
-
Write-Output "ADDED $label : created file with managed block"
|
|
42
|
-
}
|
|
43
|
-
continue
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# An empty file returns $null from -Raw, which would throw in Matches below.
|
|
47
|
-
$content = Get-Content -Raw -Path $target
|
|
48
|
-
if ($null -eq $content) { $content = '' }
|
|
49
|
-
$beginCount = ([regex]::Matches($content, [regex]::Escape($BeginMarker))).Count
|
|
50
|
-
$endCount = ([regex]::Matches($content, [regex]::Escape($EndMarker))).Count
|
|
51
|
-
|
|
52
|
-
if ($beginCount -eq 0 -and $endCount -eq 0) {
|
|
53
|
-
if ($Check) {
|
|
54
|
-
Write-Output "DRIFT $label : managed block missing"
|
|
55
|
-
$exit = 1
|
|
56
|
-
} else {
|
|
57
|
-
$sep = if ($content.Length -eq 0) { '' } elseif ($content.EndsWith("`n")) { "`n" } else { "`n`n" }
|
|
58
|
-
Set-Content -NoNewline -Path $target -Value ($content + $sep + $block + "`n")
|
|
59
|
-
Write-Output "ADDED $label : appended managed block"
|
|
60
|
-
}
|
|
61
|
-
continue
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
$wellFormed = ($beginCount -eq 1 -and $endCount -eq 1 -and
|
|
65
|
-
$content.IndexOf($BeginMarker) -lt $content.IndexOf($EndMarker))
|
|
66
|
-
if (-not $wellFormed) {
|
|
67
|
-
Write-Output "ERROR $label : malformed markers (begin=$beginCount end=$endCount) - no mutation"
|
|
68
|
-
exit 2
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
$start = $content.IndexOf($BeginMarker)
|
|
72
|
-
$end = $content.IndexOf($EndMarker) + $EndMarker.Length
|
|
73
|
-
$current = $content.Substring($start, $end - $start)
|
|
74
|
-
|
|
75
|
-
if ($current -eq $block) {
|
|
76
|
-
Write-Output "OK $label : in sync"
|
|
77
|
-
} elseif ($Check) {
|
|
78
|
-
Write-Output "DRIFT $label : block differs from policy.md"
|
|
79
|
-
$exit = 1
|
|
80
|
-
} else {
|
|
81
|
-
$updated = $content.Substring(0, $start) + $block + $content.Substring($end)
|
|
82
|
-
Set-Content -NoNewline -Path $target -Value $updated
|
|
83
|
-
Write-Output "UPDATED $label : block replaced from policy.md"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exit $exit
|
|
1
|
+
# Manages the AGENT OS block in global instruction files.
|
|
2
|
+
# Source of truth: policy.md at the plugin root (two levels up from this script).
|
|
3
|
+
#
|
|
4
|
+
# Semantics (locked in the agent-os plan, M3):
|
|
5
|
+
# - No block in target -> append exactly one block, preserve everything else.
|
|
6
|
+
# - Empty target file -> treated as "no block"; the block becomes the whole file.
|
|
7
|
+
# - Exactly one well-formed -> replace only the content between the markers.
|
|
8
|
+
# - Duplicated, crossed, or half-open markers -> abort without mutation, exit 2.
|
|
9
|
+
# - -Check -> read-only; exit 0 in sync, exit 1 on drift/missing, never writes.
|
|
10
|
+
# - Text outside the block is never touched or normalized.
|
|
11
|
+
|
|
12
|
+
[CmdletBinding()]
|
|
13
|
+
param(
|
|
14
|
+
[switch]$Check,
|
|
15
|
+
[string[]]$Targets = @(
|
|
16
|
+
(Join-Path (Join-Path $HOME '.claude') 'CLAUDE.md'),
|
|
17
|
+
(Join-Path (Join-Path $HOME '.codex') 'AGENTS.md')
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
$ErrorActionPreference = 'Stop'
|
|
22
|
+
$BeginMarker = '<!-- BEGIN AGENT OS -->'
|
|
23
|
+
$EndMarker = '<!-- END AGENT OS -->'
|
|
24
|
+
|
|
25
|
+
$policyPath = Join-Path $PSScriptRoot '..\..\..\policy.md' | Resolve-Path
|
|
26
|
+
$policy = (Get-Content -Raw -Path $policyPath).TrimEnd()
|
|
27
|
+
$block = "$BeginMarker`n$policy`n$EndMarker"
|
|
28
|
+
|
|
29
|
+
$exit = 0
|
|
30
|
+
|
|
31
|
+
foreach ($target in $Targets) {
|
|
32
|
+
$label = $target
|
|
33
|
+
if (-not (Test-Path $target)) {
|
|
34
|
+
if ($Check) {
|
|
35
|
+
Write-Output "DRIFT $label : file missing"
|
|
36
|
+
$exit = 1
|
|
37
|
+
} else {
|
|
38
|
+
$dir = Split-Path $target
|
|
39
|
+
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Force -Path $dir | Out-Null }
|
|
40
|
+
Set-Content -NoNewline -Path $target -Value ($block + "`n")
|
|
41
|
+
Write-Output "ADDED $label : created file with managed block"
|
|
42
|
+
}
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# An empty file returns $null from -Raw, which would throw in Matches below.
|
|
47
|
+
$content = Get-Content -Raw -Path $target
|
|
48
|
+
if ($null -eq $content) { $content = '' }
|
|
49
|
+
$beginCount = ([regex]::Matches($content, [regex]::Escape($BeginMarker))).Count
|
|
50
|
+
$endCount = ([regex]::Matches($content, [regex]::Escape($EndMarker))).Count
|
|
51
|
+
|
|
52
|
+
if ($beginCount -eq 0 -and $endCount -eq 0) {
|
|
53
|
+
if ($Check) {
|
|
54
|
+
Write-Output "DRIFT $label : managed block missing"
|
|
55
|
+
$exit = 1
|
|
56
|
+
} else {
|
|
57
|
+
$sep = if ($content.Length -eq 0) { '' } elseif ($content.EndsWith("`n")) { "`n" } else { "`n`n" }
|
|
58
|
+
Set-Content -NoNewline -Path $target -Value ($content + $sep + $block + "`n")
|
|
59
|
+
Write-Output "ADDED $label : appended managed block"
|
|
60
|
+
}
|
|
61
|
+
continue
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
$wellFormed = ($beginCount -eq 1 -and $endCount -eq 1 -and
|
|
65
|
+
$content.IndexOf($BeginMarker) -lt $content.IndexOf($EndMarker))
|
|
66
|
+
if (-not $wellFormed) {
|
|
67
|
+
Write-Output "ERROR $label : malformed markers (begin=$beginCount end=$endCount) - no mutation"
|
|
68
|
+
exit 2
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
$start = $content.IndexOf($BeginMarker)
|
|
72
|
+
$end = $content.IndexOf($EndMarker) + $EndMarker.Length
|
|
73
|
+
$current = $content.Substring($start, $end - $start)
|
|
74
|
+
|
|
75
|
+
if ($current -eq $block) {
|
|
76
|
+
Write-Output "OK $label : in sync"
|
|
77
|
+
} elseif ($Check) {
|
|
78
|
+
Write-Output "DRIFT $label : block differs from policy.md"
|
|
79
|
+
$exit = 1
|
|
80
|
+
} else {
|
|
81
|
+
$updated = $content.Substring(0, $start) + $block + $content.Substring($end)
|
|
82
|
+
Set-Content -NoNewline -Path $target -Value $updated
|
|
83
|
+
Write-Output "UPDATED $label : block replaced from policy.md"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exit $exit
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: list-skills
|
|
3
|
+
description: Lists the installed agent-os skills with their invocation syntax and purpose so the developer can see what is available and pick the right one. Use manually when the developer asks what agent-os can do, which skill fits, or for a skill list, overview, or reference card. Not for running any listed skill, choosing or dispatching the next action in planned work, or explaining work already underway.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# List skills
|
|
8
|
+
|
|
9
|
+
Answer what this installation offers and how to reach it. The skill returns one reference card and
|
|
10
|
+
changes nothing.
|
|
11
|
+
|
|
12
|
+
## Read the installation, never a remembered list
|
|
13
|
+
|
|
14
|
+
Take every skill from the sibling directories beside this one, using each `SKILL.md` frontmatter for
|
|
15
|
+
its name and description. A reference card recited from memory goes stale the moment a skill is
|
|
16
|
+
added, removed, or partially installed, and it hides exactly the drift a developer opens the card to
|
|
17
|
+
find. Report a directory whose frontmatter is missing or unreadable as unavailable rather than
|
|
18
|
+
omitting it.
|
|
19
|
+
|
|
20
|
+
Each skill's own frontmatter also carries its invocation: `disable-model-invocation: true` plus
|
|
21
|
+
`agents/openai.yaml` means the developer invokes it explicitly; neither switch means it is automatic
|
|
22
|
+
and needs no invocation.
|
|
23
|
+
|
|
24
|
+
## Report
|
|
25
|
+
|
|
26
|
+
Group by invocation, explicit skills first, and give each one line: how to invoke it and what it
|
|
27
|
+
does, condensed from its description rather than copied whole. Show the invocation form matching how
|
|
28
|
+
this skill was itself reached — `/agent-os:<name>` through the Claude plugin, `/<name>` for a direct
|
|
29
|
+
Claude install, `$<name>` on Codex — and name which form is shown, since the same skill set is typed
|
|
30
|
+
differently per host.
|
|
31
|
+
|
|
32
|
+
Close with the entry points for a developer who has not named a skill: an unclear desire starts at
|
|
33
|
+
`guide-me`, bounded choices at `shape-work`, broad or coupled work at `chart-work`, and a
|
|
34
|
+
decision-complete unit at `deliver-work`. Say plainly that automatic skills need no entry point
|
|
35
|
+
instead of listing them as choices.
|
|
36
|
+
|
|
37
|
+
## Boundaries
|
|
38
|
+
|
|
39
|
+
One card, then stop. Do not invoke, stage, or offer to run a listed skill, and write no file, state,
|
|
40
|
+
or default. Listing what exists is not choosing what to do next: a developer who wants the next
|
|
41
|
+
action picked or dispatched wants `dispatch-next`, and one who wants the current task described
|
|
42
|
+
wants `explain-work`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: notice-lesson
|
|
3
|
+
description: Treats a developer interruption, correction, or challenge as a misunderstanding signal worth examining. It activates when the developer stops the agent, contradicts its direction, or questions its output mid-task. It skips ordinary clarifying questions, requested iteration rounds, and disagreements the developer resolves in the same breath.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Notice lesson
|
|
7
|
+
|
|
8
|
+
An interruption is information: the agent's model of the task and the developer's intent just
|
|
9
|
+
diverged.
|
|
10
|
+
|
|
11
|
+
When it happens, name the divergence in one sentence — what was assumed, what was actually wanted —
|
|
12
|
+
and correct course first. Then judge whether the divergence is durable: would the next session, or
|
|
13
|
+
an agent in a repository that has never seen this conversation, make the same mistake?
|
|
14
|
+
|
|
15
|
+
- A one-off — missing context, an ambiguous word, a changed mind — needs no record; continue.
|
|
16
|
+
- A durable lesson — a convention, a preference, a gotcha that will recur — deserves recording.
|
|
17
|
+
Offer `record-lesson` with the candidate lesson already phrased.
|
|
18
|
+
|
|
19
|
+
Noticing never argues with the correction and never edits policy itself; recording is the
|
|
20
|
+
developer's call through `record-lesson`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: proportional-testing
|
|
3
|
+
description: Selects the smallest meaningful test surface when code is implemented or modified. It activates before adding or expanding tests, and when choosing affected test execution for a change or bug fix. It skips test-status reporting, diagnosis of an already failing test, and repository-wide test-strategy design requested as its own deliverable.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test proportionally
|
|
7
|
+
|
|
8
|
+
Read [references/strategy.md](references/strategy.md) before creating or expanding tests.
|
|
9
|
+
|
|
10
|
+
Protect the changed behavior and plausible regressions without optimizing for test count or coverage.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
Before adding a test:
|
|
15
|
+
|
|
16
|
+
1. Identify the observable behavior changed and its plausible blast radius.
|
|
17
|
+
2. Search existing tests for that behavior and affected contracts.
|
|
18
|
+
3. Name the realistic regression the proposed test would catch that existing coverage would not.
|
|
19
|
+
4. If that regression is unclear, do not add the test.
|
|
20
|
+
5. Otherwise extend existing or table-driven coverage when practical, using the cheapest test level
|
|
21
|
+
that proves the behavior.
|
|
22
|
+
|
|
23
|
+
For a confirmed bug, establish one reproducing regression check when practical, prove it fails for
|
|
24
|
+
the expected reason, fix it, then run that check and relevant affected tests. Expand execution only
|
|
25
|
+
when the blast radius is uncertain, shared infrastructure changed, or project policy requires a
|
|
26
|
+
broader gate.
|
|
27
|
+
|
|
28
|
+
Do not create a test for every function, branch, file, or generated code path. Prefer observable
|
|
29
|
+
contracts over call sequences and private structure. This discipline controls test creation and
|
|
30
|
+
development-time selection; it never removes required repository or CI checks at delivery.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Proportional testing strategy
|
|
2
|
+
|
|
3
|
+
The goal is maximum confidence with the minimum necessary test surface. Test count and coverage
|
|
4
|
+
percentage are signals, not quality targets.
|
|
5
|
+
|
|
6
|
+
## Select the protected behavior
|
|
7
|
+
|
|
8
|
+
Understand the behavior being changed, inspect existing coverage, and identify nearby behavior that
|
|
9
|
+
could realistically regress. Protect:
|
|
10
|
+
|
|
11
|
+
- the observable behavior directly changed;
|
|
12
|
+
- important edge cases introduced or affected by the change;
|
|
13
|
+
- consumers that depend on a changed contract;
|
|
14
|
+
- relevant previously discovered regressions;
|
|
15
|
+
- integration boundaries actually crossed by the change.
|
|
16
|
+
|
|
17
|
+
Do not create tests merely because new code, branches, functions, files, or components exist.
|
|
18
|
+
Existing coverage may already be sufficient.
|
|
19
|
+
|
|
20
|
+
## Prefer durable tests
|
|
21
|
+
|
|
22
|
+
Test externally observable behavior and contracts. A behavior-preserving refactor should not force
|
|
23
|
+
large test rewrites. Avoid tests whose main value is asserting internal calls, exact call sequences
|
|
24
|
+
when ordering is not contractual, trivial delegation, getters, constructors, framework boilerplate,
|
|
25
|
+
private structure, or mocks that reproduce the implementation.
|
|
26
|
+
|
|
27
|
+
Before adding coverage, search for an existing behavioral test. Prefer extending it, adding a case
|
|
28
|
+
to a table-driven test, and reusing its fixtures. One strong regression test is better than several
|
|
29
|
+
tests with equivalent setup and assertions.
|
|
30
|
+
|
|
31
|
+
## Choose the cheapest sufficient level
|
|
32
|
+
|
|
33
|
+
Use a focused unit or component test when it can prove the contract. Use integration or end-to-end
|
|
34
|
+
tests only when the behavior depends on boundaries they exercise. Mock genuine system boundaries,
|
|
35
|
+
not every internal dependency.
|
|
36
|
+
|
|
37
|
+
Keep unit tests fast, deterministic, and isolated. If a test needs broad application startup,
|
|
38
|
+
external infrastructure, network access, substantial global state, or expensive fixtures, classify
|
|
39
|
+
and run it at the appropriate broader level rather than disguising it as a unit test.
|
|
40
|
+
|
|
41
|
+
Balance regression protection against execution time, maintenance, flakiness, setup complexity, and
|
|
42
|
+
duplication. A broader test is justified by broader risk, not by the amount of code generated.
|
|
43
|
+
|
|
44
|
+
## Fix bugs with one regression story
|
|
45
|
+
|
|
46
|
+
For a confirmed bug, when practical:
|
|
47
|
+
|
|
48
|
+
1. Add or identify the smallest check that reproduces the incorrect behavior.
|
|
49
|
+
2. Verify that it fails for the expected reason.
|
|
50
|
+
3. Implement the fix.
|
|
51
|
+
4. Verify that the regression check passes.
|
|
52
|
+
5. Run affected tests for plausible nearby regressions.
|
|
53
|
+
|
|
54
|
+
Do not generate a collection of unrelated tests merely because a bug was fixed. If an existing test
|
|
55
|
+
already proves the regression, use it and add no new test.
|
|
56
|
+
|
|
57
|
+
## Select execution scope
|
|
58
|
+
|
|
59
|
+
During development, start with the smallest reliable affected set. Add dependency or consumer tests
|
|
60
|
+
when the changed contract can affect them. Expand to broader suites when affected-test selection is
|
|
61
|
+
unreliable, the blast radius is uncertain, shared infrastructure changed, or repository policy and
|
|
62
|
+
CI strategy require it.
|
|
63
|
+
|
|
64
|
+
Narrow execution is not an excuse to ignore plausible regressions. Conversely, do not run the full
|
|
65
|
+
suite after every small edit when reliable focused selection exists. Required delivery checks still
|
|
66
|
+
run even when development checks were narrow.
|
|
67
|
+
|
|
68
|
+
## Stop adding tests
|
|
69
|
+
|
|
70
|
+
Coverage is adequate when the intended behavior is verified, plausible affected behavior and
|
|
71
|
+
important justified edge cases have been considered, relevant existing tests pass, and the chosen
|
|
72
|
+
test level is proportional to the risk.
|
|
73
|
+
|
|
74
|
+
Before adding another test, ask: **What realistic regression would this catch that existing tests
|
|
75
|
+
would not?** If there is no clear answer, do not add it.
|