ralphctl 0.8.3 → 0.8.4

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.
@@ -1,19 +1,29 @@
1
- # Repository Script Detection Protocol
2
-
1
+ <role>
3
2
  You are a senior engineer inventorying a single repository so the harness can run the right shell
4
- commands at sprint start (setup) and after every task (verification). For any repo that has a
5
- manifest or a coding-agent context file, you should typically emit both tags — silence is reserved
6
- for repos where the project itself is silent on those topics.
7
-
8
- 1. **`<setup-script>`** — one shell line the harness runs **once** before each sprint to prepare
9
- the working tree (typically dependency install via whichever package manager / build tool the
10
- project actually uses). Omit only when the project itself documents no setup step.
11
- 2. **`<verify-script>`** — one shell line the harness runs as the **post-task gate**. Chain the
12
- typecheck / lint / test commands the project actually exposes using `&&` so the harness sees
13
- the first failure. Omit only when the project documents no such commands at all.
3
+ commands at sprint start (setup) and after every task (verification). This is a single-shot,
4
+ read-only extraction no code changes, no file writes except `signals.json`.
5
+ </role>
14
6
 
15
7
  {{HARNESS_CONTEXT}}
16
8
 
9
+ <goal>
10
+ Inspect the repository at `{{REPOSITORY_PATH}}` and propose a single-line setup script and a
11
+ single-line verify script by writing `signals.json` to the output directory.
12
+ </goal>
13
+
14
+ <success_criteria>
15
+
16
+ - Every proposed command is traceable to a file in the repository (context file or manifest).
17
+ - Each script is a single shell line — no here-docs, no multi-line bodies.
18
+ - Setup and verify commands reflect the project's own documented contract, not inferred guesses.
19
+ - If no evidence exists for a script class, that signal is absent rather than fabricated.
20
+
21
+ </success_criteria>
22
+
23
+ <inputs>
24
+ <repository_path>{{REPOSITORY_PATH}}</repository_path>
25
+ </inputs>
26
+
17
27
  <constraints>
18
28
 
19
29
  **This invocation is read-only.** Do not modify the working tree, do not create files, do not run
@@ -45,8 +55,8 @@ or vendored directories.
45
55
 
46
56
  **Emit when documented, omit when silent.** When the manifest or context files name a class of
47
57
  commands, emit the tag — even when multiple candidates exist, pick the one most consistent with
48
- what the project documented. Omit a tag only when the project's own files are silent on that class
49
- entirely.
58
+ what the project documented. Omit a signal only when the project's own files are silent on that
59
+ class entirely.
50
60
 
51
61
  **Script safety.** Reject pipe-to-shell shapes (`curl … | sh`, `wget -O- … | bash`), `eval`, and
52
62
  `rm -rf`. One shell line per script — multi-line bodies, sub-shells, and heredocs are out of
@@ -63,39 +73,94 @@ project's docs name them as part of the verification gate.
63
73
 
64
74
  </constraints>
65
75
 
76
+ <output_contract>
77
+
78
+ {{OUTPUT_CONTRACT_SECTION}}
79
+
80
+ Emit only `setup-script`, `verify-script`, and `note` signals — no other signal kinds. If you
81
+ cannot determine an appropriate command for a script class, omit that signal rather than guessing.
82
+ If you cannot make any determination at all (e.g. the repository is empty or entirely undocumented),
83
+ emit a single `note` signal with a brief explanation and stop — do not invent commands.
84
+
85
+ </output_contract>
86
+
66
87
  <example>
67
88
  When `CLAUDE.md` (or equivalent) contains "Verification: `<tool> typecheck && <tool> lint &&
68
- <tool> test`" and `package.json` (or equivalent manifest) declares those scripts:
69
-
70
- ```
71
- <setup-script><tool> install</setup-script>
72
- <verify-script><tool> typecheck && <tool> lint && <tool> test</verify-script>
73
- <note>Commands lifted verbatim from CLAUDE.md.</note>
89
+ `<tool> test`" and the manifest declares those scripts:
90
+
91
+ ```json
92
+ {
93
+ "signals": [
94
+ {
95
+ "type": "setup-script",
96
+ "command": "<tool> install",
97
+ "timestamp": "..."
98
+ },
99
+ {
100
+ "type": "verify-script",
101
+ "command": "<tool> typecheck && <tool> lint && <tool> test",
102
+ "timestamp": "..."
103
+ },
104
+ {
105
+ "type": "note",
106
+ "text": "Commands lifted verbatim from CLAUDE.md.",
107
+ "timestamp": "..."
108
+ }
109
+ ]
110
+ }
74
111
  ```
75
112
 
76
113
  When only a manifest exists with install + test scripts and no context file:
77
114
 
78
- ```
79
- <setup-script><tool> install</setup-script>
80
- <verify-script><tool> test</verify-script>
81
- <note>No context file found; commands inferred from package.json scripts.</note>
115
+ ```json
116
+ {
117
+ "signals": [
118
+ {
119
+ "type": "setup-script",
120
+ "command": "<tool> install",
121
+ "timestamp": "..."
122
+ },
123
+ {
124
+ "type": "verify-script",
125
+ "command": "<tool> test",
126
+ "timestamp": "..."
127
+ },
128
+ {
129
+ "type": "note",
130
+ "text": "No context file found; commands inferred from manifest scripts.",
131
+ "timestamp": "..."
132
+ }
133
+ ]
134
+ }
82
135
  ```
83
136
 
84
137
  When a JVM build descriptor (e.g. `pom.xml`) drives the project and `CLAUDE.md` names install +
85
138
  verify steps:
86
139
 
87
- ```
88
- <setup-script>mvn -B -DskipTests install</setup-script>
89
- <verify-script>mvn -B verify</verify-script>
90
- <note>Commands lifted from CLAUDE.md; -B disables interactive prompts and ANSI colour for clean persisted logs.</note>
140
+ ```json
141
+ {
142
+ "signals": [
143
+ {
144
+ "type": "setup-script",
145
+ "command": "mvn -B -DskipTests install",
146
+ "timestamp": "..."
147
+ },
148
+ {
149
+ "type": "verify-script",
150
+ "command": "mvn -B verify",
151
+ "timestamp": "..."
152
+ },
153
+ {
154
+ "type": "note",
155
+ "text": "Commands lifted from CLAUDE.md; -B disables interactive prompts and ANSI colour for clean persisted logs.",
156
+ "timestamp": "..."
157
+ }
158
+ ]
159
+ }
91
160
  ```
92
161
 
93
162
  </example>
94
163
 
95
- ## Repository Context
96
-
97
- **Repository path:** `{{REPOSITORY_PATH}}`
98
-
99
164
  ## Protocol
100
165
 
101
166
  ### Phase 1 — Inspection
@@ -118,10 +183,10 @@ tests, vendored directories, or generated output.
118
183
  ### Phase 2 — Drafting
119
184
 
120
185
  For each candidate command, confirm the file that documents it. When a context file and a manifest
121
- both name the same command, the context file wins (it's deliberate author intent). For
122
- `<verify-script>`, prefer chaining the project's own task scripts over re-spelling the underlying
123
- tools — the project's scripts are the documented contract.
186
+ both name the same command, the context file wins (it's deliberate author intent). For the verify
187
+ script, prefer chaining the project's own task scripts over re-spelling the underlying tools — the
188
+ project's scripts are the documented contract.
124
189
 
125
190
  ### Phase 3 — Output
126
191
 
127
- {{OUTPUT_CONTRACT_SECTION}}
192
+ Write `signals.json` to the output directory as described in `<output_contract>` above.
@@ -1,128 +1,149 @@
1
- # Per-Repository Skill Authoring Protocol
2
-
3
- You are a senior engineer authoring two short coding-agent skills for a single repository, so
4
- future AI sessions on this repo have stack-aware guidance baked in. For any repo that has a
5
- manifest or coding-agent context file, you should typically emit both skills silence is reserved
6
- for repos where an existing skill already covers the same intent.
7
-
8
- 1. **`<setup-skill>`** — a few paragraphs of markdown explaining how this repo should be prepared
9
- at the start of a sprint. Covers the package manager / build tool actually in use, any
10
- environment or tool-version pins, and quirks the AI must respect (monorepo sub-tree ordering,
11
- lockfile policies, network access, …). The reader is an AI session about to spend the next
12
- several turns editing this repo; teach it what it needs to know up front. Omit when an
13
- existing project skill at the convention path already covers sprint setup for this repo.
14
- 2. **`<verify-skill>`** — a few paragraphs explaining how to **verify changes** in this repo:
15
- which commands gate correctness, where the signal lives (test output, type errors, lint
16
- reports), and how to interpret common failure modes for this stack. The reader will run the
17
- verify-script (a single shell line elsewhere on the repo entity) and needs to know how to read
18
- its output. Omit when an existing project skill already covers post-task verification for this
19
- repo.
1
+ <role>
2
+ You are an AI coding agent performing a single-shot, read-only repository inventory. Your sole job for
3
+ this call is to author two short coding-agent skills — one for sprint-start setup and one for post-task
4
+ verification — so future AI sessions on this repository have stack-aware guidance baked in. Write with
5
+ precision; every sentence must be grounded in something you read in the repo.
6
+ </role>
7
+
8
+ <goal>
9
+ Produce one `setup-skill-proposal` signal and one `verify-skill-proposal` signal for the repository
10
+ at `{{REPOSITORY_PATH}}`, each containing a multi-paragraph markdown body, and write them to
11
+ `signals.json` in the harness output directory. Omit a signal only when an existing skill already
12
+ covers that responsibility for this repo.
13
+ </goal>
14
+
15
+ <success_criteria>
16
+
17
+ - At least one of `setup-skill-proposal` / `verify-skill-proposal` is emitted, unless existing skills
18
+ already cover both responsibilities (in which case emit a `note` explaining what was found).
19
+ - Every concrete claim in a skill body — a tool name, a command flag, a directory path — is backed by
20
+ a file you read in this repo or its context files. No training-data generics.
21
+ - Skill bodies are written in second-person, present tense, 4–10 short paragraphs each.
22
+ - `signals.json` is valid JSON that parses against the output contract schema.
23
+
24
+ </success_criteria>
25
+
26
+ <inputs>
27
+ <repository_path>{{REPOSITORY_PATH}}</repository_path>
28
+ <skills_convention>{{SKILLS_CONVENTION}}</skills_convention>
29
+ </inputs>
20
30
 
21
31
  {{HARNESS_CONTEXT}}
22
32
 
33
+ <capabilities>
34
+ You can read files anywhere in the repository at `{{REPOSITORY_PATH}}`. You cannot run shell commands,
35
+ modify files, or create files — this invocation is read-only. The harness owns execution; your output
36
+ is a proposal the operator reviews before anything lands.
37
+ </capabilities>
38
+
23
39
  <constraints>
24
40
 
25
- **This invocation is read-only.** Do not modify the working tree, do not create files, do not run
26
- commands. The harness owns execution; the user reviews your proposal before anything lands.
41
+ **Inspection scope.** Read context files first coding-agent context files your provider knows about
42
+ (when present), human onboarding docs (`README.md`, `CONTRIBUTING.md`), and explicit task runners
43
+ (`Makefile`, `justfile`, `Taskfile.yml`). These are the authoritative source. Beyond them, read only
44
+ configuration and metadata files: manifests, lockfiles, build descriptors, tool-version pins, CI
45
+ workflows, top-level `scripts/` entries. For monorepos, inspect the root and one or two representative
46
+ sub-modules. Do NOT read source trees, tests, or vendored directories.
27
47
 
28
- **Read project context first.** Before any manifest, look for the coding-agent context files your
29
- provider knows about, human onboarding docs (`README.md`, `CONTRIBUTING.md`), and explicit task
30
- runners (`Makefile`, `justfile`, `Taskfile.yml`). These are the authoritative source they often
31
- describe the project's setup and verify conventions directly. If they do, write your skill bodies
32
- in terms of what those files say.
48
+ **Check existing skills before drafting.** Use the convention below to list and inspect existing
49
+ per-repo skills. If a skill already covers the sprint-setup or post-task-verification responsibility
50
+ for this repo even partially — omit the relevant signal and note it in a `note` signal so the
51
+ operator can decide. Most repos will not have existing skills; their absence is the reason to emit,
52
+ not a reason to omit.
33
53
 
34
- **Check existing skills before drafting — but treat their absence as normal.** Use the convention
35
- below to list and inspect existing per-repo skills. If a skill already covers the sprint-setup or
36
- post-task-verification responsibility for this repo — even partially — omit the relevant tag and
37
- note it in `<note>` so the human reviewer can decide. Most repos will not have existing skills;
38
- the absence of a match is not a reason to omit — it is the reason to emit.
54
+ <skills_convention>{{SKILLS_CONVENTION}}</skills_convention>
39
55
 
40
- <skills-convention>
41
- {{SKILLS_CONVENTION}}
42
- </skills-convention>
56
+ **Evidence rule.** Every concrete claim in a skill body (a tool name, a flag, a directory) MUST be
57
+ backed by something you read in the repo or a context file. Drop any claim you cannot tie to a file.
43
58
 
44
- **Inspection scope.** Beyond context files, read only configuration and metadata files (manifests,
45
- lockfiles, build descriptors, tool-version pins, CI workflows, top-level `scripts/` entries). For
46
- monorepos, inspect the root and one or two representative sub-modules so skill bodies describe the
47
- whole tree, not just the root. Do not crawl source trees, tests, or vendored directories.
59
+ **Voice and length.** Write in clean second-person, present tense these bodies are AI-to-AI
60
+ instructions. Aim for 4–10 short paragraphs per skill. No headings inside the body (the harness wraps
61
+ each in its own section). Code fences inside the body are fine.
48
62
 
49
- **Evidence rule.** Every concrete claim in a skill body (a tool name, a flag, a directory) must be
50
- backed by something you read in the repo or a context file. Don't recite generic advice from
51
- training data; the value is repo-specific grounding. If you cannot tie a claim to a file, drop it.
63
+ **Skill content must be useful, not aspirational.** "Run the project's install command" is useful. "Be
64
+ careful with edge cases" is noise. Delete any paragraph that would apply to any project.
52
65
 
53
- **Emit when there is any stack-specific quirk.** If the repo has a non-default tool chain, a
66
+ **Emit when there is any stack-specific quirk.** If the repo has a non-default toolchain, a
54
67
  tool-version pin, a lockfile policy, a monorepo sub-tree ordering dependency, or anything else that
55
- would trip up a generic AI session — emit the skill and document it. Omit only when an existing
56
- skill already covers it.
57
-
58
- **Voice and length.** Write in clean second-person, present tense — these bodies are AI-to-AI
59
- instructions. Aim for 4–10 short paragraphs per skill. No headings inside the body (the harness
60
- wraps each in its own `# Setup` / `# Verify` section). No code fences around the tags themselves;
61
- code fences inside the body are fine.
62
-
63
- **Skill content must be useful, not aspirational.** "Run `<tool> test`" is useful. "Be careful
64
- with edge cases" is noise. If a paragraph would apply to any project, delete it.
68
+ would trip up a generic AI session — emit the skill and document it.
65
69
 
66
70
  </constraints>
67
71
 
68
- <example>
69
- When `CLAUDE.md` (or equivalent) documents the verify command and `mise.toml` (or equivalent)
70
- pins tool versions:
72
+ <skill_shapes>
73
+ The two skills have distinct responsibilities:
71
74
 
72
- ```
73
- <setup-skill>
74
- This repo pins tool versions with `mise`. Before editing anything, run `mise install` to activate
75
- the exact versions declared in `mise.toml`. Then run the project's install command (documented in
76
- `CLAUDE.md`) to hydrate the dependency tree.
77
-
78
- The lockfile is committed — do not pass flags that skip it or downgrade to production-only deps
79
- unless `CLAUDE.md` explicitly asks for that variant. The harness may re-run setup across a sprint;
80
- the install command is idempotent.
81
- </setup-skill>
82
- <verify-skill>
83
- Verification runs three gates in sequence (documented in `CLAUDE.md`): typecheck, lint, then tests.
84
- A failure in any gate stops the chain; read the first failing gate's output — later gates haven't
85
- run yet. Type errors name the file and line; fix them in the source, not the type declarations.
86
- Lint errors list the rule id; most are auto-fixable by the linter's `--fix` flag. Test failures
87
- show the failing assertion and the diff.
88
- </verify-skill>
89
- <note>Skills authored from CLAUDE.md and mise.toml.</note>
90
- ```
75
+ **Setup skill** (`setup-skill-proposal`) — teaches a future AI session how to prepare this repository
76
+ at the start of a sprint. Covers: the package manager or build tool in use, environment or
77
+ tool-version pins, any quirks the AI must respect (monorepo sub-tree ordering, lockfile policies,
78
+ network restrictions). The reader is an AI about to spend multiple turns editing this repo; teach it
79
+ what it needs to know up front.
91
80
 
92
- </example>
81
+ **Verify skill** (`verify-skill-proposal`) — teaches a future AI session how to interpret verification
82
+ results in this repo: which commands gate correctness, where the signal lives (test output, type
83
+ errors, lint reports), and how to interpret common failure modes for this stack. The reader will run
84
+ the verify script (a single shell command defined elsewhere on the repository entity) and needs to
85
+ know how to read its output and diagnose failures.
86
+ </skill_shapes>
93
87
 
94
- ## Repository Context
88
+ <inspection_protocol>
95
89
 
96
- **Repository path:** `{{REPOSITORY_PATH}}`
90
+ Open with a `<thinking>` block. Cover, in order:
97
91
 
98
- ## Protocol
92
+ 1. Existing skills you found at the convention path and, for each, the responsibility it already
93
+ covers. State explicitly whether the setup or verify intent is already taken. When no existing
94
+ skills exist, note that — it means you should emit both.
95
+ 2. The coding-agent context files you found (when present) and the commands or conventions they
96
+ explicitly name.
97
+ 3. The manifests you read and what stack each implies. For monorepos, name the sub-trees.
98
+ 4. The single most important thing the next AI session would NOT know without this skill — the
99
+ asymmetry between what is documented and what is load-bearing for real work.
100
+ 5. A one-line outline of each skill's content before drafting, or an explicit "skip — already covered
101
+ by `<existing skill id>`" when an existing skill makes the new one redundant.
99
102
 
100
- ### Phase 1 Inspection
103
+ Then read only the configuration and metadata files in scope above. Do NOT read source trees, tests,
104
+ vendored directories, or generated output.
101
105
 
102
- Open with a `<thinking>...</thinking>` block. Cover, in order:
106
+ For polyglot monorepos, give the AI the relationship between sub-trees (e.g. "the frontend depends
107
+ on a build artifact produced by the backend"). Generic boilerplate adds no value — every sentence
108
+ should earn its place by being specific to this repo.
103
109
 
104
- 1. Existing skills you found at the convention path above and, for each, the responsibility it
105
- already covers. State explicitly whether either the setup or verify intent is already taken.
106
- When no existing skills exist, note that — it means you should emit both.
107
- 2. The coding-agent context files you found and the commands / conventions they explicitly name.
108
- 3. The manifest(s) you read and what stack each implies. For monorepos, name the sub-trees.
109
- 4. The single most important thing the next AI session would NOT know without this skill —
110
- the asymmetry between what's documented in the repo and what's load-bearing for real work.
111
- 5. A one-line outline of each skill's content before drafting, or an explicit "skip — already
112
- covered by `<existing skill id>`" when an existing skill makes the new one redundant.
110
+ </inspection_protocol>
113
111
 
114
- The harness strips thinking blocks before persisting; explicit reasoning produces sharper bodies.
112
+ <example>
113
+ When the repository's context file documents the verify command and a tool-version pin file is present:
115
114
 
116
- Then read only the configuration and metadata files in scope above. Do NOT read source trees,
117
- tests, vendored directories, or generated output.
115
+ ```
116
+ signals.json
117
+ {
118
+ "schemaVersion": 1,
119
+ "signals": [
120
+ {
121
+ "type": "setup-skill-proposal",
122
+ "content": "This repo pins tool versions with mise. Before editing anything, run `mise install` to activate the exact versions declared in `mise.toml`. Then run the project's install command documented in the coding-agent context file to hydrate the dependency tree.\n\nThe lockfile is committed — do not pass flags that skip it or downgrade to production-only deps unless the context file explicitly asks for that variant. The harness may re-run setup across a sprint; the install command is idempotent.",
123
+ "timestamp": "2026-05-22T10:00:00.000Z"
124
+ },
125
+ {
126
+ "type": "verify-skill-proposal",
127
+ "content": "Verification runs three gates in sequence (documented in the coding-agent context file): typecheck, lint, then tests. A failure in any gate stops the chain; read the first failing gate's output — later gates have not run yet. Type errors name the file and line; fix them in the source, not the type declarations. Lint errors list the rule id; most are auto-fixable by the linter's `--fix` flag. Test failures show the failing assertion and the diff.",
128
+ "timestamp": "2026-05-22T10:00:00.000Z"
129
+ },
130
+ {
131
+ "type": "note",
132
+ "text": "Skills authored from the coding-agent context file and mise.toml.",
133
+ "timestamp": "2026-05-22T10:00:00.000Z"
134
+ }
135
+ ]
136
+ }
137
+ ```
118
138
 
119
- ### Phase 2 — Drafting
139
+ </example>
120
140
 
121
- Write each body with the evidence rule in mind. For polyglot monorepos, give the AI the
122
- relationship between sub-trees (e.g. "the frontend depends on a build artifact produced by the
123
- backend"). Generic boilerplate adds no value — every sentence should earn its place by being
124
- specific to this repo.
141
+ <output_contract>
142
+ {{OUTPUT_CONTRACT_SECTION}}
125
143
 
126
- ### Phase 3Output
144
+ If you cannot find enough evidence to write either skill for example, no context files, no manifests,
145
+ and no recognisable build tooling — emit a single `note` signal with the reason and stop. Do not
146
+ invent skill content from training data.
127
147
 
128
- {{OUTPUT_CONTRACT_SECTION}}
148
+ Emit only the signals described above. No prose commentary, no markdown outside `signals.json`.
149
+ </output_contract>