continuous-improvement 3.16.0 → 3.18.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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +6 -0
- package/README.md +165 -100
- package/bin/audit-actions.mjs +433 -0
- package/bin/check-command-count.mjs +114 -0
- package/bin/portfolio-health.mjs +298 -0
- package/commands/intent-driven-development.md +36 -0
- package/commands/reconcile.md +34 -7
- package/hooks/gateguard.mjs +137 -3
- package/lib/gateguard-state.mjs +5 -1
- package/lib/plugin-metadata.mjs +1 -1
- package/llms.txt +1 -1
- package/package.json +12 -6
- package/plugins/beginner.json +1 -1
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
- package/plugins/continuous-improvement/commands/intent-driven-development.md +36 -0
- package/plugins/continuous-improvement/commands/reconcile.md +34 -7
- package/plugins/continuous-improvement/hooks/gateguard.mjs +137 -3
- package/plugins/continuous-improvement/lib/gateguard-state.mjs +5 -1
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +1 -1
- package/plugins/continuous-improvement/skills/README.md +2 -1
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +10 -0
- package/plugins/continuous-improvement/skills/intent-driven-development/SKILL.md +161 -0
- package/plugins/continuous-improvement/skills/reconcile/SKILL.md +52 -4
- package/plugins/expert.json +1 -1
- package/skills/gateguard.md +10 -0
- package/skills/intent-driven-development.md +161 -0
- package/skills/reconcile.md +52 -4
- package/templates/actions_security_checklist.md +39 -0
- package/templates/experiment_template.md +38 -0
- package/templates/portfolio_event.schema.json +69 -0
- package/templates/release_receipt_template.md +37 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reconcile
|
|
3
3
|
tier: "2"
|
|
4
|
-
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations,
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, then carries the known-good state through to a landed PR: stage by filename, commit one concern, push the feature branch, verify the push landed, open the PR, and after the PR merges fast-forward the default branch and check it out.
|
|
5
5
|
origin: continuous-improvement
|
|
6
6
|
user-invocable: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# Reconcile — Ground
|
|
9
|
+
# Reconcile — Ground Truth, Then Commit, Push, and Open the PR
|
|
10
10
|
|
|
11
|
-
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state,
|
|
11
|
+
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state, stops at every operation that is hard to reverse, and then carries that known-good state all the way through a single-concern commit, a push, and an open PR — ending back on an up-to-date default branch once the PR merges.
|
|
12
12
|
|
|
13
13
|
## When to Activate
|
|
14
14
|
|
|
15
15
|
- Before any branch/merge/rebase/push when more than one session, loop, or agent may be writing to the tree.
|
|
16
16
|
- When the working tree looks different from what you expect (unexpected branch, surprise modifications, a half-finished merge).
|
|
17
17
|
- Before cleaning up: consolidating branches, dropping stashes, removing worktrees.
|
|
18
|
+
- When finished work needs to land: stage it, commit one concern, push a feature branch, open a PR, and return to an up-to-date default branch.
|
|
18
19
|
- After a push, to confirm it actually landed on the remote.
|
|
19
20
|
|
|
20
21
|
## Establish Ground Truth First
|
|
@@ -24,7 +25,7 @@ Read before you write. Capture the full state in one pass:
|
|
|
24
25
|
```
|
|
25
26
|
git branch --show-current
|
|
26
27
|
git status --porcelain=v1
|
|
27
|
-
git rev-list --left-right --count @{u}...HEAD # behind / ahead of upstream
|
|
28
|
+
git rev-list --left-right --count '@{u}...HEAD' # behind / ahead of upstream (quote the ref — bare @{u} trips the Bash parser)
|
|
28
29
|
git stash list
|
|
29
30
|
git worktree list
|
|
30
31
|
ls .git/MERGE_HEAD .git/rebase-merge .git/rebase-apply 2>/dev/null # in-progress operation?
|
|
@@ -57,10 +58,43 @@ Branch from a base only after confirming `local <base>` equals `origin/<base>`
|
|
|
57
58
|
STOP and get explicit authorization before:
|
|
58
59
|
|
|
59
60
|
- Pushing to a protected branch (e.g. `main`) — this repo's flow is feature branch + PR, never direct push.
|
|
61
|
+
- Merging the PR you opened, or force-deleting a branch (`git branch -D`) — both stay human decisions, never auto-actions on green CI.
|
|
60
62
|
- `git push --force` / `--force-with-lease`, `git reset --hard`, `git clean -fd`, `worktree remove` on a dirty worktree, or dropping a stash with uncommitted value.
|
|
61
63
|
|
|
62
64
|
If a rebase has diverged and force-push is gated, do not force-recover — supersede via a new branch + new PR.
|
|
63
65
|
|
|
66
|
+
## Commit and Open the PR
|
|
67
|
+
|
|
68
|
+
Once ground truth is known and the halt gates are clear, carry the work to an open PR without leaving the known-good state. This tail is self-contained — it reimplements the commit → push → PR steps with plain git/`gh` and depends on no companion plugin.
|
|
69
|
+
|
|
70
|
+
1. **Cut or confirm a feature branch from a fresh base.** Never commit onto a protected branch. Sync the default branch first so the feature branch is not born stale:
|
|
71
|
+
```
|
|
72
|
+
git switch main && git pull --ff-only origin main # master on older repos
|
|
73
|
+
git switch -c <type>/<slug> # only if not already on a feature branch
|
|
74
|
+
```
|
|
75
|
+
Confirm `local main` equals `origin/main` before branching — a squash-merge otherwise bundles ahead-of-origin commits.
|
|
76
|
+
|
|
77
|
+
2. **Stage by explicit filename.** One concern per commit. On an `autocrlf` tree `git add -A` / `git add .` commits phantom line-ending-only changes — name each path and read real drift with `git diff --stat`.
|
|
78
|
+
```
|
|
79
|
+
git add path/one path/two
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
3. **Commit with a Windows-safe message.** Lead with the observable outcome. Use a single-line `-m` (repeat `-m` for paragraphs) or `git commit -F <tempfile>` — never a multi-line here-doc/here-string, which CRLF and shell quoting corrupt on Windows.
|
|
83
|
+
```
|
|
84
|
+
git commit -m "feat(scope): <observable outcome>"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
4. **Push the feature branch** (never the protected branch), then verify it landed via the section below:
|
|
88
|
+
```
|
|
89
|
+
git push -u origin <type>/<slug>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
5. **Open one PR** citing the plan or issue, then stop:
|
|
93
|
+
```
|
|
94
|
+
gh pr create --fill --base main
|
|
95
|
+
```
|
|
96
|
+
**Stop here.** The merge is a human decision. `reconcile` never merges the PR, never uses `--admin` / `--force` / `--no-verify`, never auto-merges on green CI, and never deploys.
|
|
97
|
+
|
|
64
98
|
## Verify the Push Actually Landed
|
|
65
99
|
|
|
66
100
|
A push that printed no error is still a claim. Confirm:
|
|
@@ -72,9 +106,23 @@ git ls-remote origin refs/heads/<branch> # remote tip must equal local HEAD
|
|
|
72
106
|
|
|
73
107
|
If the remote ref is absent or behind, the push did not land — investigate before reporting success.
|
|
74
108
|
|
|
109
|
+
## Sync the Default Branch After the PR Merges
|
|
110
|
+
|
|
111
|
+
"All the latest work on main" is only true once the PR actually merges — and on a protected branch that merge is a human action, not something `reconcile` performs. After the merge lands, return to an up-to-date default branch:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
git switch main # or master on older repos
|
|
115
|
+
git pull --ff-only origin main # fast-forward only; never a merge commit or --force
|
|
116
|
+
git rev-parse HEAD # confirm this equals the squash-merge SHA from the PR
|
|
117
|
+
git branch -d <type>/<slug> # delete the merged feature branch (safe -d, never -D)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`--ff-only` is deliberate: if the pull would not fast-forward, main diverged under you — stop and re-survey from **Establish Ground Truth First** instead of forcing it. You end on the default branch with every merged change present and the feature branch cleaned up.
|
|
121
|
+
|
|
75
122
|
## Pairs With
|
|
76
123
|
|
|
77
124
|
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
78
125
|
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
79
126
|
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
80
127
|
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
128
|
+
- **`commit-commands:commit-push-pr`** — the external-plugin equivalent of the commit → push → PR tail; `reconcile` reimplements it inline so the flow works with no companion installed. For a TDD-gated single-defect variant, use `/ship`.
|
package/plugins/expert.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "continuous-improvement",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"mode": "expert",
|
|
5
5
|
"description": "Expert mode: tune confidence, manage instincts, and persist plans on disk. Adds safety, token-budget, and strategic-compact skills plus the /learn-eval command so long sessions stay sharp and learnings survive context resets.",
|
|
6
6
|
"tools": [
|
package/skills/gateguard.md
CHANGED
|
@@ -150,6 +150,14 @@ The block reason prints the exact `gateguard-session.json` path and the clearanc
|
|
|
150
150
|
|
|
151
151
|
The inline `_gateguard_facts_presented: true` retry still works on harnesses that forward unknown tool params, but Claude Code's strict tool schema (`additionalProperties: false`) rejects it with `InputValidationError` — use one of the above on Claude Code.
|
|
152
152
|
|
|
153
|
+
### Excluding low-risk paths
|
|
154
|
+
|
|
155
|
+
Set the `CI_GATEGUARD_EXCLUDE` environment variable to opt specific low-risk paths out of the gate entirely — an LLM-maintained prose wiki, a generated scratch directory, anything where the fact-forcing pause costs more than it saves. The value is a comma-separated list of path substrings, each matched case-insensitively against the forward-slash-normalized file path, so `/mywiki/` excludes `D:\Vault\MyWiki\notes\x.md`. Unset or empty (the default) changes nothing: every mutating file call is gated exactly as before, and a call that touches a mix of excluded and non-excluded paths still gates the non-excluded ones. Set it per project in `.claude/settings.json` under `env`, or globally in `~/.claude/settings.json`.
|
|
156
|
+
|
|
157
|
+
### Locking edits to the current repo
|
|
158
|
+
|
|
159
|
+
A fact-list can't catch a wrong-repo or wrong-worktree write — you can present perfect facts about the wrong file, in the wrong checkout. Set `CI_GATEGUARD_TARGET_LOCK=block` to make the runtime hook (`hooks/gateguard.mjs`) refuse any mutating call whose **absolute** target canonicalizes outside the session project root (`CLAUDE_PROJECT_DIR`, or the git toplevel). Relative paths resolve under the current directory (= the root) and always pass; only an absolute path into a different tree is denied, and the deny reason names both the stray target and the expected root. This runs before the fact gate and independent of clearance — a wrong-repo write is wrong even with facts. Unset (the default) checks nothing, so legitimate out-of-root edits (`~/.claude`, a `/tmp` scratch file, a sibling repo) are unaffected; turn it on per session in a multi-worktree or headless run where cross-repo writes are the real risk. Paths already covered by `CI_GATEGUARD_EXCLUDE` are never target-locked.
|
|
160
|
+
|
|
153
161
|
### Limitations and guarantees
|
|
154
162
|
|
|
155
163
|
- **Honor system.** Clearance is recorded by `ci_gateguard_clear`, the `gateguard-clear.mjs` CLI, a manual state-file write, or the inline `_gateguard_facts_presented` flag where the harness allows it (see "Clearing the gate" above). The hook can't verify the investigation actually happened; the 50-file cap — counted per session — bounds damage from stuck loops or rogue agents.
|
|
@@ -175,6 +183,8 @@ The standalone `gateguard-ai` Python/CLI package referenced in earlier drafts of
|
|
|
175
183
|
- Let the gate fire naturally. Don't try to pre-answer the gate questions — the investigation itself is what improves quality.
|
|
176
184
|
- Customize gate messages for your domain. If your project has specific conventions, add them to the gate prompts.
|
|
177
185
|
- Use `.gateguard.yml` to ignore paths like `.venv/`, `node_modules/`, `.git/`.
|
|
186
|
+
- For the shipped runtime hook, set `CI_GATEGUARD_EXCLUDE` (comma-separated path substrings) to exclude low-risk paths from the gate — see [Excluding low-risk paths](#excluding-low-risk-paths).
|
|
187
|
+
- In multi-worktree or headless runs, set `CI_GATEGUARD_TARGET_LOCK=block` so a write into the wrong repo/worktree is refused — see [Locking edits to the current repo](#locking-edits-to-the-current-repo).
|
|
178
188
|
|
|
179
189
|
## Related Skills
|
|
180
190
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intent-driven-development
|
|
3
|
+
tier: "2"
|
|
4
|
+
description: "Enforces Law 2 (Plan Is Sacred) of the 7 Laws of AI Agent Discipline. Turn an ambiguous or high-impact change into scoped, verifiable acceptance criteria (observable AC-NNN, explicit in/out scope, named verification methods, and a [revised] protocol that forbids silently dropping a criterion) before or alongside implementation, so the plan that gets built is the plan that was agreed, not an invented default. Use when clarifying a feature, defining acceptance criteria, de-risking a security/data/migration/integration change, or preparing implementation requirements for another agent. Do not trigger for trivial edits, straightforward fixes, active debugging, or code review."
|
|
5
|
+
origin: continuous-improvement
|
|
6
|
+
user-invocable: true
|
|
7
|
+
argument-hint: "[the change to scope into acceptance criteria]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /intent-driven-development: scope the change before you build it
|
|
11
|
+
|
|
12
|
+
Law 2 says the plan is sacred: once a goal and its acceptance conditions are agreed, you do not silently drift from them. The cheapest way to honor that is to make the plan verifiable in the first place. A goal phrased as "make export work" cannot be held sacred because nobody can tell when it is met. This skill converts an ambiguous or high-impact request into observable acceptance criteria (`AC-001`, `AC-002`, ...) with named verification methods, so "done" is a fact two people would agree on, and a criterion can never be quietly dropped mid-build.
|
|
13
|
+
|
|
14
|
+
It produces useful criteria without turning specification into ceremony: inspect available context first, expose only genuine ambiguity, and choose verification that fits the work and its risk.
|
|
15
|
+
|
|
16
|
+
## When to activate
|
|
17
|
+
|
|
18
|
+
- The user asks to clarify a feature, define acceptance criteria, or de-risk a change before implementation.
|
|
19
|
+
- The request touches security, authentication, persistent data, migrations, external APIs, or compliance.
|
|
20
|
+
- The user wants a handoff artifact another agent or team can implement without inventing requirements.
|
|
21
|
+
- The request is ambiguous enough that the expected outcome is not yet observable or testable.
|
|
22
|
+
- The user types `/intent-driven-development`, "define acceptance criteria", "scope this change", or "make this testable".
|
|
23
|
+
|
|
24
|
+
Do not activate for trivial edits, one-line fixes, active debugging, code review, or implementation requests whose acceptance conditions are already clear.
|
|
25
|
+
|
|
26
|
+
## How it works
|
|
27
|
+
|
|
28
|
+
1. **Inspect context first.** Read the repository, docs, schemas, and test infrastructure for technical facts before asking any question. Treat product and business constraints as something only the user or a product artifact can supply.
|
|
29
|
+
2. **Choose depth.** Quick Capture (3-7 criteria, low or moderate risk) or Full Acceptance Brief (security, data, migration, cross-system, or handoff).
|
|
30
|
+
3. **Ask minimally.** Only ask questions whose answers cannot be inferred and that materially change scope or behavior. Group related questions into one batch.
|
|
31
|
+
4. Write observable criteria. Each AC-NNN names a scenario, a trigger, an expected observable result, a prohibited side effect when meaningful, a verification method, and a priority. Do not use "correctly" or "securely" without defined evidence.
|
|
32
|
+
5. **Proceed or hand off.** For a clear request with no blocking risk, record the criteria and continue. For a risky change, present the blockers and wait for confirmation.
|
|
33
|
+
6. **Hold the plan sacred.** If a criterion cannot be met due to a constraint found mid-build, do not silently drop or work around it. Mark it `[revised]`, state the constraint, adjust scope or verification, increment the revision number, and re-present only the changed criteria before continuing.
|
|
34
|
+
|
|
35
|
+
## Operating rules
|
|
36
|
+
|
|
37
|
+
1. Inspect available repository, docs, issue, design, and test context before asking for technical facts that can be discovered locally.
|
|
38
|
+
2. Do not infer product or business constraints from code. Business rules, compliance obligations, contractual SLAs, pricing, data-retention policy, prioritization, and target users cannot be read from a repository. Record them as assumptions flagged for confirmation, never as discovered facts. The repository tells you how the system behaves today, not what the business requires it to do.
|
|
39
|
+
3. Ask only questions whose answers are required and cannot be safely inferred.
|
|
40
|
+
4. Do not block implementation by default. When the user has asked to implement a sufficiently clear change, record key assumptions and criteria briefly, then proceed or hand them to the implementation workflow.
|
|
41
|
+
5. Require explicit confirmation before proceeding only when an unresolved decision could create material security exposure, data loss, irreversible migration, contractual or API breakage, meaningful cost, or destructive external action.
|
|
42
|
+
6. Do not write an acceptance document into a repository, alter project files, create a branch, commit, or invoke another skill unless the user requests it or the active workflow requires it.
|
|
43
|
+
7. Treat automated tests as evidence, not truth. Prefer automation when reliable and proportionate; allow manual UX, accessibility, security, legal, or operational verification where automation cannot establish the outcome.
|
|
44
|
+
8. Never include real secrets, credentials, tokens, private keys, personal data, or production payloads in criteria, fixtures, examples, or saved artifacts. Use redacted or synthetic values.
|
|
45
|
+
9. Do not run destructive tests, migrations, security probes, load tests, paid external calls, or operations against production data without explicit authorization and an identified safe environment.
|
|
46
|
+
10. When a criterion cannot be satisfied due to a constraint discovered during implementation, update it (`[revised]`, state the constraint, adjust scope or verification), increment the revision, and re-present only the changed criteria. Require confirmation only if the revision changes a blocking decision or reduces a safety or correctness guarantee.
|
|
47
|
+
|
|
48
|
+
## Choose the depth
|
|
49
|
+
|
|
50
|
+
Use the smallest useful output.
|
|
51
|
+
|
|
52
|
+
### Quick Capture
|
|
53
|
+
|
|
54
|
+
For a clear but non-trivial change with low or moderate risk. Produce: Goal; In scope and out of scope; Assumptions; 3-7 acceptance criteria with verification methods; blocking questions if any. Do not delay implementation for approval unless a blocking risk exists or the user asked for a spec first.
|
|
55
|
+
|
|
56
|
+
### Full Acceptance Brief
|
|
57
|
+
|
|
58
|
+
For ambiguous, cross-system, security-sensitive, data-changing, migration, compliance, or high-cost changes, or when the user wants a handoff artifact. Produce the full template below and request confirmation for unresolved blocking decisions before risky implementation.
|
|
59
|
+
|
|
60
|
+
### Existing specification review
|
|
61
|
+
|
|
62
|
+
When the user already supplied a PRD, issue, plan, or criteria: review it instead of restarting discovery. Identify missing scope boundaries, unsafe assumptions, contradictions, and unverifiable requirements. Return corrected or supplemental criteria.
|
|
63
|
+
|
|
64
|
+
## Write acceptance criteria
|
|
65
|
+
|
|
66
|
+
Use `AC-001`, `AC-002`, and so on. Criteria and tests need not map one-to-one. For each applicable criterion include: scenario or starting condition; action or trigger; expected observable behavior; prohibited side effect when meaningful; verification method (automated test, integration check, manual UX review, accessibility check, security review, operational check, or stakeholder acceptance); environment or safety constraint when verification could affect data, services, cost, or secrets; priority (Required, Important, or Optional).
|
|
67
|
+
|
|
68
|
+
Do not use "correctly", "securely", "fast", "intuitive", or "robust" without defining observable evidence or recording them as a human-review judgment.
|
|
69
|
+
|
|
70
|
+
Cover only the boundaries that apply:
|
|
71
|
+
|
|
72
|
+
| Category | Include when | Typical evidence |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| Happy path | New or changed user-visible behavior | Successful workflow or state transition |
|
|
75
|
+
| Validation | The change accepts input | Malformed or boundary value rejected without mutation |
|
|
76
|
+
| Authorization/privacy | Data or actions have access boundaries | Denied access and no sensitive disclosure |
|
|
77
|
+
| Persistence/migration | Stored data or schemas change | Backward read, migration, rollback, or backup behavior |
|
|
78
|
+
| Compatibility | Public APIs, files, events, or clients may break | Existing contract or fixture stays valid |
|
|
79
|
+
| Failure recovery | Network, service, or async failure exists | No partial state, or clear retry and degraded behavior |
|
|
80
|
+
| Idempotency/concurrency | Repeats or simultaneous writes are plausible | No duplicate side effect or invalid final state |
|
|
81
|
+
| Performance | A user or service threshold matters | Defined measurement conditions and threshold |
|
|
82
|
+
| UX/accessibility | A person interacts with the result | Keyboard, feedback, error recovery, visual or manual review |
|
|
83
|
+
|
|
84
|
+
## Output template (Full Acceptance Brief)
|
|
85
|
+
|
|
86
|
+
Omit irrelevant sections for Quick Capture.
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
# Acceptance Brief: <Change Name>
|
|
90
|
+
|
|
91
|
+
**Status:** Draft | Approved | Implemented | Verified
|
|
92
|
+
**Revision:** <number>
|
|
93
|
+
**Prepared for:** <user/team/agent, when known>
|
|
94
|
+
|
|
95
|
+
## Goal
|
|
96
|
+
<One observable outcome sentence.>
|
|
97
|
+
|
|
98
|
+
## Scope
|
|
99
|
+
**In scope:** <behavior included>
|
|
100
|
+
**Out of scope:** <adjacent work excluded>
|
|
101
|
+
|
|
102
|
+
## Context
|
|
103
|
+
**Discovered facts** (technical, verified from repository or artifact)
|
|
104
|
+
**Product/business constraints** (supplied by user or artifact, never inferred from code, or "none supplied yet")
|
|
105
|
+
**Assumptions** (unverified claims to confirm)
|
|
106
|
+
**Dependencies and constraints**
|
|
107
|
+
|
|
108
|
+
## Risk Review
|
|
109
|
+
| Risk area | Applies? | Required handling |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| Security/privacy | Yes/No | <redaction, authorization, review> |
|
|
112
|
+
| Persistent data/migration | Yes/No | <compatibility, backup, rollback> |
|
|
113
|
+
| External effects/cost | Yes/No | <sandbox, test environment, authorization> |
|
|
114
|
+
| Compatibility/API | Yes/No | <contract to preserve or version> |
|
|
115
|
+
| UX/accessibility | Yes/No | <manual or automated evidence> |
|
|
116
|
+
|
|
117
|
+
## Acceptance Criteria
|
|
118
|
+
### AC-001: <observable behavior>
|
|
119
|
+
- **Scenario:** <starting condition>
|
|
120
|
+
- **Action:** <single trigger>
|
|
121
|
+
- **Expected:** <observable result>
|
|
122
|
+
- **Must not:** <prohibited side effect, if applicable>
|
|
123
|
+
- **Verification:** <method and intended evidence>
|
|
124
|
+
- **Environment/safety:** <constraints, if applicable>
|
|
125
|
+
- **Priority:** Required | Important | Optional
|
|
126
|
+
|
|
127
|
+
## Blocking Decisions
|
|
128
|
+
- [ ] <only decisions that prevent safe or correct progress>
|
|
129
|
+
|
|
130
|
+
## Verification Plan
|
|
131
|
+
| Criterion | Verification evidence | Status |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| AC-001 | <test, check, or review command or evidence type> | Pending |
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Pass/fail rubric
|
|
137
|
+
|
|
138
|
+
A brief passes only if every answer is "yes". Any "no" means revise before returning it.
|
|
139
|
+
|
|
140
|
+
- [ ] Does every required criterion have a scenario, an observable expected result, and a named verification method?
|
|
141
|
+
- [ ] Are vague terms ("correctly", "secure", "fast", "robust") either replaced with observable evidence or marked as human judgment?
|
|
142
|
+
- [ ] Are product and business constraints listed as supplied or assumed, with none silently inferred from code?
|
|
143
|
+
- [ ] Is scope explicit, with out-of-scope items named?
|
|
144
|
+
- [ ] Are blocking decisions limited to choices that actually affect safety or correctness, not preferences?
|
|
145
|
+
|
|
146
|
+
A failing criterion: `AC-001: The export works correctly and is secure.` (no scenario, no observable result, no verification, "correctly" and "secure" undefined). A passing one names the scenario, the expected result, the prohibited side effect, and the verification method, so two people would agree it was met.
|
|
147
|
+
|
|
148
|
+
## How it fits the 7 Laws
|
|
149
|
+
|
|
150
|
+
| Law | Role of this skill |
|
|
151
|
+
|---|---|
|
|
152
|
+
| Law 2 (Plan Is Sacred) | The acceptance brief **is** the sacred plan: observable criteria, explicit scope, and a `[revised]` protocol that forbids silently dropping or working around a criterion mid-build. |
|
|
153
|
+
| Law 1 (Research Before Executing) | Rule 1 inspects repo, docs, schemas, and tests for technical facts before asking, and refuses to infer business rules from code. |
|
|
154
|
+
| Law 4 (Verify Before Reporting) | Every criterion carries a named verification method and a pass/fail rubric, so "done" is falsifiable rather than asserted. |
|
|
155
|
+
|
|
156
|
+
## Pairs with
|
|
157
|
+
|
|
158
|
+
- [`grill-me`](./grill-me.md): interviews a fuzzy request to a shippable spec. Reach for `grill-me` when the input is unclear, then this skill to turn the agreed intent into verifiable criteria.
|
|
159
|
+
- [`roast`](./roast.md): validates whether the idea should exist at all. Roast first, then scope the survivor into acceptance criteria.
|
|
160
|
+
- [`goal-monitor`](./goal-monitor.md): the runtime drift gate. The `## Goal` and criteria this skill produces are what goal-monitor scores a session against.
|
|
161
|
+
- [`verification-loop`](./verification-loop.md): runs the per-project verify ladder. The criteria's verification methods feed its evidence step.
|
package/skills/reconcile.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reconcile
|
|
3
3
|
tier: "2"
|
|
4
|
-
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations,
|
|
4
|
+
description: Enforces Law 1 (Research Before Executing) of the 7 Laws of AI Agent Discipline. Establishes git ground truth — branch, status, stashes, worktrees, ahead/behind — before any mutation, halts on protected or destructive operations, then carries the known-good state through to a landed PR: stage by filename, commit one concern, push the feature branch, verify the push landed, open the PR, and after the PR merges fast-forward the default branch and check it out.
|
|
5
5
|
origin: continuous-improvement
|
|
6
6
|
user-invocable: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# Reconcile — Ground
|
|
9
|
+
# Reconcile — Ground Truth, Then Commit, Push, and Open the PR
|
|
10
10
|
|
|
11
|
-
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state,
|
|
11
|
+
Law 1 says research before executing. The most expensive skipped research is the state of your own repo: a branch that shifted under you, a push that silently did not land, a stash from a session you forgot. This skill establishes git ground truth first, acts only on a known state, stops at every operation that is hard to reverse, and then carries that known-good state all the way through a single-concern commit, a push, and an open PR — ending back on an up-to-date default branch once the PR merges.
|
|
12
12
|
|
|
13
13
|
## When to Activate
|
|
14
14
|
|
|
15
15
|
- Before any branch/merge/rebase/push when more than one session, loop, or agent may be writing to the tree.
|
|
16
16
|
- When the working tree looks different from what you expect (unexpected branch, surprise modifications, a half-finished merge).
|
|
17
17
|
- Before cleaning up: consolidating branches, dropping stashes, removing worktrees.
|
|
18
|
+
- When finished work needs to land: stage it, commit one concern, push a feature branch, open a PR, and return to an up-to-date default branch.
|
|
18
19
|
- After a push, to confirm it actually landed on the remote.
|
|
19
20
|
|
|
20
21
|
## Establish Ground Truth First
|
|
@@ -24,7 +25,7 @@ Read before you write. Capture the full state in one pass:
|
|
|
24
25
|
```
|
|
25
26
|
git branch --show-current
|
|
26
27
|
git status --porcelain=v1
|
|
27
|
-
git rev-list --left-right --count @{u}...HEAD # behind / ahead of upstream
|
|
28
|
+
git rev-list --left-right --count '@{u}...HEAD' # behind / ahead of upstream (quote the ref — bare @{u} trips the Bash parser)
|
|
28
29
|
git stash list
|
|
29
30
|
git worktree list
|
|
30
31
|
ls .git/MERGE_HEAD .git/rebase-merge .git/rebase-apply 2>/dev/null # in-progress operation?
|
|
@@ -57,10 +58,43 @@ Branch from a base only after confirming `local <base>` equals `origin/<base>`
|
|
|
57
58
|
STOP and get explicit authorization before:
|
|
58
59
|
|
|
59
60
|
- Pushing to a protected branch (e.g. `main`) — this repo's flow is feature branch + PR, never direct push.
|
|
61
|
+
- Merging the PR you opened, or force-deleting a branch (`git branch -D`) — both stay human decisions, never auto-actions on green CI.
|
|
60
62
|
- `git push --force` / `--force-with-lease`, `git reset --hard`, `git clean -fd`, `worktree remove` on a dirty worktree, or dropping a stash with uncommitted value.
|
|
61
63
|
|
|
62
64
|
If a rebase has diverged and force-push is gated, do not force-recover — supersede via a new branch + new PR.
|
|
63
65
|
|
|
66
|
+
## Commit and Open the PR
|
|
67
|
+
|
|
68
|
+
Once ground truth is known and the halt gates are clear, carry the work to an open PR without leaving the known-good state. This tail is self-contained — it reimplements the commit → push → PR steps with plain git/`gh` and depends on no companion plugin.
|
|
69
|
+
|
|
70
|
+
1. **Cut or confirm a feature branch from a fresh base.** Never commit onto a protected branch. Sync the default branch first so the feature branch is not born stale:
|
|
71
|
+
```
|
|
72
|
+
git switch main && git pull --ff-only origin main # master on older repos
|
|
73
|
+
git switch -c <type>/<slug> # only if not already on a feature branch
|
|
74
|
+
```
|
|
75
|
+
Confirm `local main` equals `origin/main` before branching — a squash-merge otherwise bundles ahead-of-origin commits.
|
|
76
|
+
|
|
77
|
+
2. **Stage by explicit filename.** One concern per commit. On an `autocrlf` tree `git add -A` / `git add .` commits phantom line-ending-only changes — name each path and read real drift with `git diff --stat`.
|
|
78
|
+
```
|
|
79
|
+
git add path/one path/two
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
3. **Commit with a Windows-safe message.** Lead with the observable outcome. Use a single-line `-m` (repeat `-m` for paragraphs) or `git commit -F <tempfile>` — never a multi-line here-doc/here-string, which CRLF and shell quoting corrupt on Windows.
|
|
83
|
+
```
|
|
84
|
+
git commit -m "feat(scope): <observable outcome>"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
4. **Push the feature branch** (never the protected branch), then verify it landed via the section below:
|
|
88
|
+
```
|
|
89
|
+
git push -u origin <type>/<slug>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
5. **Open one PR** citing the plan or issue, then stop:
|
|
93
|
+
```
|
|
94
|
+
gh pr create --fill --base main
|
|
95
|
+
```
|
|
96
|
+
**Stop here.** The merge is a human decision. `reconcile` never merges the PR, never uses `--admin` / `--force` / `--no-verify`, never auto-merges on green CI, and never deploys.
|
|
97
|
+
|
|
64
98
|
## Verify the Push Actually Landed
|
|
65
99
|
|
|
66
100
|
A push that printed no error is still a claim. Confirm:
|
|
@@ -72,9 +106,23 @@ git ls-remote origin refs/heads/<branch> # remote tip must equal local HEAD
|
|
|
72
106
|
|
|
73
107
|
If the remote ref is absent or behind, the push did not land — investigate before reporting success.
|
|
74
108
|
|
|
109
|
+
## Sync the Default Branch After the PR Merges
|
|
110
|
+
|
|
111
|
+
"All the latest work on main" is only true once the PR actually merges — and on a protected branch that merge is a human action, not something `reconcile` performs. After the merge lands, return to an up-to-date default branch:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
git switch main # or master on older repos
|
|
115
|
+
git pull --ff-only origin main # fast-forward only; never a merge commit or --force
|
|
116
|
+
git rev-parse HEAD # confirm this equals the squash-merge SHA from the PR
|
|
117
|
+
git branch -d <type>/<slug> # delete the merged feature branch (safe -d, never -D)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`--ff-only` is deliberate: if the pull would not fast-forward, main diverged under you — stop and re-survey from **Establish Ground Truth First** instead of forcing it. You end on the default branch with every merged change present and the feature branch cleaned up.
|
|
121
|
+
|
|
75
122
|
## Pairs With
|
|
76
123
|
|
|
77
124
|
- **`recall`** (Law 1) — before a risky git op, recall whether the same operation failed on this repo before.
|
|
78
125
|
- **`gateguard`** (Law 1) — the runtime gate (`hooks/gateguard.mjs`); `reconcile` is the procedure you run once a destructive git action is in play.
|
|
79
126
|
- **`safety-guard`** — destructive-operation guardrails for production and autonomous runs.
|
|
80
127
|
- **`audit`** (Law 4) — when an audit ends in a fix, `reconcile` is the safe path from branch to landed PR.
|
|
128
|
+
- **`commit-commands:commit-push-pr`** — the external-plugin equivalent of the commit → push → PR tail; `reconcile` reimplements it inline so the flow works with no companion installed. For a TDD-gated single-defect variant, use `/ship`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# GitHub Actions Security Checklist
|
|
2
|
+
|
|
3
|
+
> Apply to every workflow in `.github/workflows/`. Each item is checkable by reading the YAML — no runtime access needed. The `audit-actions` command automates the mechanical checks; this checklist is the human review layer.
|
|
4
|
+
|
|
5
|
+
## Permissions
|
|
6
|
+
|
|
7
|
+
- [ ] Workflow (or every job) declares explicit `permissions:` — never relies on the default token grant
|
|
8
|
+
- [ ] Default is `permissions: contents: read`; write scopes are added per-job only where provably needed
|
|
9
|
+
- [ ] No `permissions: write-all`
|
|
10
|
+
- [ ] Workflows triggered by `pull_request_target`, `issue_comment`, or `issues` do NOT get write tokens or secrets unless a maintainer-approval gate exists
|
|
11
|
+
|
|
12
|
+
## Untrusted input
|
|
13
|
+
|
|
14
|
+
- [ ] No direct interpolation of `github.event.*` text (issue/PR title, body, comment, branch name, commit message) inside `run:` shell — pass through `env:` and quote as `"$VAR"`
|
|
15
|
+
- [ ] Untrusted content passed to agents/LLMs is wrapped in a prompt boundary and stripped of tool-invocation-looking text
|
|
16
|
+
- [ ] `actions/checkout` of PR head refs in privileged contexts is treated as executing untrusted code
|
|
17
|
+
|
|
18
|
+
## Supply chain
|
|
19
|
+
|
|
20
|
+
- [ ] Third-party actions are pinned to a full commit SHA (tags are mutable); first-party `actions/*` at minimum pinned to a major version
|
|
21
|
+
- [ ] No `curl | bash` of unpinned remote scripts
|
|
22
|
+
- [ ] Artifacts downloaded from other workflows are treated as untrusted input
|
|
23
|
+
|
|
24
|
+
## Runaway control
|
|
25
|
+
|
|
26
|
+
- [ ] Every job has `timeout-minutes`
|
|
27
|
+
- [ ] Workflows that deploy or mutate state declare `concurrency:` with a stable group key
|
|
28
|
+
- [ ] Scheduled/agentic workflows have an explicit cost ceiling (matrix size, iteration cap)
|
|
29
|
+
|
|
30
|
+
## Agentic workflows
|
|
31
|
+
|
|
32
|
+
- [ ] Agent runs triggered by issue/PR/comment text run with read-only tokens
|
|
33
|
+
- [ ] A human approves before any agent-generated change is pushed or merged
|
|
34
|
+
- [ ] Prompt boundary and tool boundary are logged for each agent run
|
|
35
|
+
|
|
36
|
+
## Secrets
|
|
37
|
+
|
|
38
|
+
- [ ] Secrets are not exposed to workflows runnable by untrusted PRs
|
|
39
|
+
- [ ] No secrets echoed to logs or written to artifacts
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Experiment
|
|
2
|
+
|
|
3
|
+
> One file per experiment. Copy to `.experiments/<YYYY-MM-DD>-<slug>.md`. No experiment record = no claim of learning.
|
|
4
|
+
|
|
5
|
+
## Definition
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Experiment name | |
|
|
10
|
+
| Lane | trading / quran / workflow / infra |
|
|
11
|
+
| Repo | |
|
|
12
|
+
| Owner | |
|
|
13
|
+
| Feature flag (if any) | |
|
|
14
|
+
| Start date | |
|
|
15
|
+
| Stop date (hard stop — decide even if inconclusive) | |
|
|
16
|
+
|
|
17
|
+
## Hypothesis
|
|
18
|
+
|
|
19
|
+
State as: "If we [change], then [segment] will [measurable behavior], because [reasoning]."
|
|
20
|
+
|
|
21
|
+
## Metrics
|
|
22
|
+
|
|
23
|
+
- Primary metric (one only):
|
|
24
|
+
- Pass threshold (exact number):
|
|
25
|
+
- Guardrail metric (what must NOT get worse):
|
|
26
|
+
- Segment (who is measured):
|
|
27
|
+
|
|
28
|
+
## Result
|
|
29
|
+
|
|
30
|
+
Fill after stop date. Do not leave open past the stop date.
|
|
31
|
+
|
|
32
|
+
- Observed primary metric:
|
|
33
|
+
- Guardrail status:
|
|
34
|
+
- Evidence links (dashboards, exports, screenshots):
|
|
35
|
+
|
|
36
|
+
## Decision
|
|
37
|
+
|
|
38
|
+
One of: **ship** / **iterate** / **kill**. State the decision and the single next action.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/naimkatiman/continuous-improvement/main/templates/portfolio_event.schema.json",
|
|
4
|
+
"title": "PortfolioEvent",
|
|
5
|
+
"description": "Shared event schema for all repos in the portfolio. Every CI run, deploy, incident, experiment, agent action, security finding, release, decision, and metric snapshot is one event.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["eventId", "repo", "eventType", "occurredAt", "source"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"eventId": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Globally unique id (uuid or <repo>-<timestamp>-<n>)."
|
|
13
|
+
},
|
|
14
|
+
"repo": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "GitHub repo in owner/name form, e.g. naimkatiman/tradeclaw."
|
|
17
|
+
},
|
|
18
|
+
"eventType": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": ["ci", "deploy", "incident", "experiment", "agent", "security", "release", "decision", "metric"]
|
|
21
|
+
},
|
|
22
|
+
"occurredAt": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"format": "date-time",
|
|
25
|
+
"description": "ISO 8601 UTC timestamp."
|
|
26
|
+
},
|
|
27
|
+
"source": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "What emitted the event: github-actions, wrangler, manual, agent:<name>, cron:<name>."
|
|
30
|
+
},
|
|
31
|
+
"actor": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Human or agent responsible, e.g. naimkatiman or agent:portfolio-health."
|
|
34
|
+
},
|
|
35
|
+
"status": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": ["success", "failure", "in_progress", "cancelled", "n/a"],
|
|
38
|
+
"description": "Outcome where applicable."
|
|
39
|
+
},
|
|
40
|
+
"severity": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"enum": ["info", "low", "medium", "high", "critical"],
|
|
43
|
+
"description": "Required in practice for incident and security events."
|
|
44
|
+
},
|
|
45
|
+
"title": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "One-line human-readable summary."
|
|
48
|
+
},
|
|
49
|
+
"evidenceUrl": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Link to the receipt: CI run, release receipt file, experiment file, dashboard."
|
|
52
|
+
},
|
|
53
|
+
"commitSha": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"metricName": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "For metric events: stable snake_case metric name."
|
|
59
|
+
},
|
|
60
|
+
"metricValue": {
|
|
61
|
+
"type": "number",
|
|
62
|
+
"description": "For metric events: numeric value."
|
|
63
|
+
},
|
|
64
|
+
"metadata": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"description": "Event-type-specific payload. Keep flat and JSON-serializable."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Release Receipt
|
|
2
|
+
|
|
3
|
+
> One receipt per release/deploy. Copy this file to `.releases/<YYYY-MM-DD>-<version-or-slug>.md`, fill every field, commit it with the release. A release without a receipt did not happen.
|
|
4
|
+
|
|
5
|
+
## Identity
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Repo | |
|
|
10
|
+
| Version / tag | |
|
|
11
|
+
| Commit SHA | |
|
|
12
|
+
| Environment | production / staging / preview |
|
|
13
|
+
| Released at (UTC) | |
|
|
14
|
+
| Owner | |
|
|
15
|
+
|
|
16
|
+
## What shipped
|
|
17
|
+
|
|
18
|
+
- User-visible impact (one sentence, outcome not mechanism):
|
|
19
|
+
- Feature flags changed (name, old value, new value):
|
|
20
|
+
- Migrations run (file names, or "none"):
|
|
21
|
+
|
|
22
|
+
## Verification
|
|
23
|
+
|
|
24
|
+
- Tests run (exact commands + result):
|
|
25
|
+
- Security scans run (tool + result, or "none"):
|
|
26
|
+
- Manual verification performed:
|
|
27
|
+
|
|
28
|
+
## Risk
|
|
29
|
+
|
|
30
|
+
- Known risks accepted at release time:
|
|
31
|
+
- Rollback command (exact, copy-pasteable):
|
|
32
|
+
- Monitoring link (dashboard/logs to watch after release):
|
|
33
|
+
|
|
34
|
+
## Sign-off
|
|
35
|
+
|
|
36
|
+
- [ ] All fields above are filled (no blanks — use "none" explicitly)
|
|
37
|
+
- [ ] Rollback command was verified to exist (not just guessed)
|