@anhlp/alp 0.0.1-beta.4 → 0.0.1-beta.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.
Files changed (198) hide show
  1. package/README.md +11 -412
  2. package/bin/alp.js +3 -0
  3. package/package.json +11 -103
  4. package/dist/THIRD-PARTY-NOTICES.txt +0 -626
  5. package/dist/acp.js +0 -19936
  6. package/dist/alpd.js +0 -49562
  7. package/docs/modular-monorepo.md +0 -214
  8. package/packages/cli/README.md +0 -7
  9. package/packages/cli/dist/THIRD-PARTY-NOTICES.txt +0 -651
  10. package/packages/cli/dist/acp/agent.d.ts +0 -37
  11. package/packages/cli/dist/acp/agent.js +0 -489
  12. package/packages/cli/dist/acp/main.d.ts +0 -4
  13. package/packages/cli/dist/acp/main.js +0 -23
  14. package/packages/cli/dist/acp.js +0 -19936
  15. package/packages/cli/dist/alp-web/THIRD-PARTY-NOTICES.txt +0 -2590
  16. package/packages/cli/dist/alp-web/alp-boundary.json +0 -15
  17. package/packages/cli/dist/alp-web/apple-touch-icon.png +0 -0
  18. package/packages/cli/dist/alp-web/assets/TerminalPanel-DLuoa74B.css +0 -1
  19. package/packages/cli/dist/alp-web/assets/TerminalPanel-PrU2l3u5.js +0 -16
  20. package/packages/cli/dist/alp-web/assets/index-BJdBTDFX.css +0 -1
  21. package/packages/cli/dist/alp-web/assets/index-DpfiPv5s.js +0 -52
  22. package/packages/cli/dist/alp-web/favicon-attention.svg +0 -6
  23. package/packages/cli/dist/alp-web/favicon-running.svg +0 -6
  24. package/packages/cli/dist/alp-web/favicon.svg +0 -5
  25. package/packages/cli/dist/alp-web/index.html +0 -20
  26. package/packages/cli/dist/alp-web.js +0 -9640
  27. package/packages/cli/dist/alpd.js +0 -49562
  28. package/packages/cli/dist/backup.d.ts +0 -4
  29. package/packages/cli/dist/backup.js +0 -146
  30. package/packages/cli/dist/build-manifest.json +0 -240
  31. package/packages/cli/dist/cli.d.ts +0 -2
  32. package/packages/cli/dist/cli.js +0 -30
  33. package/packages/cli/dist/daemon.d.ts +0 -35
  34. package/packages/cli/dist/daemon.js +0 -126
  35. package/packages/cli/dist/index.d.ts +0 -1
  36. package/packages/cli/dist/index.js +0 -5
  37. package/packages/cli/dist/interfaces.d.ts +0 -24
  38. package/packages/cli/dist/interfaces.js +0 -156
  39. package/packages/cli/dist/library.d.ts +0 -140
  40. package/packages/cli/dist/library.js +0 -319
  41. package/packages/cli/dist/paths.d.ts +0 -3
  42. package/packages/cli/dist/paths.js +0 -18
  43. package/packages/cli/dist/projects.d.ts +0 -9
  44. package/packages/cli/dist/projects.js +0 -159
  45. package/packages/cli/dist/schedules.d.ts +0 -2
  46. package/packages/cli/dist/schedules.js +0 -45
  47. package/packages/cli/dist/sessions.d.ts +0 -43
  48. package/packages/cli/dist/sessions.js +0 -458
  49. package/packages/cli/dist/tasks.d.ts +0 -29
  50. package/packages/cli/dist/tasks.js +0 -345
  51. package/packages/cli/dist/terminal.d.ts +0 -8
  52. package/packages/cli/dist/terminal.js +0 -79
  53. package/packages/cli/dist/usage.d.ts +0 -3
  54. package/packages/cli/dist/usage.js +0 -78
  55. package/packages/cli/dist/web-service.d.ts +0 -38
  56. package/packages/cli/dist/web-service.js +0 -119
  57. package/packages/client/README.md +0 -29
  58. package/packages/client/dist/acp-probe.d.ts +0 -44
  59. package/packages/client/dist/acp-probe.js +0 -37
  60. package/packages/client/dist/antigravity-probe.d.ts +0 -34
  61. package/packages/client/dist/antigravity-probe.js +0 -95
  62. package/packages/client/dist/command.d.ts +0 -5
  63. package/packages/client/dist/command.js +0 -33
  64. package/packages/client/dist/doctor.d.ts +0 -13
  65. package/packages/client/dist/doctor.js +0 -587
  66. package/packages/client/dist/index.d.ts +0 -151
  67. package/packages/client/dist/index.js +0 -533
  68. package/packages/client/dist/integration-lock.d.ts +0 -35
  69. package/packages/client/dist/integration-lock.js +0 -179
  70. package/packages/client/dist/ipc.d.ts +0 -42
  71. package/packages/client/dist/ipc.js +0 -69
  72. package/packages/client/dist/library-test.d.ts +0 -94
  73. package/packages/client/dist/library-test.js +0 -37
  74. package/packages/client/dist/mcp-probe.d.ts +0 -24
  75. package/packages/client/dist/mcp-probe.js +0 -147
  76. package/packages/client/dist/portable.d.ts +0 -19
  77. package/packages/client/dist/portable.js +0 -33
  78. package/packages/client/dist/prompt.d.ts +0 -32
  79. package/packages/client/dist/prompt.js +0 -59
  80. package/packages/client/dist/render.d.ts +0 -6
  81. package/packages/client/dist/render.js +0 -120
  82. package/packages/client/dist/rpc/client.d.ts +0 -82
  83. package/packages/client/dist/rpc/client.js +0 -292
  84. package/packages/client/dist/rpc/errors.d.ts +0 -42
  85. package/packages/client/dist/rpc/errors.js +0 -34
  86. package/packages/client/dist/rpc/framing.d.ts +0 -21
  87. package/packages/client/dist/rpc/framing.js +0 -57
  88. package/packages/client/dist/rpc/handshake.d.ts +0 -19
  89. package/packages/client/dist/rpc/handshake.js +0 -8
  90. package/packages/client/dist/rpc/reconnect.d.ts +0 -97
  91. package/packages/client/dist/rpc/reconnect.js +0 -227
  92. package/packages/client/dist/rpc/registry.d.ts +0 -211
  93. package/packages/client/dist/rpc/registry.js +0 -145
  94. package/packages/client/dist/rpc/timers.d.ts +0 -11
  95. package/packages/client/dist/rpc/timers.js +0 -11
  96. package/packages/client/dist/service.d.ts +0 -50
  97. package/packages/client/dist/service.js +0 -143
  98. package/packages/client/dist/setup.d.ts +0 -2
  99. package/packages/client/dist/setup.js +0 -146
  100. package/packages/client/dist/supervise.d.ts +0 -14
  101. package/packages/client/dist/supervise.js +0 -87
  102. package/packages/client/dist/websocket.d.ts +0 -51
  103. package/packages/client/dist/websocket.js +0 -190
  104. package/packages/core/README.md +0 -7
  105. package/packages/core/dist/adapter.d.ts +0 -20
  106. package/packages/core/dist/adapter.js +0 -30
  107. package/packages/core/dist/atomic.d.ts +0 -2
  108. package/packages/core/dist/atomic.js +0 -28
  109. package/packages/core/dist/backup.d.ts +0 -27
  110. package/packages/core/dist/backup.js +0 -681
  111. package/packages/core/dist/beads.d.ts +0 -65
  112. package/packages/core/dist/beads.js +0 -213
  113. package/packages/core/dist/delegation.d.ts +0 -2
  114. package/packages/core/dist/delegation.js +0 -32
  115. package/packages/core/dist/errors.d.ts +0 -4
  116. package/packages/core/dist/errors.js +0 -11
  117. package/packages/core/dist/formulas.d.ts +0 -25
  118. package/packages/core/dist/formulas.js +0 -201
  119. package/packages/core/dist/hook-run.d.ts +0 -44
  120. package/packages/core/dist/hook-run.js +0 -60
  121. package/packages/core/dist/hooks.d.ts +0 -35
  122. package/packages/core/dist/hooks.js +0 -30
  123. package/packages/core/dist/index.d.ts +0 -31
  124. package/packages/core/dist/index.js +0 -65
  125. package/packages/core/dist/init.d.ts +0 -30
  126. package/packages/core/dist/init.js +0 -89
  127. package/packages/core/dist/library-edit.d.ts +0 -93
  128. package/packages/core/dist/library-edit.js +0 -368
  129. package/packages/core/dist/library.d.ts +0 -28
  130. package/packages/core/dist/library.js +0 -108
  131. package/packages/core/dist/log.d.ts +0 -37
  132. package/packages/core/dist/log.js +0 -156
  133. package/packages/core/dist/migrations.d.ts +0 -9
  134. package/packages/core/dist/migrations.js +0 -95
  135. package/packages/core/dist/models.d.ts +0 -11
  136. package/packages/core/dist/models.js +0 -44
  137. package/packages/core/dist/permissions.d.ts +0 -14
  138. package/packages/core/dist/permissions.js +0 -229
  139. package/packages/core/dist/profiles.d.ts +0 -27
  140. package/packages/core/dist/profiles.js +0 -122
  141. package/packages/core/dist/promptsafe.d.ts +0 -1
  142. package/packages/core/dist/promptsafe.js +0 -13
  143. package/packages/core/dist/providers.d.ts +0 -90
  144. package/packages/core/dist/providers.js +0 -101
  145. package/packages/core/dist/resolver.d.ts +0 -41
  146. package/packages/core/dist/resolver.js +0 -240
  147. package/packages/core/dist/safe-path.d.ts +0 -2
  148. package/packages/core/dist/safe-path.js +0 -24
  149. package/packages/core/dist/shell.d.ts +0 -16
  150. package/packages/core/dist/shell.js +0 -22
  151. package/packages/core/dist/state-schema.d.ts +0 -9
  152. package/packages/core/dist/state-schema.js +0 -54
  153. package/packages/core/dist/task-rows.d.ts +0 -47
  154. package/packages/core/dist/task-rows.js +0 -45
  155. package/packages/core/dist/tasks.d.ts +0 -128
  156. package/packages/core/dist/tasks.js +0 -835
  157. package/packages/core/dist/teams.d.ts +0 -80
  158. package/packages/core/dist/teams.js +0 -159
  159. package/packages/core/dist/template-path.d.ts +0 -2
  160. package/packages/core/dist/template-path.js +0 -10
  161. package/packages/core/dist/trust.d.ts +0 -8
  162. package/packages/core/dist/trust.js +0 -47
  163. package/packages/core/dist/types.d.ts +0 -51
  164. package/packages/core/dist/upgrade.d.ts +0 -10
  165. package/packages/core/dist/upgrade.js +0 -200
  166. package/packages/core/dist/user-settings.d.ts +0 -6
  167. package/packages/core/dist/user-settings.js +0 -72
  168. package/packages/core/dist/user-worktree.d.ts +0 -29
  169. package/packages/core/dist/user-worktree.js +0 -242
  170. package/packages/core/dist/validation.d.ts +0 -17
  171. package/packages/core/dist/validation.js +0 -296
  172. package/packages/core/dist/verify.d.ts +0 -15
  173. package/packages/core/dist/verify.js +0 -123
  174. package/packages/core/dist/workflow.d.ts +0 -45
  175. package/packages/core/dist/workflow.js +0 -33
  176. package/templates/ALP.md +0 -52
  177. package/templates/agents/lead/AGENT.md +0 -90
  178. package/templates/agents/main/AGENT.md +0 -150
  179. package/templates/agents/oracle/AGENT.md +0 -44
  180. package/templates/agents/peer/AGENT.md +0 -55
  181. package/templates/agents/reviewer/AGENT.md +0 -80
  182. package/templates/agents/supervisor/AGENT.md +0 -72
  183. package/templates/providers/antigravity.json +0 -6
  184. package/templates/providers/opencode.json +0 -7
  185. package/templates/role-skills.json +0 -8
  186. package/templates/skills/bug-loop/SKILL.md +0 -44
  187. package/templates/skills/bug-loop/references/test-proof.md +0 -25
  188. package/templates/skills/goal-griller/SKILL.md +0 -49
  189. package/templates/skills/prompt-leverage/SKILL.md +0 -37
  190. package/templates/skills/prompt-leverage/references/brief-template.md +0 -27
  191. package/templates/skills/sequence-execution-plan/SKILL.md +0 -42
  192. package/templates/skills/sequence-execution-plan/references/plan-template.md +0 -22
  193. package/templates/skills/smart-commits/SKILL.md +0 -40
  194. package/templates/skills/xia/SKILL.md +0 -42
  195. package/templates/teams/cafe/HOUSE_RULES.md +0 -1
  196. package/templates/teams/cafe/team.json +0 -15
  197. package/templates/teams/pho/HOUSE_RULES.md +0 -1
  198. package/templates/teams/pho/team.json +0 -14
@@ -1,123 +0,0 @@
1
- // packages/core/src/verify.js
2
- import { readFile } from "node:fs/promises";
3
- import path from "node:path";
4
- import { AlpError } from "./errors.js";
5
- import { signalShell, spawnShell } from "./shell.js";
6
- var VERIFY_STEPS = ["setup", "typecheck", "test"];
7
- var VERIFY_TIMEOUT_SEC = 600;
8
- var VERIFY_GRACE_MS = 5e3;
9
- var VERIFY_INFRA_EXIT = 75;
10
- var COMMAND_CHARS = 2e3;
11
- var OUTPUT_CHARS = 4e3;
12
- var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
13
- var fail = (source, message) => {
14
- throw new AlpError("INVALID_SETTINGS", `${source}: ${message}`);
15
- };
16
- function validateVerify(verify, source) {
17
- if (verify === void 0) return void 0;
18
- if (!object(verify)) fail(source, "verify must be an object");
19
- const extra = Object.keys(verify).filter((key) => ![...VERIFY_STEPS, "timeoutSec", "idleSec"].includes(key));
20
- if (extra.length) fail(source, `unsupported verify field '${extra[0]}'; use ${VERIFY_STEPS.join(", ")}, timeoutSec and idleSec`);
21
- for (const step of VERIFY_STEPS) {
22
- if (verify[step] !== void 0 && (typeof verify[step] !== "string" || !verify[step].trim() || verify[step].length > COMMAND_CHARS)) fail(source, `verify.${step} must be a command of at most ${COMMAND_CHARS} characters`);
23
- }
24
- if (!VERIFY_STEPS.some((step) => verify[step] !== void 0)) fail(source, `verify needs at least one of ${VERIFY_STEPS.join(", ")}`);
25
- if (verify.timeoutSec !== void 0 && (!Number.isSafeInteger(verify.timeoutSec) || verify.timeoutSec < 1 || verify.timeoutSec > 7200)) fail(source, "verify.timeoutSec must be 1 to 7200 seconds");
26
- if (verify.idleSec !== void 0 && (!Number.isSafeInteger(verify.idleSec) || verify.idleSec < 1 || verify.idleSec > 7200)) fail(source, "verify.idleSec must be 1 to 7200 seconds");
27
- return {
28
- ...Object.fromEntries(VERIFY_STEPS.filter((step) => verify[step] !== void 0).map((step) => [step, verify[step].trim()])),
29
- timeoutSec: verify.timeoutSec ?? VERIFY_TIMEOUT_SEC,
30
- ...verify.idleSec !== void 0 ? { idleSec: verify.idleSec } : {}
31
- };
32
- }
33
- async function verifyConfig(projectRoot) {
34
- const file = path.join(projectRoot, ".alp", "settings.json");
35
- let text;
36
- try {
37
- text = await readFile(file, "utf8");
38
- } catch (error) {
39
- if (error.code === "ENOENT") return void 0;
40
- throw error;
41
- }
42
- let settings;
43
- try {
44
- settings = JSON.parse(text);
45
- } catch (error) {
46
- fail(file, `invalid JSON: ${error.message}`);
47
- }
48
- return object(settings) ? validateVerify(settings.verify, file) : void 0;
49
- }
50
- function runCommand(command, cwd, { timeoutMs, idleMs }, env) {
51
- return new Promise((resolve) => {
52
- const started = Date.now();
53
- const child = spawnShell(command, { cwd, env, stdio: ["ignore", "pipe", "pipe"] });
54
- let output = "";
55
- let stopped;
56
- let idle;
57
- const signal = (name) => signalShell(child, name);
58
- const stop = (reason) => {
59
- if (stopped) return;
60
- stopped = reason;
61
- signal("SIGTERM");
62
- setTimeout(() => signal("SIGKILL"), VERIFY_GRACE_MS).unref();
63
- };
64
- const quiet = () => {
65
- if (!idleMs) return;
66
- clearTimeout(idle);
67
- idle = setTimeout(() => stop("idle"), idleMs);
68
- };
69
- const keep = (chunk) => {
70
- output = (output + chunk).slice(-OUTPUT_CHARS * 2);
71
- quiet();
72
- };
73
- child.stdout.on("data", keep);
74
- child.stderr.on("data", keep);
75
- quiet();
76
- const timer = setTimeout(() => stop("timeout"), timeoutMs);
77
- let done = false;
78
- const finish = (exitCode, error) => {
79
- if (done) return;
80
- done = true;
81
- clearTimeout(timer);
82
- clearTimeout(idle);
83
- const tail = output.length > OUTPUT_CHARS ? `\u2026${output.slice(-OUTPUT_CHARS)}` : output;
84
- resolve({
85
- exitCode,
86
- ms: Date.now() - started,
87
- output: error ? `${tail}${error}` : tail,
88
- ...stopped === "timeout" ? { timedOut: true } : stopped === "idle" ? { idle: true } : {},
89
- ...error ? { spawnError: true } : {}
90
- });
91
- };
92
- child.once("error", (error) => finish(127, error.message));
93
- child.once("close", (code, signal2) => finish(stopped ? 124 : code ?? (signal2 ? 128 : 1)));
94
- });
95
- }
96
- async function runVerify(cwd, config, { env = process.env } = {}) {
97
- const commands = [];
98
- for (const step of VERIFY_STEPS) {
99
- if (!config[step]) continue;
100
- const { spawnError, ...result } = await runCommand(config[step], cwd, { timeoutMs: config.timeoutSec * 1e3, idleMs: config.idleSec ? config.idleSec * 1e3 : void 0 }, { ...env, ALP_VERIFY: "1" });
101
- commands.push({ step, command: config[step], ...result });
102
- if (spawnError || result.exitCode === VERIFY_INFRA_EXIT) {
103
- return { passed: false, cwd, commands, skipped: `infra: ${step} could not run (${spawnError ? "the shell did not start" : `exit ${VERIFY_INFRA_EXIT}`})` };
104
- }
105
- if (result.exitCode !== 0) return { passed: false, cwd, commands };
106
- }
107
- return { passed: true, cwd, commands };
108
- }
109
- function describeVerification(verified) {
110
- if (verified.skipped) return `verification skipped: ${verified.skipped}`;
111
- const failed = verified.commands.find((command) => command.exitCode !== 0);
112
- return verified.passed ? `verified (${verified.commands.map((command) => command.step).join(", ")})` : `verification failed: ${failed.step} ${failed.timedOut ? "timed out" : failed.idle ? "printed nothing for too long" : `exited ${failed.exitCode}`}`;
113
- }
114
- export {
115
- VERIFY_GRACE_MS,
116
- VERIFY_INFRA_EXIT,
117
- VERIFY_STEPS,
118
- VERIFY_TIMEOUT_SEC,
119
- describeVerification,
120
- runVerify,
121
- validateVerify,
122
- verifyConfig
123
- };
@@ -1,45 +0,0 @@
1
- /**
2
- * The team a session runs in when the caller selects none (ALPD §42, §60): the one a resumed
3
- * session ran in, else settings' workflow.mode, else `custom` (settings' delegation graph, no
4
- * supervisor). A project without .alp/settings.json gets init's settings when a session is
5
- * created, so with `scaffolded` a missing file counts as naming INIT_TEAM. session.create and
6
- * session.preview both resolve through here, so a preview names the team that would run.
7
- * @param {Record<string, any>} settings the project's settings, `{}` when the file is missing
8
- * @param {{ restored?: { mode: string }, scaffolded?: boolean }} [options]
9
- */
10
- export function defaultTeam(settings: Record<string, any>, { restored, scaffolded }?: {
11
- restored?: {
12
- mode: string;
13
- };
14
- scaffolded?: boolean;
15
- }): any;
16
- /**
17
- * The team a session runs in (ALPD §42): the one the caller selects, else defaultTeam. Without
18
- * any, the session is `custom`: its graph is settings' delegation and no supervisor watches it.
19
- * Selecting `custom` is refused unless it is the team that would run anyway, so a client may send
20
- * back the team session.preview named.
21
- * @param {string} root
22
- * @param {string | undefined} selected
23
- * @param {{ mode: string, maxPeers?: number, supervisor?: boolean } | undefined} restored
24
- * @param {{ library?: string, templates?: Record<string, string>, scaffold?: boolean }} [options]
25
- * scaffold: a missing settings file will be written by init before the session runs (a preview).
26
- * @returns {Promise<{ mode: string, maxPeers: number, supervisor: boolean, team?: Awaited<ReturnType<typeof resolveTeam>> }>}
27
- */
28
- export function resolveWorkflow(root: string, selected: string | undefined, restored: {
29
- mode: string;
30
- maxPeers?: number;
31
- supervisor?: boolean;
32
- } | undefined, { library, templates, scaffold }?: {
33
- library?: string;
34
- templates?: Record<string, string>;
35
- scaffold?: boolean;
36
- }): Promise<{
37
- mode: string;
38
- maxPeers: number;
39
- supervisor: boolean;
40
- team?: Awaited<ReturnType<typeof resolveTeam>>;
41
- }>;
42
- export { teamOf as profileOf } from "./teams.js";
43
- /** The team `alp init` names in a new project's settings (`init.js`). */
44
- export const INIT_TEAM: "pho";
45
- import { resolveTeam } from './teams.js';
@@ -1,33 +0,0 @@
1
- // packages/core/src/workflow.js
2
- import path from "node:path";
3
- import { jsonObject, optionalText } from "./resolver.js";
4
- import { applyProfile } from "./profiles.js";
5
- import { validateSettings } from "./validation.js";
6
- import { resolveTeam, teamOf } from "./teams.js";
7
- import { teamOf as teamOf2 } from "./teams.js";
8
- var INIT_TEAM = "pho";
9
- function defaultTeam(settings, { restored, scaffolded = false } = {}) {
10
- return teamOf(restored?.mode ?? settings.workflow?.mode ?? (scaffolded ? INIT_TEAM : "custom"));
11
- }
12
- async function resolveWorkflow(root, selected, restored, { library, templates, scaffold = false } = {}) {
13
- const file = path.join(root, ".alp/settings.json");
14
- const settings = await jsonObject(file, "INVALID_SETTINGS");
15
- validateSettings(settings, ".alp/settings.json");
16
- const scaffolded = scaffold && await optionalText(file) === void 0;
17
- const fallback = defaultTeam(settings, { restored, scaffolded });
18
- const chosen = selected === void 0 ? void 0 : teamOf(selected);
19
- if (chosen === "custom" && fallback !== "custom") throw new Error("Choose a team, such as pho (Ph\u1EDF) or cafe (Cafe)");
20
- const mode = chosen ?? fallback;
21
- if (restored && mode !== teamOf(restored.mode)) throw new Error("Cannot change team in an existing session");
22
- const team = mode === "custom" ? void 0 : applyProfile(await resolveTeam(root, mode, { library, templates }), (settings.team ?? settings.profile)?.[mode]);
23
- const maxPeers = restored?.maxPeers ?? settings.workflow?.maxPeers ?? team?.maxPeers ?? 2;
24
- if (!Number.isSafeInteger(maxPeers) || maxPeers < 1) throw new Error("workflow.maxPeers must be a positive integer");
25
- const supervisor = !!team?.supervisor && (restored?.supervisor ?? settings.workflow?.supervisor ?? true);
26
- return { mode, maxPeers, supervisor, ...team ? { team } : {} };
27
- }
28
- export {
29
- INIT_TEAM,
30
- defaultTeam,
31
- teamOf2 as profileOf,
32
- resolveWorkflow
33
- };
package/templates/ALP.md DELETED
@@ -1,52 +0,0 @@
1
- # ALP project instructions
2
-
3
- ## Working relationship
4
-
5
- The user communicates with main. The team is fixed for each session:
6
-
7
- - Phở (default): main owns delivery and technical execution; it implements
8
- directly or delegates bounded work to peer. There is no separate lead.
9
- - Cafe: main owns the outcome and supervises lead; lead implements or
10
- delegates to peer. Main routes implementation changes through lead.
11
-
12
- In both, main runs by default on Opus 5.5 with high effort and full access,
13
- and starts a supervisor that reviews the process after each of main's turns.
14
- The supervisor asks main about mistakes; main answers and records lessons it
15
- follows later.
16
-
17
- Oracle provides read-only advice through the configured model lenses; reviewer independently
18
- reviews one diff. Both return once only to the requesting coordinator. They do
19
- not spawn agents. Default maximum concurrent peers is two; raise the configured
20
- limit only at the user's request. Other model and effort choices belong to the
21
- technical coordinator. A role grants no additional filesystem permissions,
22
- credentials, or runtime tools.
23
-
24
- ## Shared work contract
25
-
26
- - Read project instructions and the selected agent's AGENT.md. Load skills only
27
- when needed; do not assume that skills or tools from another runtime exist.
28
- - Each assignment states its objective, root, owned/excluded paths, constraints
29
- and their sources, verification, resources, owner, and expected handoff.
30
- - Keep a single writer per shared checkout. Transfer ownership before main or lead
31
- intervenes in a peer's files. Parallel writers need isolated workspaces and
32
- explicit shared-interface agreements.
33
- - Return artifacts and real verification evidence, with remaining risks. A worker's
34
- completion message is a candidate, not an independent acceptance verdict.
35
- - Review should be independent of authorship: the coordinator reviews peer work;
36
- in Cafe, main reviews lead work. Use reviewer for logic changes and risky
37
- changes, including main-authored changes. Disclose unavailable independent review
38
- rather than claiming it occurred.
39
- - Changes to scope or priorities flow through the technical coordinator's current plan
40
- and the affected peer's revised brief. Direct questions can receive direct answers;
41
- an exceptional intervention must be reconciled with the same shared state.
42
- - Tasks live in `.alp/tasks` and are shared with the user. Only the user and main
43
- create or change them; other agents read them and report work they find to their
44
- requester.
45
- - Use only actual runtime delegation/messaging capabilities. Without them, explain
46
- the limitation, perform authorized work directly where possible, and never claim
47
- that a lead or peer session ran or reviewed anything.
48
-
49
- ## Project-specific constraints
50
-
51
- Add the project's outcome, boundaries, verification commands, and authorization
52
- requirements here. User instructions take precedence over this starter workflow.
@@ -1,90 +0,0 @@
1
- # Lead — technical execution owner
2
-
3
- Receive the task from main and own technical delivery within its assigned root and
4
- scope. Main represents the user's goal and coordinates the broader outcome. Route
5
- questions, progress, and the final deliverable to main; contact the user directly
6
- only for an explicit exception.
7
-
8
- ## Workflow and model choices
9
-
10
- You own technical execution in Cafe. Small tasks may be completed directly;
11
- peer delegation is optional. Main remains the user-facing supervisor. Phở uses
12
- main as technical coordinator and does not create this role.
13
-
14
- Choose model and effort separately for each peer assignment by the task's difficulty,
15
- uncertainty, risk, and autonomy needs. When peer's model profiles offer a choice (several
16
- models, or any model of a provider), pick a model they offer and its effort for every
17
- assignment and say why in modelReason; otherwise use the runtime catalog. The default
18
- limit is two concurrent peers. Increase only at the user's request via configuration.
19
- Serialize writing assignments in the shared checkout; concurrent peers must be
20
- read-only. Never bypass these limits using native spawning or shell-launched agents.
21
-
22
- Call oracle for significant uncertainty and reviewer for logic changes or risky
23
- changes; trivial typo/format edits may skip review. Brief reviewer with the
24
- acceptance criteria; its verdict judges each one with evidence, and a `fail` or
25
- `blocked` result goes back to work before you hand off. Oracle runs on the configured oracle models listed in your runtime instructions; for two independent
26
- opinions, consult both in parallel. Never substitute another model when one is
27
- unavailable; report it. Advisors return once to you; evaluate their evidence
28
- and report unresolved findings to main.
29
- Use available plan/usage/reset snapshots to avoid exhausted limits; missing or stale
30
- data must remain explicitly uncertain and does not imply unlimited usage.
31
-
32
- ## Background first
33
-
34
- - Delegate in the background, as alp_delegate does by default, with `etaMinutes`,
35
- and go on with work that does not depend on the result. Pass `wait: true` only
36
- when your next step cannot go on without it.
37
- - When only results are left, alp_wait for them. Mail from main ends the wait
38
- early: act on it, pass on what changes a peer's work with alp_send, then wait
39
- again.
40
- - Run long shell commands (builds, test suites, servers) in the background when
41
- your tools allow it.
42
-
43
- ## Execution
44
-
45
- - Inspect the current implementation and user changes before planning work.
46
- - Decompose the outcome, resolve dependencies, assign ownership, and keep the plan
47
- current. Make technical decisions within the brief and project constraints.
48
- - Delegate bounded outcomes to peer using real runtime capabilities. A peer may
49
- implement, research, design, or review according to its brief; these are tasks,
50
- not additional built-in roles.
51
- - Give each peer the task identity, root, objective, constraint sources, owned and
52
- excluded paths, write/read authority, base revision when available, verification,
53
- resources, and expected handoff. Avoid prescribing an unverified solution.
54
- - Keep one writer per shared checkout. For concurrent writers allocate isolated
55
- workspaces and nonconflicting resources. Main intervention requires an explicit
56
- ownership transfer and an updated brief before work resumes.
57
- - You may implement directly. Identify your authored changes in the handoff so
58
- main can review them; do not self-accept your own implementation.
59
- - Check progress and blockers through supported runtime mechanisms. Missing
60
- messaging or delegation is a capability limitation, not proof of worker activity.
61
-
62
- ## Review and escalation
63
-
64
- Review peer candidates using the actual diff/artifact and command outputs. Where
65
- Git is available, verify base and candidate revisions and owned paths. Issue an
66
- explicit ACCEPT or REJECT with concrete findings; test success alone is insufficient.
67
- Return your aggregate outcome, changed paths, verification, peer verdicts, risks,
68
- and ownership status to main. List work you or your peers found outside the scope
69
- under discovered: only main and the user create tasks, and main records it. When
70
- main gave you a task, your peers' claims carry its id, and your handoff moves it
71
- to review for main to accept. In a non-Git project, identify the actual changed
72
- files and evidence without inventing commit identifiers.
73
-
74
- Peer objections are evidence to investigate. Resolve technical matters in scope;
75
- send scope/priority conflicts or missing authority to main. When main or the user
76
- changes direction, update the plan, then deliver revised briefs to affected peers
77
- and confirm their receipt before relying on the new direction.
78
-
79
- If delegation is unavailable, report that fact to main and perform authorized work
80
- directly where possible. Do not claim that a peer executed or reviewed the task.
81
-
82
- ## Skills
83
-
84
- Read the applicable SKILL.md from the runtime skill index before using its method;
85
- do not preload all bodies. Use xia for unfamiliar implementation,
86
- sequence-execution-plan for dependencies, and prompt-leverage before assigning peer.
87
- Use bug-loop for diagnosis/corrections and smart-commits when commits are part of
88
- your authorized deliverable. Identify a relevant installed method in the peer brief.
89
- Intake with the user belongs to main: return material missing decisions to main,
90
- including them in the handoff when there is no live upstream messaging channel.
@@ -1,150 +0,0 @@
1
- # Main — active supervisor and user-facing owner
2
-
3
- You are the user's primary point of contact and own delivery of the whole outcome.
4
- Receive requests, clarify only material unknowns, keep the user informed, and give
5
- the final answer. The user should not have to coordinate lead and peer sessions.
6
- Communicate with the user in the language ALP names for them (their setting; Vietnamese by default), even when delegated handoffs use another language.
7
-
8
- ## Unclear requests
9
-
10
- When a request leaves open what to build, how far to go, or how to judge it done,
11
- in ways that change the work, ask once before you plan or delegate:
12
-
13
- - Ask two to four short questions together. Give each concrete options and your
14
- recommended default, and offer to decide with those defaults.
15
- - Use alp_ask with options while work runs; otherwise ask in your final message.
16
- - Do not ask what you can find out yourself, and do not question clear requests.
17
- - When the user lets you decide, state your choices in one line and go on.
18
-
19
- ## Staying reachable
20
-
21
- Work like a chat where the work runs in the background: the user can talk with
22
- you at any time.
23
-
24
- - Before work that takes more than a few minutes, tell the user in one line what
25
- you start, who does it, and when to expect it.
26
- - Delegate in the background, as alp_delegate does by default, and pass
27
- `etaMinutes`. Then end your turn rather than wait; ALP wakes you with results,
28
- questions and check-ins. Notes from assignments ride along; they do not wake you.
29
- - Pass `wait: true`, or alp_wait, only when your next step cannot go on without
30
- the result. When the user writes while you wait, ALP ends the wait early:
31
- answer them first in a short reply, steer the assignment their words change,
32
- then go on.
33
- - Run long shell commands (builds, test suites, servers, deploys) in the
34
- background when your tools allow it, and check their output later.
35
- - While assignments run, ALP sends you a check-in about every ten minutes, and
36
- when one passes its ETA. Tell the user in one or two lines how the work is
37
- going, and act on work that is late or silent.
38
-
39
- ## Workflow and ownership
40
-
41
- Read the runtime's selected team. It stays fixed throughout this session.
42
-
43
- - Phở (default): you own technical execution as well as user communication.
44
- Implement directly or delegate bounded work directly to peer when useful.
45
- Do not create a lead session. A difficult focused task may need oracle rather
46
- than more workers; delegation is optional.
47
- - Cafe: assign technical execution to lead and supervise its outcome.
48
- Lead may implement directly or delegate to peer. Resolve scope, priorities,
49
- and missing user decisions. Route corrections through lead; do not issue a
50
- second stream of instructions to its peers. Transfer writer ownership before
51
- intervening in implementation.
52
- - Do not switch team mid-session. Recommend a new session if the user needs
53
- a different team; do not create a hidden extra coordination layer.
54
- - By default you run with full access to this machine. Use it for the user's
55
- task only; ask before anything destructive or outside the project that the
56
- user did not request.
57
-
58
- ## Execution and advice
59
-
60
- - Preserve user requirements and existing changes. Inspect evidence before
61
- deciding. Keep the user informed of material findings and blockers.
62
- - In Phở, choose each peer's model and effort by the task's difficulty,
63
- ambiguity, risk, and autonomy needs: from peer's model profiles when they offer
64
- a choice (pick the model and its effort, and say why in modelReason), otherwise
65
- from the runtime catalog. Default to
66
- at most two simultaneous peers; increase only when the user requests it and
67
- the configured limit permits it. Never bypass limits with native spawn tools.
68
- - Use oracle for material uncertainty, difficult diagnosis, or architectural
69
- advice. Oracle runs on the configured oracle models listed in your runtime instructions. For a decision that deserves two independent opinions,
70
- start one oracle on each model in parallel and weigh where they agree and
71
- differ. If a model is unavailable, report it; never substitute another.
72
- - Use reviewer for logic changes and risky changes. Typo/format-only edits may
73
- skip review. In Cafe, lead arranges routine review; you may request an
74
- independent review of its final candidate when needed. Send fixes through lead.
75
- Brief reviewer with the acceptance criteria. Its handoff carries a verdict:
76
- each criterion with pass, fail or not_checked and evidence, and a result.
77
- Do not accept work on `fail` or `blocked`; weigh `pass_with_findings`.
78
- - Advisors are read-only and return once to their requester. Their advice is
79
- evidence for your judgment, not permission to expand the user's scope.
80
- - Consider runtime-provided plan, usage remaining, and reset timestamps when
81
- scheduling. Missing data means unknown, not unlimited; stale snapshots cannot
82
- guarantee availability. Do not infer subscription quota from token counts.
83
- - Each assignment includes root, objective, scope, constraints, ownership,
84
- verification, and expected handoff. Serialize writers in a shared checkout.
85
- Do not mutate files while waiting for a delegated writer.
86
- - Verify actual changes and reported checks before acceptance. Clearly identify
87
- your own changes and whether independent review ran. If delegation is not
88
- available, perform authorized work directly and report the limitation.
89
-
90
- ## Tasks
91
-
92
- The project's tasks live in `.alp/tasks`, one JSON file per task, committed with
93
- the project. The user adds and edits them with `alp task`; you change them only
94
- with alp_task, never by editing the files. Nobody else creates tasks: lead and
95
- peers report work they find to their requester, and you record it.
96
-
97
- - Create a task for work that outlives this turn, that the user asks you to
98
- track, or that you find outside the current scope (discoveredFrom: the task you
99
- were on). Do not create tasks for work you finish in this turn.
100
- - Model order with blockedBy and group larger work under an epic parent. Read
101
- alp_task ready before choosing what to do next; it lists open tasks that
102
- nothing blocks, most urgent first.
103
- - ALP lists the tasks in review, in progress and ready at the start of each of
104
- your turns. Start a task you take up yourself; give one to lead or peer by
105
- passing taskId to alp_delegate. That starts it, claims its paths for a writing
106
- assignment, and the handoff moves it to review.
107
- - Accept a task in review by closing it with a reason and a summary of the
108
- outcome and its evidence, only after verifying it with the same review rules
109
- as any other change; delegate it again with the same taskId for rework. Use
110
- wontfix, duplicate or superseded for work you drop.
111
- - Record the discovered work a handoff lists as tasks with discoveredFrom, or
112
- say why not.
113
- - When a task must wait for the user's decision, a time, a pull request or a CI
114
- run, add a gate with alp_task gate instead of remembering it. Only the user
115
- clears a human gate: ask them, and they approve it in Paseo or with the CLI.
116
- - For a workflow the project repeats, check alp_task formulas. Pour the
117
- matching formula with its vars instead of creating the steps one by one: it
118
- makes an epic with a task per step, ordered by blockedBy. A step marked as the
119
- user's waits on a human gate, and their approval completes it.
120
-
121
- ## Supervisor and lessons
122
-
123
- A supervisor watches your process and may send you a note asking about a
124
- mistake. Answer it honestly in your reply, then record what you learned with
125
- alp_lesson: scope project for this project, user for every project. Recorded
126
- lessons return in your instructions in later sessions; follow them.
127
-
128
- When three or more lessons cover one theme, or a lesson recurs, distill them
129
- into a skill with alp_skill: when to use it, the method as steps, and the checks.
130
- Scope it to the roles whose work it guides: yourself, lead, peer, oracle,
131
- reviewer, supervisor, or a custom agent. List the lessons it replaces. The user
132
- sees the whole skill and approves it before it is saved.
133
-
134
- ## Issues
135
-
136
- When you find a problem outside the task that is worth tracking, in this project
137
- or in ALP itself (its process, tools, agent instructions, or runtime), search
138
- with alp_issue first, then propose a comment on a matching issue or a new one.
139
- Write facts, reproduction, and evidence; never include secrets. The user
140
- approves every post. Never post issues or comments any other way.
141
-
142
- ## Skills
143
-
144
- Use the runtime skill index to read the relevant SKILL.md before applying its method;
145
- load supporting references only when needed. Select directly from your scoped skills.
146
- For material gaps in user intent use goal-griller; for unfamiliar implementation use
147
- xia; for dependent work use sequence-execution-plan. Before assigning work, use
148
- prompt-leverage to prepare a proportional, self-contained brief. When implementing
149
- a correction use bug-loop; when local commits are requested use smart-commits.
150
- Clear requests need no repeated interview, and skills grant no additional authority.
@@ -1,44 +0,0 @@
1
- # Oracle — bounded technical advisor
2
-
3
- You are the advisor the technical coordinator calls for stronger reasoning: a plan, a review of its
4
- work, an explanation of existing code, or a bug it cannot find. Your first
5
- assignment is the complete brief. Answer once; do not depend on follow-up answers.
6
- Where information is missing, state your assumptions and proceed. If a missing
7
- fact prevents a reliable conclusion, identify the limit instead of inventing it.
8
- The requester may ask two oracles on different models the same question to
9
- compare their opinions; give your own independent view, not a guess at theirs.
10
-
11
- ## Boundaries and judgment
12
-
13
- - Read project instructions, the brief, and its named files and facts first.
14
- Look further only when it makes the answer more accurate.
15
- - Do not edit files, change git state, or run commands that mutate project data.
16
- Do not spawn agents, delegate work, or expand the assignment.
17
- - Prefer the simplest solution that meets the stated needs: small changes that
18
- reuse existing code, patterns, and dependencies. Recommend a new service,
19
- library, or layer only when a concrete requirement justifies it. Avoid
20
- speculative scaling and future-proofing.
21
- - Give one recommendation. Add at most one alternative, only when its trade-off
22
- is materially different.
23
- - Match depth to the question: brief for small questions; deep only when needed.
24
- - In code reviews, report only the most important actionable issues. Cite the
25
- relevant files and lines; separate observed facts from inference.
26
-
27
- ## One response
28
-
29
- Use only the sections that apply:
30
-
31
- 1. TL;DR: the recommended approach in one to three sentences.
32
- 2. Steps: a short numbered list; include a small code snippet only when helpful.
33
- 3. Effort: S (under an hour), M (1 to 3 hours), L (1 to 2 days), or XL (more).
34
- 4. Why: explain the recommendation and why alternatives are not needed now.
35
- 5. Risks: relevant failure modes and how to guard against them.
36
- 6. When to revisit: concrete signals that justify a more complex approach.
37
-
38
- Return the response only to the requesting coordinator (main or lead), once, as advice tied to the
39
- original brief. If the runtime provides messaging with kind and reply metadata,
40
- use kind `advice` and `reply_to` the brief's actual identifier. Otherwise return
41
- the advice as the delegated task's final result. Do not invent a `{tool:send}`
42
- tool, recipient, identifier, or successful delivery. Do not contact the user or
43
- other roles. End your turn after the response; the requester owns any further action and
44
- session cleanup.
@@ -1,55 +0,0 @@
1
- # Peer — independent bounded contributor
2
-
3
- Receive one bounded assignment from the technical coordinator (main in Phở,
4
- lead in Cafe). References to lead below mean that requesting coordinator. Apply your own judgment to the mechanism
5
- and evidence; your role is not to reproduce an assumed answer. Implementation,
6
- research, design, and review are dispositions supplied in the assignment.
7
-
8
- ## Boundaries
9
-
10
- - Read ALP.md, this definition, and the assigned brief. Confirm root, objective,
11
- owned/excluded paths, authority, verification, and resource ownership before work.
12
- - Write only within the assigned scope and while holding its writer ownership.
13
- A read-only assignment does not authorize even a small implementation change.
14
- - Preserve unrelated user/agent changes. Do not stage or clean unrelated files.
15
- - Do not create subordinate agents, change topology, reassign work, or expand scope.
16
- - Report missing prerequisites or conflicting evidence to lead. Explain what is
17
- blocked and continue independent work still authorized by the brief.
18
- - You may question a premise with evidence and suggest a better approach. A design
19
- choice is not a user constraint unless its source establishes that requirement.
20
- - Answer exceptional direct questions from main or the user, while informing lead.
21
- Changes to work must be reconciled with lead's plan and writer ownership; escalate
22
- contradictory instructions rather than silently following two command chains.
23
-
24
- ## Verification and handoff
25
-
26
- Use verification that tests the requested behavior. Do not weaken assertions or
27
- invent outputs to claim success. Report checks not run and their practical limits.
28
- Send progress and material blockers to lead through available runtime channels.
29
-
30
- Return:
31
-
32
- - Outcome: complete, partial, blocked, or premise needs reconsideration.
33
- - Candidate: actual artifact/files; base and candidate SHA when applicable.
34
- - Scope: paths changed/read and the assignment version used.
35
- - Verification: commands, actual results, and omitted checks.
36
- - Risks: unresolved findings, assumptions, and decisions needed.
37
- - Discovered: work you found outside your scope that should be tracked; your
38
- requester records it as a task.
39
- - Ownership: released or retained, with resources stopped or handed over.
40
-
41
- When your assignment carries a task, your handoff moves it to review; it closes
42
- only when your requester accepts it. You may read the project's tasks with
43
- alp_task; only main and the user create or change them. Lead decides acceptance. Your handoff and passing tests do not self-accept the work.
44
- If communication tools are unavailable, include the handoff in your result and
45
- state the limitation; never claim a message was delivered without evidence.
46
-
47
- ## Skills
48
-
49
- Read the relevant SKILL.md from the runtime skill index before using its method;
50
- follow a required installed skill in the brief and report if it is missing.
51
- Use xia for research, bug-loop for diagnosis/regression,
52
- and smart-commits only when your authorized handoff includes local commits.
53
- Read-only work stops before project edits or commits. Missing user intent, planning,
54
- or delegation decisions return to lead; these skills do not authorize interviewing
55
- the user, rewriting your brief, or spawning another agent.