clideck 1.30.5 → 1.30.7
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 +8 -2
- package/bin/clideck.js +7 -1
- package/clideck-ask-cli.js +110 -0
- package/config.js +3 -0
- package/package.json +1 -1
- package/public/js/app.js +3 -0
- package/public/js/creator.js +63 -31
- package/public/js/drag.js +1 -0
- package/server.js +17 -1
- package/session-ask.js +171 -0
- package/sessions.js +7 -1
- package/skills/research-experiment/SKILL.md +350 -163
- package/skills/research-experiment/SKILL.md.bak +224 -0
- package/skills/research-experiment/scripts/init-research-layout.mjs +184 -0
- package/transcript.js +5 -1
- package/utils.js +8 -2
- package/skills/research-experiment/agents/openai.yaml +0 -4
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research-experiment
|
|
3
|
+
description: Coordinate autonomous research experiments across multiple coding agents using isolated git worktrees. Use when a user wants the main agent to define a goal, constraints, acceptance criteria, and experiment boundaries, then dispatch Codex/Claude/Gemini or other agents to independently search for solutions without touching production code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Research Experiment
|
|
7
|
+
|
|
8
|
+
Use this skill to run parallel, autonomous experiments safely.
|
|
9
|
+
|
|
10
|
+
There are two roles:
|
|
11
|
+
|
|
12
|
+
- Main Agent: owns the research brief, workspace setup, researcher prompts, verification, and merge decision.
|
|
13
|
+
- Experiment Agent: owns independent exploration inside one assigned worktree and must not redefine the experiment.
|
|
14
|
+
|
|
15
|
+
If the user says "you are the main agent", follow the Main Agent Role. If the user says "you are an experiment agent" or "researcher agent", follow the Experiment Agent Role.
|
|
16
|
+
|
|
17
|
+
## Main Agent Role
|
|
18
|
+
|
|
19
|
+
The main agent defines the experiment and coordinates researchers. It must not let each researcher invent different goals or acceptance criteria.
|
|
20
|
+
|
|
21
|
+
## Main Agent Workflow
|
|
22
|
+
|
|
23
|
+
1. Convert the user request into an experiment brief:
|
|
24
|
+
- Goal: the outcome to achieve.
|
|
25
|
+
- Acceptance criteria: exact tests, benchmarks, or review gates.
|
|
26
|
+
- Hard constraints: what must not change.
|
|
27
|
+
- Quality bar: what counts as meaningful progress versus noise.
|
|
28
|
+
- Shared resources: ports, GPUs, model caches, services, datasets, credentials, or external APIs.
|
|
29
|
+
- Stop conditions: when researchers may quit.
|
|
30
|
+
|
|
31
|
+
2. Identify the production repository root:
|
|
32
|
+
- Use `git rev-parse --show-toplevel` when inside a git repo.
|
|
33
|
+
- If the project has nested repos, identify which repo owns the files under experiment.
|
|
34
|
+
- Do not assume the current working directory is the repo root.
|
|
35
|
+
|
|
36
|
+
3. Create per-researcher worktrees inside the project folder, not beside it:
|
|
37
|
+
- Prefer a project-local directory such as `<project>/.research-worktrees/<slug>-<n>`.
|
|
38
|
+
- Keep worktree directories inside the main project folder so agents do not need extra filesystem permissions.
|
|
39
|
+
- Do not create sibling worktrees such as `../project_research_1` unless the user explicitly asks.
|
|
40
|
+
- Never point a researcher at the production checkout for edits.
|
|
41
|
+
- Use unique branches, for example `research/<slug>-1`, `research/<slug>-2`.
|
|
42
|
+
|
|
43
|
+
4. Give every researcher the same goal and rules:
|
|
44
|
+
- Do not assign fixed technical roles unless the user explicitly asks.
|
|
45
|
+
- Let each researcher decide the approach and iterate independently.
|
|
46
|
+
- Include the exact worktree path, branch, allowed edit scope, forbidden files, verification commands, and report format.
|
|
47
|
+
- Save the canonical brief to the experiment folder before dispatching researchers.
|
|
48
|
+
|
|
49
|
+
5. Verify centrally:
|
|
50
|
+
- Researchers may run local checks in their worktree, but the main agent owns authoritative acceptance verification.
|
|
51
|
+
- If benchmarks contend for scarce resources, run final benchmarks sequentially from the main agent.
|
|
52
|
+
- Merge nothing unless it passes acceptance criteria and clears the quality bar.
|
|
53
|
+
|
|
54
|
+
## Experiment Folder
|
|
55
|
+
|
|
56
|
+
The main agent should create one experiment folder under the main project, for example:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
.research-worktrees/<experiment-slug>/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Inside it, create:
|
|
63
|
+
|
|
64
|
+
- `EXPERIMENT.md`: the canonical brief, baseline, quality gate, constraints, assignments, commands, and report format.
|
|
65
|
+
- `<slug>-experiment-1/`: worktree for researcher 1.
|
|
66
|
+
- `<slug>-experiment-2/`: worktree for researcher 2.
|
|
67
|
+
- `<slug>-experiment-3/`: worktree for researcher 3.
|
|
68
|
+
- `<slug>-experiment-1/LOG.md`: progress log for researcher 1.
|
|
69
|
+
- `<slug>-experiment-2/LOG.md`: progress log for researcher 2.
|
|
70
|
+
- `<slug>-experiment-3/LOG.md`: progress log for researcher 3.
|
|
71
|
+
|
|
72
|
+
Researcher prompts should tell agents to read `EXPERIMENT.md` first and then follow only their assigned workspace, branch, log file, and resource values.
|
|
73
|
+
|
|
74
|
+
The main agent may check each researcher log during the experiment to monitor progress without interrupting researchers. Researcher agents should append concise entries after each meaningful experiment loop:
|
|
75
|
+
|
|
76
|
+
- Hypothesis tried.
|
|
77
|
+
- Files changed.
|
|
78
|
+
- Command run.
|
|
79
|
+
- Result versus same-session baseline.
|
|
80
|
+
- Keep/reject decision.
|
|
81
|
+
- Current blocker, if any.
|
|
82
|
+
|
|
83
|
+
## Worktree Setup
|
|
84
|
+
|
|
85
|
+
Use project-local worktrees. The worktree directory must live under the main project folder:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
mkdir -p .research-worktrees
|
|
89
|
+
mkdir -p .research-worktrees/<experiment-slug>
|
|
90
|
+
git worktree add .research-worktrees/<experiment-slug>/<slug>-experiment-1 -b research/<slug>-1
|
|
91
|
+
git worktree add .research-worktrees/<experiment-slug>/<slug>-experiment-2 -b research/<slug>-2
|
|
92
|
+
git worktree add .research-worktrees/<experiment-slug>/<slug>-experiment-3 -b research/<slug>-3
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If a branch already exists, choose a new suffix. Do not delete or overwrite existing worktrees unless the user explicitly asks.
|
|
96
|
+
|
|
97
|
+
When the target files live in a nested repo, run the worktree commands from that nested repo root but still put the worktree folders under the main project folder. Example:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cd path/to/nested/repo
|
|
101
|
+
mkdir -p /absolute/path/to/main-project/.research-worktrees
|
|
102
|
+
mkdir -p /absolute/path/to/main-project/.research-worktrees/<experiment-slug>
|
|
103
|
+
git worktree add /absolute/path/to/main-project/.research-worktrees/<experiment-slug>/<slug>-experiment-1 -b research/<slug>-1
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Baseline And Quality Gate
|
|
107
|
+
|
|
108
|
+
Before changing code, each researcher must run the exact benchmark or check command once from their assigned worktree and record it as their same-session baseline.
|
|
109
|
+
|
|
110
|
+
Compare final results against:
|
|
111
|
+
|
|
112
|
+
- The user/main-agent supplied baseline.
|
|
113
|
+
- The researcher’s same-session baseline.
|
|
114
|
+
|
|
115
|
+
The main agent/user defines the quality gate for each experiment. Examples:
|
|
116
|
+
|
|
117
|
+
- Test suite must pass.
|
|
118
|
+
- Benchmark score must not regress.
|
|
119
|
+
- ASR must recover at least N words from generated TTS.
|
|
120
|
+
- Human listening check required.
|
|
121
|
+
|
|
122
|
+
Do not invent or weaken the quality gate. If the gate is unclear, ask the main agent before accepting a result.
|
|
123
|
+
|
|
124
|
+
## Experiment Agent Role
|
|
125
|
+
|
|
126
|
+
The experiment agent executes the fixed brief from the main agent. It uses this skill for discipline and workflow only.
|
|
127
|
+
|
|
128
|
+
Follow only your assigned researcher section from the experiment brief. Do not edit outside your assigned worktree.
|
|
129
|
+
Create any temporary files, profiling scripts, generated outputs, scratch notes, and helper artifacts inside your assigned worktree. Do not use `/tmp`, `/var/tmp`, home-directory scratch folders, or sibling project folders unless the brief explicitly allows it.
|
|
130
|
+
|
|
131
|
+
The experiment agent must not redefine:
|
|
132
|
+
|
|
133
|
+
- Goal.
|
|
134
|
+
- Constraints.
|
|
135
|
+
- Quality gate.
|
|
136
|
+
- Benchmark commands.
|
|
137
|
+
- Acceptance criteria.
|
|
138
|
+
- Assigned workspace or branch.
|
|
139
|
+
|
|
140
|
+
If any of those are missing or ambiguous, ask the main agent for clarification before accepting a result. Do not make up a weaker gate.
|
|
141
|
+
|
|
142
|
+
## Experiment Agent Autonomy
|
|
143
|
+
|
|
144
|
+
DO NOT STOP EXPERIMENTING UNLESS YOU ACHIEVED THE GOALS OR ABSOLUTELY NECESSARY.
|
|
145
|
+
|
|
146
|
+
- Do NOT ask the user if you should continue.
|
|
147
|
+
- The user may be away from the computer and expects the experiment to continue until you achieve the experiment goals, so keep working until the task is naturally complete.
|
|
148
|
+
- You are autonomous. If you are unsure how to proceed, re-read the skill, goals, context, think differently, try different innovative approaches, and continue.
|
|
149
|
+
- Stop only if something out of your control blocks you from continuing. Otherwise continue experimenting until goals are achieved or the useful paths are exhausted.
|
|
150
|
+
|
|
151
|
+
## Researcher Prompt Template
|
|
152
|
+
|
|
153
|
+
Include this block, or an equivalent adapted version, in every researcher prompt:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
You are an autonomous research agent for this experiment.
|
|
157
|
+
|
|
158
|
+
Goal:
|
|
159
|
+
<goal>
|
|
160
|
+
|
|
161
|
+
Experiment rules and boundaries:
|
|
162
|
+
<rules>
|
|
163
|
+
|
|
164
|
+
Assigned workspace:
|
|
165
|
+
<absolute path to your worktree>
|
|
166
|
+
|
|
167
|
+
Canonical experiment brief:
|
|
168
|
+
<absolute path to EXPERIMENT.md>
|
|
169
|
+
|
|
170
|
+
Assigned experiment log:
|
|
171
|
+
<absolute path to your LOG.md>
|
|
172
|
+
|
|
173
|
+
You must work only inside your assigned worktree unless the brief explicitly allows another path. Do not edit, overwrite, or revert files in the production checkout. Do not change benchmark scoring, test fixtures, or acceptance criteria unless the brief explicitly asks for that.
|
|
174
|
+
Read the canonical experiment brief before making changes. Follow only your assigned researcher section. Do not redefine the goal, constraints, quality gate, benchmark commands, acceptance criteria, workspace, branch, port, log path, or resource assignments. Do not edit outside your assigned worktree.
|
|
175
|
+
If you need temp folders, profiling scripts, scratch files, benchmark outputs, or helper artifacts, create them inside your assigned worktree. Do not use `/tmp`, `/var/tmp`, home-directory scratch folders, or sibling project folders unless the brief explicitly allows it.
|
|
176
|
+
|
|
177
|
+
DO NOT STOP EXPERIMENTING UNLESS YOU ACHIEVED THE GOALS OR ABSOLUTELY NECESSARY.
|
|
178
|
+
- Do NOT ask the user if you should continue.
|
|
179
|
+
- The user may be away from the computer and expects the experiment to continue until you achieve the experiment goals, so keep working until the task is naturally complete.
|
|
180
|
+
- You are autonomous. If you are unsure how to proceed, re-read the skill, goals, context, think differently, try different innovative approaches, and continue.
|
|
181
|
+
- Stop only if something out of your control blocks you from continuing. Otherwise continue experimenting until goals are achieved or useful paths are exhausted.
|
|
182
|
+
|
|
183
|
+
Loop:
|
|
184
|
+
1. Inspect the code and constraints.
|
|
185
|
+
2. Form hypotheses.
|
|
186
|
+
3. Try a small, explainable experiment.
|
|
187
|
+
4. Run relevant verification.
|
|
188
|
+
5. Keep, revise, or reject the attempt.
|
|
189
|
+
6. Repeat until the goal is achieved, useful paths are exhausted, or an external blocker prevents progress.
|
|
190
|
+
|
|
191
|
+
Report format:
|
|
192
|
+
- Worktree path and branch.
|
|
193
|
+
- Changed files.
|
|
194
|
+
- Commands run and exact relevant output.
|
|
195
|
+
- Results against acceptance criteria.
|
|
196
|
+
- Failed attempts and why they were rejected.
|
|
197
|
+
- Whether you recommend merging the patch.
|
|
198
|
+
- Any cleanup needed: running servers, ports, PIDs, temp files.
|
|
199
|
+
|
|
200
|
+
Also append concise progress entries to your assigned experiment log after each meaningful experiment loop.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Shared Resource Rules
|
|
204
|
+
|
|
205
|
+
For resources that can contaminate results or conflict across agents:
|
|
206
|
+
|
|
207
|
+
- Assign unique ports, output directories, cache directories, and branch names.
|
|
208
|
+
- Do not run final GPU/MPS benchmarks concurrently across researchers.
|
|
209
|
+
- Prefer researcher-local smoke tests and main-agent final benchmarks.
|
|
210
|
+
- Require researchers to stop servers they started, or report any still-running process clearly.
|
|
211
|
+
|
|
212
|
+
## Merge Rules
|
|
213
|
+
|
|
214
|
+
The main agent must review researcher diffs before applying them to production.
|
|
215
|
+
|
|
216
|
+
Reject or keep separate any patch that:
|
|
217
|
+
|
|
218
|
+
- Touches production checkout files.
|
|
219
|
+
- Changes tests, benchmarks, fixtures, sample inputs, or scoring without permission.
|
|
220
|
+
- Passes only because the acceptance criteria were weakened.
|
|
221
|
+
- Produces only noisy or marginal improvement below the declared quality bar.
|
|
222
|
+
- Leaves unexplained background processes or shared state.
|
|
223
|
+
|
|
224
|
+
If a researcher accidentally edits the production checkout, preserve pre-existing user changes and move or recreate the experiment in an isolated worktree before continuing.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { mkdirSync, writeFileSync, existsSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
|
|
6
|
+
function usage() {
|
|
7
|
+
console.error('Usage: node init-research-layout.mjs <experiment_dir> [researcher_count] [mode]');
|
|
8
|
+
console.error(' mode: code | knowledge');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const [, , experimentDirArg, researcherCountArg = '3', modeArg = 'knowledge'] = process.argv;
|
|
13
|
+
|
|
14
|
+
if (!experimentDirArg) usage();
|
|
15
|
+
|
|
16
|
+
const researcherCount = Number.parseInt(researcherCountArg, 10);
|
|
17
|
+
const mode = String(modeArg).toLowerCase();
|
|
18
|
+
|
|
19
|
+
if (!Number.isInteger(researcherCount) || researcherCount < 1 || researcherCount > 20) {
|
|
20
|
+
console.error('researcher_count must be an integer between 1 and 20');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!['code', 'knowledge'].includes(mode)) {
|
|
25
|
+
console.error('mode must be "code" or "knowledge"');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const experimentDir = resolve(experimentDirArg);
|
|
30
|
+
const defaultThinkingStyles = [
|
|
31
|
+
'first-principles',
|
|
32
|
+
'evidence-first',
|
|
33
|
+
'systems-level',
|
|
34
|
+
'contrarian',
|
|
35
|
+
'creative/wildcard',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
function ensureDir(dir) {
|
|
39
|
+
mkdirSync(dir, { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function writeIfMissing(path, content) {
|
|
43
|
+
ensureDir(dirname(path));
|
|
44
|
+
if (!existsSync(path)) writeFileSync(path, content, 'utf8');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function fileHeader(title) {
|
|
48
|
+
return `# ${title}\n\n`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function thinkingStyleFor(index) {
|
|
52
|
+
return defaultThinkingStyles[(index - 1) % defaultThinkingStyles.length];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function promptTemplate(index, thinkingStyle) {
|
|
56
|
+
return `${fileHeader(`Researcher ${index} Prompt`)}## Goal
|
|
57
|
+
|
|
58
|
+
## Decision Supported
|
|
59
|
+
|
|
60
|
+
## Assigned Workspace
|
|
61
|
+
|
|
62
|
+
Use an absolute path here when researchers will be launched manually in separate sessions.
|
|
63
|
+
|
|
64
|
+
## Canonical Brief
|
|
65
|
+
../EXPERIMENT.md
|
|
66
|
+
|
|
67
|
+
## Log File
|
|
68
|
+
./LOG.md
|
|
69
|
+
|
|
70
|
+
## Findings File
|
|
71
|
+
./FINDINGS.md
|
|
72
|
+
|
|
73
|
+
## Ideas File
|
|
74
|
+
./IDEAS.md
|
|
75
|
+
|
|
76
|
+
## Allowed Tools And Sources
|
|
77
|
+
|
|
78
|
+
## Forbidden Actions
|
|
79
|
+
|
|
80
|
+
## Evidence Standard
|
|
81
|
+
|
|
82
|
+
## Stop Conditions
|
|
83
|
+
|
|
84
|
+
## Thinking Style
|
|
85
|
+
${thinkingStyle}
|
|
86
|
+
|
|
87
|
+
Use this thinking style to widen exploration, not to force a predetermined conclusion.
|
|
88
|
+
|
|
89
|
+
## Researcher Operating Rules
|
|
90
|
+
|
|
91
|
+
- Work independently.
|
|
92
|
+
- Do not ask "should I continue?"
|
|
93
|
+
- Keep working until you reach a credible conclusion or a real blocker.
|
|
94
|
+
- Do not redefine the goal, evidence standard, constraints, or assigned workspace.
|
|
95
|
+
- Do not read other researchers' interim work unless the manager explicitly allows collaboration.
|
|
96
|
+
- Start with a question-generation round before choosing your first approach.
|
|
97
|
+
- Explore multiple materially different approaches when the task is open-ended.
|
|
98
|
+
- Explore at least one non-obvious or unconventional path.
|
|
99
|
+
- Separate facts, evidence, and hypotheses clearly.
|
|
100
|
+
- Record meaningful progress in \`LOG.md\`.
|
|
101
|
+
- Record promising deferred ideas in \`IDEAS.md\`.
|
|
102
|
+
- Write your final conclusion in \`FINDINGS.md\`.
|
|
103
|
+
|
|
104
|
+
## Anti-Bias Rules
|
|
105
|
+
|
|
106
|
+
- Do not assume the manager knows the answer.
|
|
107
|
+
- Do not anchor on the most obvious solution too early.
|
|
108
|
+
- Use the problem definition and constraints as your guide, not implied preferences.
|
|
109
|
+
- Treat your assigned thinking style as a way to widen search, not to distort evidence.
|
|
110
|
+
|
|
111
|
+
## Question Round
|
|
112
|
+
|
|
113
|
+
Before taking your first action, generate a short list of high-value questions.
|
|
114
|
+
|
|
115
|
+
Use the questions to widen the search space before committing to an approach.
|
|
116
|
+
|
|
117
|
+
Also generate a new short question round after major failed or inconclusive attempts.
|
|
118
|
+
|
|
119
|
+
Example questions:
|
|
120
|
+
|
|
121
|
+
- what is actually expensive here?
|
|
122
|
+
- what is actually causing the token bloat?
|
|
123
|
+
- what is the current hard limit?
|
|
124
|
+
- what happens if we remove this step entirely?
|
|
125
|
+
- what happens if we compress, batch, defer, cache, or approximate it?
|
|
126
|
+
- what quality signal might break if we optimize too aggressively?
|
|
127
|
+
- what is the theoretical lower bound?
|
|
128
|
+
- what assumptions are probably wrong?
|
|
129
|
+
- what would a contrarian approach try first?
|
|
130
|
+
- if the obvious path fails, what structurally different path is left?
|
|
131
|
+
|
|
132
|
+
## Working Loop
|
|
133
|
+
|
|
134
|
+
1. Re-read the goal, constraints, and evidence standard.
|
|
135
|
+
2. Inspect the workspace and relevant context.
|
|
136
|
+
3. Generate high-value questions about limits, assumptions, and overlooked paths.
|
|
137
|
+
4. Form multiple candidate approaches from those questions.
|
|
138
|
+
5. Choose one explainable experiment or line of inquiry.
|
|
139
|
+
6. Execute it and gather evidence.
|
|
140
|
+
7. Record what happened in \`LOG.md\`.
|
|
141
|
+
8. Keep, revise, or reject the approach.
|
|
142
|
+
9. Re-question after major failures or surprises.
|
|
143
|
+
10. Repeat until success, exhaustion, or a true blocker.
|
|
144
|
+
|
|
145
|
+
## Final Output Requirements
|
|
146
|
+
|
|
147
|
+
Before stopping, complete \`FINDINGS.md\` with:
|
|
148
|
+
|
|
149
|
+
- Executive summary
|
|
150
|
+
- Recommendation
|
|
151
|
+
- Confidence level
|
|
152
|
+
- Approaches tried
|
|
153
|
+
- Evidence collected
|
|
154
|
+
- Failed or rejected paths
|
|
155
|
+
- Remaining uncertainties
|
|
156
|
+
- Suggested next steps
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
ensureDir(experimentDir);
|
|
161
|
+
|
|
162
|
+
writeIfMissing(join(experimentDir, 'EXPERIMENT.md'), `${fileHeader('Experiment Brief')}## Objective\n\n## Decision Supported\n\n## Mode\n${mode}\n\n## Success Criteria\n\n## Evidence Standard\n\n## Constraints\n\n## Allowed Tools And Sources\n\n## Domain Context\n\n## Shared Resources\n\n## Stop Conditions\n\n## Researcher Independence Rules\n`);
|
|
163
|
+
|
|
164
|
+
writeIfMissing(join(experimentDir, 'MANAGER.md'), `${fileHeader('Manager Notes')}## Intake Checklist\n\n## Open Questions\n\n## Round Control\n\n## Researcher Assignments\n`);
|
|
165
|
+
|
|
166
|
+
writeIfMissing(join(experimentDir, 'SYNTHESIS.md'), `${fileHeader('Synthesis')}## Experiment Summary\n\n## Convergences\n\n## Divergences\n\n## Ranked Recommendations\n\n## Follow-Up Work\n`);
|
|
167
|
+
|
|
168
|
+
for (let i = 1; i <= researcherCount; i += 1) {
|
|
169
|
+
const researcherDir = join(experimentDir, `researcher-${i}`);
|
|
170
|
+
const thinkingStyle = thinkingStyleFor(i);
|
|
171
|
+
ensureDir(researcherDir);
|
|
172
|
+
|
|
173
|
+
writeIfMissing(join(researcherDir, 'PROMPT.md'), promptTemplate(i, thinkingStyle));
|
|
174
|
+
|
|
175
|
+
writeIfMissing(join(researcherDir, 'LOG.md'), `${fileHeader(`Researcher ${i} Log`)}- Start here.\n`);
|
|
176
|
+
writeIfMissing(join(researcherDir, 'FINDINGS.md'), `${fileHeader(`Researcher ${i} Findings`)}## Executive Summary\n\n## Recommendation\n\n## Confidence Level\n\n## Approaches Tried\n\n## Evidence Collected\n\n## Failed Or Rejected Paths\n\n## Remaining Uncertainties\n\n## Suggested Next Steps\n`);
|
|
177
|
+
writeIfMissing(join(researcherDir, 'IDEAS.md'), `${fileHeader(`Researcher ${i} Ideas`)}- Add promising deferred ideas here.\n`);
|
|
178
|
+
writeIfMissing(join(researcherDir, 'WORKSPACE.md'), `${fileHeader(`Researcher ${i} Workspace`)}Mode: ${mode}\n\nUse this file to record the assigned workspace path and any workspace-specific rules.\n`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
console.log(`Created research layout at ${experimentDir}`);
|
|
182
|
+
console.log(`Researchers: ${researcherCount}`);
|
|
183
|
+
console.log(`Mode: ${mode}`);
|
|
184
|
+
console.log(`Thinking styles: ${Array.from({ length: researcherCount }, (_, idx) => `r${idx + 1}=${thinkingStyleFor(idx + 1)}`).join(', ')}`);
|
package/transcript.js
CHANGED
|
@@ -199,6 +199,10 @@ function readEntries(id) {
|
|
|
199
199
|
} catch { return []; }
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
function getEntriesSince(id, ts) {
|
|
203
|
+
return readEntries(id).filter(e => Number(e.ts || 0) >= ts);
|
|
204
|
+
}
|
|
205
|
+
|
|
202
206
|
function foldTurns(entries, n, order) {
|
|
203
207
|
const turns = [];
|
|
204
208
|
const fromStart = order === 'start';
|
|
@@ -276,4 +280,4 @@ function detectMenu(lines, presetId) {
|
|
|
276
280
|
return choices.length ? choices : null;
|
|
277
281
|
}
|
|
278
282
|
|
|
279
|
-
module.exports = { init, trackInput, recordInjectedInput, trackOutput, updateAgentCandidate, commitAgentCandidate, clearAgentCandidate, parseTurnsFromLines, getTurns, getCache, getReplayText, clear, setPrefix, setFinalizeOnIdle, detectMenu };
|
|
283
|
+
module.exports = { init, trackInput, recordInjectedInput, trackOutput, updateAgentCandidate, commitAgentCandidate, clearAgentCandidate, parseTurnsFromLines, getTurns, getEntriesSince, getCache, getReplayText, clear, setPrefix, setFinalizeOnIdle, detectMenu };
|
package/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { chmodSync, statSync, readdirSync } = require('fs');
|
|
1
|
+
const { chmodSync, existsSync, statSync, readdirSync } = require('fs');
|
|
2
2
|
const { dirname, join } = require('path');
|
|
3
3
|
|
|
4
4
|
function ensurePtyHelper() {
|
|
@@ -55,7 +55,13 @@ function listDirs(path, showHidden) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
function resolveDefaultShell() {
|
|
59
|
+
if (process.platform === 'win32') return process.env.COMSPEC || 'cmd.exe';
|
|
60
|
+
const candidates = [process.env.SHELL, '/bin/zsh', '/bin/bash', '/bin/sh'].filter(Boolean);
|
|
61
|
+
return candidates.find(shell => existsSync(shell)) || '/bin/sh';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const defaultShell = resolveDefaultShell();
|
|
59
65
|
|
|
60
66
|
function binName(command) {
|
|
61
67
|
const m = command.match(/^(['"])(.*?)\1/);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Research Experiment"
|
|
3
|
-
short_description: "Run parallel autonomous experiments in isolated git worktrees."
|
|
4
|
-
default_prompt: "Use this skill to prepare and coordinate autonomous research agents that experiment in isolated git worktrees without touching production code."
|