@guilhermednobre/agent-kit 0.2.0 → 0.3.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/CHANGELOG.md +49 -0
- package/README.md +102 -76
- package/bin/cli.js +78 -39
- package/package.json +11 -4
- package/src/cli/tools.js +51 -0
- package/src/cli/wf.js +400 -0
- package/src/core/briefing.js +188 -0
- package/src/core/config.js +321 -0
- package/src/core/dag.js +103 -0
- package/src/core/engine.js +505 -0
- package/src/core/policy.js +145 -0
- package/src/core/report.js +104 -0
- package/src/core/states.js +59 -0
- package/src/core/store.js +60 -0
- package/src/core/verify.js +54 -0
- package/src/detect.js +6 -0
- package/src/generate.js +55 -0
- package/src/install.js +22 -14
- package/src/render.js +5 -7
- package/src/runtimes/index.js +24 -0
- package/src/runtimes/orca.js +61 -0
- package/src/runtimes/t3.js +87 -0
- package/src/trackers/index.js +34 -0
- package/src/trackers/linear-t3.js +138 -0
- package/src/trackers/linear.js +209 -0
- package/templates/AGENTS.md +17 -6
- package/templates/CLAUDE.md +184 -159
- package/templates/agent-kit/hooks/pretooluse.mjs +53 -0
- package/templates/agent-kit/hooks/session-context.mjs +41 -0
- package/templates/agent-kit/runtime/orca.md +68 -0
- package/templates/agent-kit/runtime/t3.md +109 -0
- package/templates/claude/commands/analisar-consistencia.md +9 -0
- package/templates/claude/commands/configurar-worker.md +93 -62
- package/templates/claude/commands/criar-prd.md +15 -0
- package/templates/claude/commands/criar-tasks.md +31 -0
- package/templates/claude/commands/criar-techspec.md +11 -0
- package/templates/claude/commands/executar-bugfix.md +8 -8
- package/templates/claude/commands/executar-qa.md +11 -13
- package/templates/claude/commands/executar-release.md +20 -0
- package/templates/claude/commands/executar-review.md +37 -31
- package/templates/claude/commands/executar-task.md +13 -22
- package/templates/claude/commands/executar-workflow.md +101 -0
- package/templates/claude/commands/fechar-ciclo.md +9 -0
- package/templates/claude/commands/replanejar-workflow.md +32 -0
- package/templates/claude/commands/retomar-workflow.md +30 -0
- package/templates/claude/commands/status-workflow.md +19 -0
- package/templates/claude/settings.json +25 -0
- package/templates/claude/templates/plan-template.json +33 -0
- package/templates/claude/templates/task-template.md +5 -5
- package/templates/claude/templates/worker-brief-template.md +8 -6
- package/templates/docs/agents/worker.md +64 -45
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Linear through T3 Code's issue tools (create_issue, set_issue_state, comment_on_issue).
|
|
2
|
+
// No API key: like the runtime adapters, it prints the calls; the coordinator makes them, then
|
|
3
|
+
// binds the returned issue keys (`wf tracker-bind`) and acknowledges events (`wf sync --ack`).
|
|
4
|
+
import { taskDescription } from "./linear.js";
|
|
5
|
+
|
|
6
|
+
export const PARENT = "_parent";
|
|
7
|
+
|
|
8
|
+
const DEFAULT_STATE_NAMES = {
|
|
9
|
+
pending: "Todo",
|
|
10
|
+
ready: "Todo",
|
|
11
|
+
running: "In Progress",
|
|
12
|
+
testing: "In Progress",
|
|
13
|
+
review: "In Progress",
|
|
14
|
+
blocked: "In Progress",
|
|
15
|
+
failed: "In Progress",
|
|
16
|
+
completed: "Done",
|
|
17
|
+
cancelled: "Canceled",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function linearT3Tracker({ settings }) {
|
|
21
|
+
const names = { ...DEFAULT_STATE_NAMES, ...(settings.stateNames || {}) };
|
|
22
|
+
const labels = settings.labels?.length ? { labels: settings.labels } : {};
|
|
23
|
+
|
|
24
|
+
function createOperations(run) {
|
|
25
|
+
const operations = [];
|
|
26
|
+
if (!run.tracker?.parent) {
|
|
27
|
+
operations.push({
|
|
28
|
+
bind: PARENT,
|
|
29
|
+
tool: "create_issue",
|
|
30
|
+
args: { title: `[${run.id}] ${run.objective || "agent-kit run"}`, body: parentBody(run), ...labels },
|
|
31
|
+
then: `agent-kit wf tracker-bind ${run.id} ${PARENT} --key <key> --url <url>`,
|
|
32
|
+
});
|
|
33
|
+
return operations;
|
|
34
|
+
}
|
|
35
|
+
for (const id of run.order) {
|
|
36
|
+
const task = run.tasks[id];
|
|
37
|
+
if (task.tracker?.key) continue;
|
|
38
|
+
operations.push({
|
|
39
|
+
bind: id,
|
|
40
|
+
tool: "create_issue",
|
|
41
|
+
args: { title: `[${run.id}] ${task.id} ${task.title}`, body: taskBody(run, task), ...labels },
|
|
42
|
+
then: `agent-kit wf tracker-bind ${run.id} ${task.id} --key <key> --url <url>`,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return operations;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
kind: "linear",
|
|
50
|
+
via: "t3",
|
|
51
|
+
deferred: true,
|
|
52
|
+
|
|
53
|
+
async publishPlan(run) {
|
|
54
|
+
return { deferred: true, operations: createOperations(run) };
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
async sync(run) {
|
|
58
|
+
const create = createOperations(run);
|
|
59
|
+
if (create.length) {
|
|
60
|
+
return { deferred: true, operations: create, note: "Create and bind the issues first, then run wf sync again" };
|
|
61
|
+
}
|
|
62
|
+
const pending = run.events.map((event, index) => ({ event, index })).filter(({ event }) => !event.synced);
|
|
63
|
+
const byIssue = new Map();
|
|
64
|
+
for (const { event, index } of pending) {
|
|
65
|
+
const key = event.scope === "workflow" ? run.tracker.parent.key : run.tasks[event.id]?.tracker?.key;
|
|
66
|
+
if (!key) continue;
|
|
67
|
+
const entry = byIssue.get(key) || { key, lines: [], state: null, ids: [] };
|
|
68
|
+
entry.lines.push(line(event));
|
|
69
|
+
if (event.scope === "task") entry.state = names[event.to] || null;
|
|
70
|
+
if (event.scope === "workflow" && ["completed", "cancelled"].includes(event.to)) entry.state = names[event.to];
|
|
71
|
+
entry.ids.push(index);
|
|
72
|
+
byIssue.set(key, entry);
|
|
73
|
+
}
|
|
74
|
+
const operations = [];
|
|
75
|
+
const ack = pending.map(({ index }) => index);
|
|
76
|
+
for (const entry of byIssue.values()) {
|
|
77
|
+
if (entry.state) operations.push({ tool: "set_issue_state", args: { key: entry.key, state: entry.state } });
|
|
78
|
+
operations.push({ tool: "comment_on_issue", args: { key: entry.key, body: entry.lines.join("\n") } });
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
deferred: true,
|
|
82
|
+
operations,
|
|
83
|
+
ack,
|
|
84
|
+
then: ack.length ? `agent-kit wf sync ${run.id} --ack ${ack.join(",")}` : null,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
async importPlan() {
|
|
89
|
+
throw new Error('Importing a plan needs tracker.linear.via "api" (an API key); with T3, resume from .agent-kit/runs/<run>/');
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function bindIssue(run, target, { key, url }) {
|
|
95
|
+
if (target === PARENT) {
|
|
96
|
+
run.tracker = { kind: "linear", via: "t3", ...(run.tracker || {}), parent: { key, identifier: key, url } };
|
|
97
|
+
return run.tracker.parent;
|
|
98
|
+
}
|
|
99
|
+
const task = run.tasks[target];
|
|
100
|
+
if (!task) throw new Error(`Unknown task "${target}"`);
|
|
101
|
+
task.tracker = { key, identifier: key, url };
|
|
102
|
+
return task.tracker;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function acknowledge(run, ids) {
|
|
106
|
+
let count = 0;
|
|
107
|
+
for (const id of ids) {
|
|
108
|
+
const event = run.events[id];
|
|
109
|
+
if (event && !event.synced) {
|
|
110
|
+
event.synced = true;
|
|
111
|
+
count += 1;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return count;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function parentBody(run) {
|
|
118
|
+
return [
|
|
119
|
+
`Workflow \`${run.id}\` gerenciado pelo agent-kit.`,
|
|
120
|
+
"",
|
|
121
|
+
"Tarefas:",
|
|
122
|
+
...run.order.map((id) => `- ${id} ${run.tasks[id].title}`),
|
|
123
|
+
].join("\n");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function taskBody(run, task) {
|
|
127
|
+
const deps = task.dependsOn.map((id) => run.tasks[id]?.tracker?.key || id);
|
|
128
|
+
const header = [
|
|
129
|
+
run.tracker?.parent?.key ? `Parte de ${run.tracker.parent.key}.` : null,
|
|
130
|
+
deps.length ? `Depende de: ${deps.join(", ")}.` : null,
|
|
131
|
+
].filter(Boolean);
|
|
132
|
+
return [...header, ...(header.length ? [""] : []), taskDescription(run, task)].join("\n");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function line(event) {
|
|
136
|
+
const head = event.scope === "workflow" ? "workflow" : event.scope === "attempt" ? "" : `${event.from || "—"} → ${event.to}`;
|
|
137
|
+
return `agent-kit · ${head}${head && event.reason ? " — " : ""}${event.reason || ""}`;
|
|
138
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Linear tracker over the public GraphQL API (verified against linear/linear packages/sdk schema.graphql).
|
|
2
|
+
// Personal API keys go in the Authorization header without "Bearer".
|
|
3
|
+
|
|
4
|
+
export const LINEAR_ENDPOINT = "https://api.linear.app/graphql";
|
|
5
|
+
export const TASK_FENCE = "agent-kit-task";
|
|
6
|
+
const TASK_BLOCK = new RegExp("```" + TASK_FENCE + "\\s*\\n([\\s\\S]*?)\\n```");
|
|
7
|
+
const SPEC_FIELDS = ["role", "profile", "tags", "dependsOn", "files", "doc", "context", "acceptance", "validation"];
|
|
8
|
+
|
|
9
|
+
export function createLinearClient({ apiKey, fetchImpl = globalThis.fetch, endpoint = LINEAR_ENDPOINT }) {
|
|
10
|
+
if (!apiKey) throw new Error("Linear API key is missing (set the variable named in tracker.linear.apiKeyEnv)");
|
|
11
|
+
return async function gql(query, variables = {}) {
|
|
12
|
+
const response = await fetchImpl(endpoint, {
|
|
13
|
+
method: "POST",
|
|
14
|
+
headers: { "Content-Type": "application/json", Authorization: apiKey },
|
|
15
|
+
body: JSON.stringify({ query, variables }),
|
|
16
|
+
});
|
|
17
|
+
const payload = await response.json().catch(() => ({}));
|
|
18
|
+
if (!response.ok || payload.errors?.length) {
|
|
19
|
+
const message = payload.errors?.map((error) => error.message).join("; ") || `HTTP ${response.status}`;
|
|
20
|
+
throw new Error(`Linear API error: ${message}`);
|
|
21
|
+
}
|
|
22
|
+
return payload.data;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Q_TEAM = `query Team($key: String!) { teams(filter: { key: { eq: $key } }) { nodes { id key name } } }`;
|
|
27
|
+
const Q_STATES = `query States($teamId: ID!) { workflowStates(first: 100, filter: { team: { id: { eq: $teamId } } }) { nodes { id name type } } }`;
|
|
28
|
+
const M_CREATE = `mutation Create($input: IssueCreateInput!) { issueCreate(input: $input) { success issue { id identifier url } } }`;
|
|
29
|
+
const M_UPDATE = `mutation Update($id: String!, $input: IssueUpdateInput!) { issueUpdate(id: $id, input: $input) { success } }`;
|
|
30
|
+
const M_RELATION = `mutation Relate($input: IssueRelationCreateInput!) { issueRelationCreate(input: $input) { success } }`;
|
|
31
|
+
const M_COMMENT = `mutation Comment($input: CommentCreateInput!) { commentCreate(input: $input) { success } }`;
|
|
32
|
+
const Q_LABELS = `query Labels($teamId: ID!) { issueLabels(first: 250, filter: { team: { id: { eq: $teamId } } }) { nodes { id name } } }`;
|
|
33
|
+
const Q_PARENT = `query Parent($id: String!) {
|
|
34
|
+
issue(id: $id) {
|
|
35
|
+
id identifier title url
|
|
36
|
+
children(first: 250) { nodes {
|
|
37
|
+
id identifier title description url state { name type }
|
|
38
|
+
inverseRelations(first: 100) { nodes { type issue { identifier } } }
|
|
39
|
+
} }
|
|
40
|
+
}
|
|
41
|
+
}`;
|
|
42
|
+
|
|
43
|
+
export function linearTracker({ settings, gql }) {
|
|
44
|
+
let cache = null;
|
|
45
|
+
|
|
46
|
+
async function team() {
|
|
47
|
+
if (cache) return cache;
|
|
48
|
+
const data = await gql(Q_TEAM, { key: settings.teamKey });
|
|
49
|
+
const found = data.teams.nodes[0];
|
|
50
|
+
if (!found) throw new Error(`Linear team with key "${settings.teamKey}" not found`);
|
|
51
|
+
const states = (await gql(Q_STATES, { teamId: found.id })).workflowStates.nodes;
|
|
52
|
+
let labelIds = [];
|
|
53
|
+
if (settings.labels?.length) {
|
|
54
|
+
const labels = (await gql(Q_LABELS, { teamId: found.id })).issueLabels.nodes;
|
|
55
|
+
labelIds = labels.filter((label) => settings.labels.includes(label.name)).map((label) => label.id);
|
|
56
|
+
}
|
|
57
|
+
cache = { ...found, states, labelIds };
|
|
58
|
+
return cache;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function stateId(states, taskState) {
|
|
62
|
+
const wanted = settings.stateMap?.[taskState];
|
|
63
|
+
if (!wanted) return null;
|
|
64
|
+
const lower = String(wanted).toLowerCase();
|
|
65
|
+
const byName = states.find((state) => state.name.toLowerCase() === lower);
|
|
66
|
+
return (byName || states.find((state) => state.type === lower))?.id || null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function create(input) {
|
|
70
|
+
const result = await gql(M_CREATE, { input });
|
|
71
|
+
if (!result.issueCreate.success) throw new Error(`Linear refused to create "${input.title}"`);
|
|
72
|
+
return result.issueCreate.issue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
kind: "linear",
|
|
77
|
+
|
|
78
|
+
async publishPlan(run) {
|
|
79
|
+
const info = await team();
|
|
80
|
+
const base = { teamId: info.id, ...(settings.projectId ? { projectId: settings.projectId } : {}), ...(info.labelIds.length ? { labelIds: info.labelIds } : {}) };
|
|
81
|
+
if (!run.tracker?.parent) {
|
|
82
|
+
const parent = await create({ ...base, title: run.objective || `agent-kit run ${run.id}`, description: parentDescription(run) });
|
|
83
|
+
run.tracker = { kind: "linear", teamKey: info.key, parent };
|
|
84
|
+
}
|
|
85
|
+
const created = [];
|
|
86
|
+
for (const id of run.order) {
|
|
87
|
+
const task = run.tasks[id];
|
|
88
|
+
if (task.tracker?.id) continue;
|
|
89
|
+
task.tracker = await create({
|
|
90
|
+
...base,
|
|
91
|
+
title: `${task.id} ${task.title}`,
|
|
92
|
+
parentId: run.tracker.parent.id,
|
|
93
|
+
description: taskDescription(run, task),
|
|
94
|
+
stateId: stateId(info.states, task.state) || undefined,
|
|
95
|
+
});
|
|
96
|
+
created.push(task.id);
|
|
97
|
+
}
|
|
98
|
+
for (const id of created) {
|
|
99
|
+
for (const dep of run.tasks[id].dependsOn) {
|
|
100
|
+
await gql(M_RELATION, { input: { issueId: run.tasks[dep].tracker.id, relatedIssueId: run.tasks[id].tracker.id, type: "blocks" } });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { created, parent: run.tracker.parent };
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
async sync(run) {
|
|
107
|
+
if (!run.tracker?.parent) return { synced: 0, pending: run.events.filter((event) => !event.synced).length, skipped: "plan not published" };
|
|
108
|
+
const info = await team();
|
|
109
|
+
let synced = 0;
|
|
110
|
+
for (const event of run.events.filter((item) => !item.synced)) {
|
|
111
|
+
const issueId = event.scope === "workflow" ? run.tracker.parent.id : run.tasks[event.id]?.tracker?.id;
|
|
112
|
+
if (issueId) {
|
|
113
|
+
if (event.scope === "task") {
|
|
114
|
+
const target = stateId(info.states, event.to);
|
|
115
|
+
if (target) await gql(M_UPDATE, { id: issueId, input: { stateId: target } });
|
|
116
|
+
}
|
|
117
|
+
await gql(M_COMMENT, { input: { issueId, body: eventComment(event) } });
|
|
118
|
+
}
|
|
119
|
+
event.synced = true;
|
|
120
|
+
synced += 1;
|
|
121
|
+
}
|
|
122
|
+
return { synced, pending: 0 };
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
async importPlan(identifier) {
|
|
126
|
+
const issue = (await gql(Q_PARENT, { id: identifier })).issue;
|
|
127
|
+
const tasks = [];
|
|
128
|
+
const completed = [];
|
|
129
|
+
const skipped = [];
|
|
130
|
+
const byIdentifier = new Map();
|
|
131
|
+
for (const child of issue.children.nodes) {
|
|
132
|
+
const spec = parseTaskBlock(child.description);
|
|
133
|
+
if (!spec) {
|
|
134
|
+
skipped.push(child.identifier);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
byIdentifier.set(child.identifier, spec.id);
|
|
138
|
+
tasks.push({ child, spec });
|
|
139
|
+
}
|
|
140
|
+
const plan = {
|
|
141
|
+
objective: issue.title,
|
|
142
|
+
tracker: { kind: "linear", parent: { id: issue.id, identifier: issue.identifier, url: issue.url } },
|
|
143
|
+
tasks: tasks.map(({ child, spec }) => {
|
|
144
|
+
const blockers = child.inverseRelations.nodes
|
|
145
|
+
.filter((relation) => relation.type === "blocks" && byIdentifier.has(relation.issue.identifier))
|
|
146
|
+
.map((relation) => byIdentifier.get(relation.issue.identifier));
|
|
147
|
+
if (child.state?.type === "completed") completed.push(spec.id);
|
|
148
|
+
return {
|
|
149
|
+
...spec,
|
|
150
|
+
title: spec.title || child.title.replace(new RegExp(`^${escape(spec.id)}\\s+`), ""),
|
|
151
|
+
dependsOn: [...new Set([...(spec.dependsOn || []), ...blockers])],
|
|
152
|
+
tracker: { id: child.id, identifier: child.identifier, url: child.url },
|
|
153
|
+
};
|
|
154
|
+
}),
|
|
155
|
+
};
|
|
156
|
+
return { plan, completed, skipped };
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function escape(text) {
|
|
162
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function parseTaskBlock(description) {
|
|
166
|
+
const match = TASK_BLOCK.exec(String(description || ""));
|
|
167
|
+
if (!match) return null;
|
|
168
|
+
try {
|
|
169
|
+
const data = JSON.parse(match[1]);
|
|
170
|
+
return data && typeof data.id === "string" ? data : null;
|
|
171
|
+
} catch {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function parentDescription(run) {
|
|
177
|
+
return [
|
|
178
|
+
`Workflow \`${run.id}\` gerenciado pelo agent-kit.`,
|
|
179
|
+
"",
|
|
180
|
+
"As sub-issues são as tarefas; relações *blocks* são as dependências.",
|
|
181
|
+
"O estado de cada sub-issue é atualizado pelo coordenador a cada transição.",
|
|
182
|
+
].join("\n");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function taskDescription(run, task) {
|
|
186
|
+
const spec = { id: task.id, title: task.title };
|
|
187
|
+
for (const field of SPEC_FIELDS) if (task[field] !== undefined) spec[field] = task[field];
|
|
188
|
+
return [
|
|
189
|
+
`Tarefa \`${task.id}\` do workflow \`${run.id}\`.`,
|
|
190
|
+
"",
|
|
191
|
+
"**Critérios de aceite**",
|
|
192
|
+
...task.acceptance.map((item) => `- ${item}`),
|
|
193
|
+
"",
|
|
194
|
+
"**Arquivos**",
|
|
195
|
+
...task.files.map((file) => `- \`${file}\``),
|
|
196
|
+
"",
|
|
197
|
+
"Bloco lido pelo agent-kit (edite com cuidado — é a especificação da tarefa):",
|
|
198
|
+
"",
|
|
199
|
+
"```" + TASK_FENCE,
|
|
200
|
+
JSON.stringify(spec, null, 2),
|
|
201
|
+
"```",
|
|
202
|
+
].join("\n");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function eventComment(event) {
|
|
206
|
+
if (event.scope === "workflow") return `agent-kit · workflow: ${event.from || "—"} → ${event.to}${event.reason ? ` — ${event.reason}` : ""}`;
|
|
207
|
+
if (event.scope === "attempt") return `agent-kit · ${event.reason}`;
|
|
208
|
+
return `agent-kit · ${event.from || "—"} → ${event.to}${event.reason ? ` — ${event.reason}` : ""}`;
|
|
209
|
+
}
|
package/templates/AGENTS.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
Shared contract for **every coding agent** in this repository, whatever the tool. It states what
|
|
4
4
|
the project is and how code is written here. It does not assign roles:
|
|
5
5
|
|
|
6
|
-
- the **
|
|
7
|
-
- the **worker** role lives in `docs/agents/worker.md
|
|
8
|
-
|
|
6
|
+
- the **coordinator** role lives in `CLAUDE.md`, which imports this file;
|
|
7
|
+
- the **worker** role (implementers and validators) lives in `docs/agents/worker.md`. **If you were
|
|
8
|
+
launched with a brief, you are a worker: follow that file and your brief, not `CLAUDE.md`;**
|
|
9
|
+
- coding standards live in `.claude/rules/` (see `.claude/rules/README.md`);
|
|
10
|
+
- the role pipeline, autonomy limits and protected actions live in `.agent-kit/` (`workflow.json`,
|
|
11
|
+
`autonomy.json`), and apply to every agent.
|
|
9
12
|
|
|
10
13
|
On conflict: role file (`CLAUDE.md` or `docs/agents/worker.md`) > this file > `.claude/rules/`.
|
|
11
14
|
|
|
@@ -26,7 +29,8 @@ unilaterally. If a task cannot proceed without one of them, ask.
|
|
|
26
29
|
- **Apply only if that technology is chosen:** `node.md`, `react.md`, `http.md`.
|
|
27
30
|
|
|
28
31
|
Because no dependency manifest exists, there is **no runnable build, lint or test command yet**.
|
|
29
|
-
Never report a validation as passing when its command does not exist.
|
|
32
|
+
Never report a validation as passing when its command does not exist. Once the stack is chosen,
|
|
33
|
+
add its commands here and to the `checks` of `.agent-kit/config.json`.
|
|
30
34
|
<!--END-->
|
|
31
35
|
<!--IF:existing-->
|
|
32
36
|
## Stack
|
|
@@ -54,7 +58,11 @@ its command does not exist or was not executed.
|
|
|
54
58
|
| Build | `{{CMD_BUILD}}` |
|
|
55
59
|
| Test | `{{CMD_TEST}}` |
|
|
56
60
|
| Lint | `{{CMD_LINT}}` |
|
|
61
|
+
| Typecheck | `{{CMD_TYPECHECK}}` |
|
|
57
62
|
| Single test | `{{CMD_TEST_ONE}}` |
|
|
63
|
+
|
|
64
|
+
The commands that gate a workflow (lint, typecheck, test, build) are mirrored in the `checks` of
|
|
65
|
+
`.agent-kit/config.json`. Keep both in sync.
|
|
58
66
|
<!--END-->
|
|
59
67
|
|
|
60
68
|
Design decisions and their rejected alternatives belong in `docs/adr/`, and the domain glossary in
|
|
@@ -77,7 +85,9 @@ These bias toward caution over speed. For trivial tasks, use judgment.
|
|
|
77
85
|
### Think before acting
|
|
78
86
|
|
|
79
87
|
Do not assume, do not hide confusion, surface tradeoffs. State assumptions explicitly; if multiple
|
|
80
|
-
interpretations exist, present them instead of silently picking one. If something is unclear
|
|
88
|
+
interpretations exist, present them instead of silently picking one. If something is unclear: a
|
|
89
|
+
worker reports `blocked`; the coordinator follows the escalation rules in `CLAUDE.md` (decide and
|
|
90
|
+
record a reversible assumption, or ask).
|
|
81
91
|
|
|
82
92
|
### Simplicity first
|
|
83
93
|
|
|
@@ -132,7 +142,8 @@ Prefer self-explanatory code. No restating what the code does, no TODOs, no sect
|
|
|
132
142
|
- [Conventional Commits](https://www.conventionalcommits.org/): `type(scope): subject`, imperative,
|
|
133
143
|
lowercase, no trailing period.
|
|
134
144
|
- **Never add `Co-Authored-By:` trailers or any assistant attribution.**
|
|
135
|
-
- Only the
|
|
145
|
+
- Only the coordinator commits, and only when the user asks or `permissions.localCommits` in
|
|
146
|
+
`.agent-kit/autonomy.json` is true. Pushing follows `permissions.push`.
|
|
136
147
|
|
|
137
148
|
### Code quality
|
|
138
149
|
|