@bvdm/delano 0.1.5 → 0.1.8

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 (145) hide show
  1. package/.delano/README.md +7 -0
  2. package/.delano/viewer/README.md +19 -0
  3. package/.delano/viewer/public/app.js +818 -0
  4. package/.delano/viewer/public/explorer.svg +3 -0
  5. package/.delano/viewer/public/index.html +21 -0
  6. package/.delano/viewer/public/markdown.svg +6 -0
  7. package/.delano/viewer/public/styles.css +1042 -0
  8. package/.delano/viewer/public/vscode.svg +24 -0
  9. package/.delano/viewer/server.js +389 -0
  10. package/HANDBOOK.md +66 -45
  11. package/README.md +21 -2
  12. package/assets/install-manifest.json +112 -23
  13. package/assets/payload/.agents/README.md +31 -6
  14. package/assets/payload/.agents/adapters/claude/README.md +22 -3
  15. package/assets/payload/.agents/adapters/codex/README.md +22 -3
  16. package/assets/payload/.agents/adapters/opencode/README.md +22 -3
  17. package/assets/payload/.agents/adapters/pi/README.md +22 -3
  18. package/assets/payload/.agents/common/log-safety.js +55 -0
  19. package/assets/payload/.agents/eval-fixtures/skill-output/invalid/missing-evidence/output.json +6 -0
  20. package/assets/payload/.agents/eval-fixtures/skill-output/valid/summary/output.json +7 -0
  21. package/assets/payload/.agents/fixtures/github/status-snapshot.json +6 -0
  22. package/assets/payload/.agents/fixtures/linear/issue-snapshot.json +6 -0
  23. package/assets/payload/.agents/hooks/bash-worktree-fix.sh +2 -1
  24. package/assets/payload/.agents/hooks/post-tool-logger.js +2 -1
  25. package/assets/payload/.agents/hooks/session-tracker.js +0 -0
  26. package/assets/payload/.agents/hooks/user-prompt-logger.js +17 -1
  27. package/assets/payload/.agents/logs/delivery-metrics.md +22 -0
  28. package/assets/payload/.agents/logs/schema.md +20 -1
  29. package/assets/payload/.agents/rules/delivery-modes.md +17 -0
  30. package/assets/payload/.agents/schemas/README.md +22 -0
  31. package/assets/payload/.agents/schemas/artifact-scope.json +237 -0
  32. package/assets/payload/.agents/schemas/artifacts/context.schema.json +11 -0
  33. package/assets/payload/.agents/schemas/artifacts/decision_log.schema.json +12 -0
  34. package/assets/payload/.agents/schemas/artifacts/evidence.schema.json +17 -0
  35. package/assets/payload/.agents/schemas/artifacts/plan.schema.json +83 -0
  36. package/assets/payload/.agents/schemas/artifacts/spec.schema.json +101 -0
  37. package/assets/payload/.agents/schemas/artifacts/task.schema.json +121 -0
  38. package/assets/payload/.agents/schemas/artifacts/update.schema.json +12 -0
  39. package/assets/payload/.agents/schemas/artifacts/workstream.schema.json +66 -0
  40. package/assets/payload/.agents/schemas/evidence-map.json +53 -0
  41. package/assets/payload/.agents/schemas/learning/closeout-learning-proposal.schema.json +20 -0
  42. package/assets/payload/.agents/schemas/learning/delivery-metric-event.schema.json +21 -0
  43. package/assets/payload/.agents/schemas/leases/lease.schema.json +39 -0
  44. package/assets/payload/.agents/schemas/metrics/delivery-event.schema.json +29 -0
  45. package/assets/payload/.agents/schemas/metrics/delivery-events.schema.json +49 -0
  46. package/assets/payload/.agents/schemas/operating-modes.json +42 -0
  47. package/assets/payload/.agents/schemas/status-transitions.json +31 -0
  48. package/assets/payload/.agents/schemas/sync/drift-report.schema.json +25 -0
  49. package/assets/payload/.agents/schemas/sync/drift-taxonomy.json +38 -0
  50. package/assets/payload/.agents/schemas/sync/sync-map.schema.json +39 -0
  51. package/assets/payload/.agents/scripts/README.md +1 -0
  52. package/assets/payload/.agents/scripts/audit-context-files.mjs +54 -0
  53. package/assets/payload/.agents/scripts/audit-context-scoring.mjs +14 -0
  54. package/assets/payload/.agents/scripts/build-drift-report.mjs +133 -0
  55. package/assets/payload/.agents/scripts/check-artifact-schemas.mjs +116 -0
  56. package/assets/payload/.agents/scripts/check-closeout-learning-proposals.mjs +23 -0
  57. package/assets/payload/.agents/scripts/check-context-audit.mjs +61 -0
  58. package/assets/payload/.agents/scripts/check-delivery-metric-events.mjs +35 -0
  59. package/assets/payload/.agents/scripts/check-delivery-metrics.mjs +52 -0
  60. package/assets/payload/.agents/scripts/check-evidence-map.mjs +143 -0
  61. package/assets/payload/.agents/scripts/check-github-status-inspection.mjs +93 -0
  62. package/assets/payload/.agents/scripts/check-github-sync.mjs +159 -0
  63. package/assets/payload/.agents/scripts/check-handoff-summaries.mjs +57 -0
  64. package/assets/payload/.agents/scripts/check-lease-conflicts.mjs +24 -0
  65. package/assets/payload/.agents/scripts/check-lease-contracts.mjs +17 -0
  66. package/assets/payload/.agents/scripts/check-linear-issue-inspection.mjs +63 -0
  67. package/assets/payload/.agents/scripts/check-local-sync-map.mjs +151 -0
  68. package/assets/payload/.agents/scripts/check-log-safety.sh +62 -0
  69. package/assets/payload/.agents/scripts/check-operating-modes.mjs +99 -0
  70. package/assets/payload/.agents/scripts/check-path-standards.sh +1 -1
  71. package/assets/payload/.agents/scripts/check-skill-output-evals.mjs +13 -0
  72. package/assets/payload/.agents/scripts/check-status-transitions.mjs +169 -0
  73. package/assets/payload/.agents/scripts/check-strict-fixtures.mjs +140 -0
  74. package/assets/payload/.agents/scripts/check-sync-schemas.mjs +52 -0
  75. package/assets/payload/.agents/scripts/check-text-safety.mjs +158 -0
  76. package/assets/payload/.agents/scripts/check-worktree-health.mjs +100 -0
  77. package/assets/payload/.agents/scripts/fix-path-standards.sh +1 -1
  78. package/assets/payload/.agents/scripts/git-sparse-download.sh +0 -0
  79. package/assets/payload/.agents/scripts/inspect-github-sync.mjs +108 -0
  80. package/assets/payload/.agents/scripts/lease-manager.mjs +88 -0
  81. package/assets/payload/.agents/scripts/log-event.js +3 -0
  82. package/assets/payload/.agents/scripts/log-event.sh +0 -0
  83. package/assets/payload/.agents/scripts/plan-sync-repairs.mjs +66 -0
  84. package/assets/payload/.agents/scripts/pm/blocked.sh +0 -0
  85. package/assets/payload/.agents/scripts/pm/epic-list.sh +0 -0
  86. package/assets/payload/.agents/scripts/pm/in-progress.sh +0 -0
  87. package/assets/payload/.agents/scripts/pm/init.sh +0 -0
  88. package/assets/payload/.agents/scripts/pm/next.sh +0 -0
  89. package/assets/payload/.agents/scripts/pm/prd-list.sh +0 -0
  90. package/assets/payload/.agents/scripts/pm/search.sh +0 -0
  91. package/assets/payload/.agents/scripts/pm/standup.sh +0 -0
  92. package/assets/payload/.agents/scripts/pm/status.sh +0 -0
  93. package/assets/payload/.agents/scripts/pm/validate.sh +657 -2
  94. package/assets/payload/.agents/scripts/propose-closeout-learning.mjs +20 -0
  95. package/assets/payload/.agents/scripts/query-log.sh +0 -0
  96. package/assets/payload/.agents/scripts/read-local-sync-map.mjs +135 -0
  97. package/assets/payload/.agents/scripts/select-next-task.mjs +22 -0
  98. package/assets/payload/.agents/scripts/summarize-project-metrics.mjs +15 -0
  99. package/assets/payload/.agents/scripts/test-and-log.sh +0 -0
  100. package/assets/payload/.agents/skills/README.md +6 -0
  101. package/assets/payload/.agents/skills/closeout-skill/SKILL.md +3 -0
  102. package/assets/payload/.agents/skills/closeout-skill/references/runbook.md +5 -2
  103. package/assets/payload/.agents/skills/closeout-skill/templates/closure-checklist.md +2 -0
  104. package/assets/payload/.agents/skills/closeout-skill/templates/learning-proposal.md +21 -0
  105. package/assets/payload/.agents/skills/closeout-skill/templates/learning-proposals.md +25 -0
  106. package/assets/payload/.agents/skills/manage-context/SKILL.md +55 -0
  107. package/assets/payload/.agents/skills/manage-context/references/context-audit-checklist.md +26 -0
  108. package/assets/payload/.agents/skills/manage-context/references/runbook.md +26 -0
  109. package/assets/payload/.agents/skills/manage-context/templates/context-debt-report.md +22 -0
  110. package/assets/payload/.agents/skills/manage-context/templates/context-refresh-summary.md +13 -0
  111. package/assets/payload/.agents/skills/onboarding/SKILL.md +49 -0
  112. package/assets/payload/.agents/skills/onboarding/references/agents-md-best-practices.md +76 -0
  113. package/assets/payload/.agents/skills/prototype-skill/SKILL.md +51 -0
  114. package/assets/payload/.agents/skills/prototype-skill/references/probe-design-checklist.md +26 -0
  115. package/assets/payload/.agents/skills/prototype-skill/references/runbook.md +27 -0
  116. package/assets/payload/.agents/skills/prototype-skill/templates/probe-approval-recommendation.md +13 -0
  117. package/assets/payload/.agents/skills/prototype-skill/templates/probe-findings.md +16 -0
  118. package/assets/payload/.agents/validation-fixtures/strict/invalid/broken-dependencies/dependency.md +18 -0
  119. package/assets/payload/.agents/validation-fixtures/strict/invalid/broken-dependencies/task.md +24 -0
  120. package/assets/payload/.agents/validation-fixtures/strict/invalid/invalid-transition/task.md +20 -0
  121. package/assets/payload/.agents/validation-fixtures/strict/invalid/missing-evidence/task.md +27 -0
  122. package/assets/payload/.agents/validation-fixtures/strict/invalid/path-leak/task.md +27 -0
  123. package/assets/payload/.agents/validation-fixtures/strict/invalid/stale-context/context.md +9 -0
  124. package/assets/payload/.agents/validation-fixtures/strict/manifest.json +11 -0
  125. package/assets/payload/.agents/validation-fixtures/strict/valid/minimal-project/task.md +27 -0
  126. package/assets/payload/.delano/viewer/README.md +19 -0
  127. package/assets/payload/.delano/viewer/public/app.js +818 -0
  128. package/assets/payload/.delano/viewer/public/explorer.svg +3 -0
  129. package/assets/payload/.delano/viewer/public/index.html +21 -0
  130. package/assets/payload/.delano/viewer/public/markdown.svg +6 -0
  131. package/assets/payload/.delano/viewer/public/styles.css +1042 -0
  132. package/assets/payload/.delano/viewer/public/vscode.svg +24 -0
  133. package/assets/payload/.delano/viewer/server.js +389 -0
  134. package/assets/payload/.project/templates/plan.md +1 -1
  135. package/assets/payload/.project/templates/spec.md +1 -1
  136. package/assets/payload/.project/templates/task.md +1 -0
  137. package/assets/payload/HANDBOOK.md +66 -45
  138. package/assets/payload/install-delano.sh +0 -0
  139. package/install-delano.sh +0 -0
  140. package/package.json +31 -2
  141. package/src/cli/commands/onboarding.js +29 -0
  142. package/src/cli/commands/viewer.js +81 -0
  143. package/src/cli/index.js +20 -0
  144. package/src/cli/lib/install.js +1 -0
  145. package/src/cli/lib/onboarding.js +243 -0
@@ -0,0 +1,20 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);
5
+ const repoRoot = resolveRepoRoot(__dirname);
6
+ const project = readOption("--project") || "delano-learning-loop";
7
+ const metricsPath = readOption("--metrics") || path.join(repoRoot, ".agents", "metrics", "delivery-events.jsonl");
8
+ const metrics = readEvents(metricsPath).filter((event)=>event.project === project || !event.project);
9
+ const proposal = {
10
+ schema_version: 1,
11
+ mode: "dry-run-proposal",
12
+ project,
13
+ apply_posture: "proposal-only-no-mutation",
14
+ summary: { event_count: metrics.length, recommendation_count: 1, privacy: "summary-only" },
15
+ recommendations: [{ id: "LP-001", type: "closeout-learning", summary: metrics.length ? "Review summarized delivery metrics during closeout." : "Capture at least one delivery metric event during future closeouts.", evidence: ["scripts/summarize-project-metrics.mjs", ".agents/logs/delivery-metrics.md"] }]
16
+ };
17
+ if (process.argv.includes("--json")) console.log(JSON.stringify(proposal,null,2)); else console.log(`Closeout learning proposal produced ${proposal.summary.recommendation_count} recommendation(s) for ${project}.`);
18
+ function readEvents(filePath){ if(!existsSync(filePath)) return []; return readFileSync(filePath,"utf8").split(/\r?\n/).filter(Boolean).map(line=>JSON.parse(line)); }
19
+ function readOption(name){ const i=process.argv.indexOf(name); return i===-1?"":process.argv[i+1]; }
20
+ function resolveRepoRoot(startDir){ for(const c of [path.resolve(startDir,".."),path.resolve(startDir,"..","..")]) if(existsSync(path.join(c,".agents"))) return c; return path.resolve(startDir,".."); }
File without changes
@@ -0,0 +1,135 @@
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ const repoRoot = resolveRepoRoot(__dirname);
8
+
9
+ export function readLocalSyncMap(root = repoRoot) {
10
+ const projectsRoot = path.join(root, ".project", "projects");
11
+ const registryPath = path.join(root, ".project", "registry", "linear-map.json");
12
+ const registry = readOptionalJson(registryPath) || { projects: {}, tasks: {} };
13
+ const projects = [];
14
+
15
+ for (const projectDir of listProjectDirs(projectsRoot)) {
16
+ const slug = path.basename(projectDir);
17
+ const projectRegistry = registry.projects?.[slug] || {};
18
+ const tasks = [];
19
+ const tasksDir = path.join(projectDir, "tasks");
20
+ if (existsSync(tasksDir)) {
21
+ for (const taskFile of readdirSync(tasksDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => path.join(tasksDir, entry.name)).sort()) {
22
+ const text = readFileSync(taskFile, "utf8");
23
+ const fm = parseFrontmatter(text);
24
+ const registryKey = `${slug}/${fm.id || path.basename(taskFile, ".md")}`;
25
+ const taskRegistry = registry.tasks?.[registryKey] || registry.tasks?.[fm.id] || {};
26
+ tasks.push({
27
+ local_id: fm.id || path.basename(taskFile, ".md"),
28
+ name: fm.name || titleFromMarkdown(text) || path.basename(taskFile, ".md"),
29
+ status: fm.status || "unknown",
30
+ workstream: fm.workstream || "",
31
+ local_path: toRepoPath(root, taskFile),
32
+ depends_on: parseList(fm.depends_on || "[]"),
33
+ linear_issue_id: emptyToUndefined(fm.linear_issue_id) || taskRegistry.linear_issue_id,
34
+ github_issue: emptyToUndefined(fm.github_issue) || taskRegistry.github_issue,
35
+ github_pr: emptyToUndefined(fm.github_pr) || taskRegistry.github_pr
36
+ });
37
+ }
38
+ }
39
+ projects.push({
40
+ slug,
41
+ local_path: toRepoPath(root, projectDir),
42
+ linear_project_id: projectRegistry.linear_project_id,
43
+ github_repo: projectRegistry.github_repo,
44
+ tasks
45
+ });
46
+ }
47
+
48
+ return { schema_version: 1, source: "local", projects };
49
+ }
50
+
51
+ export function validateLocalSyncMap(syncMap) {
52
+ const errors = [];
53
+ const seenProjects = new Set();
54
+ for (const project of syncMap.projects || []) {
55
+ if (seenProjects.has(project.slug)) errors.push(`duplicate project slug: ${project.slug}`);
56
+ seenProjects.add(project.slug);
57
+ if (!/^\.project\/projects\/[^/]+$/.test(project.local_path || "")) errors.push(`invalid project local_path for ${project.slug}: ${project.local_path}`);
58
+ const seenTasks = new Set();
59
+ for (const task of project.tasks || []) {
60
+ if (!/^T-[0-9]{3}$/.test(task.local_id || "")) errors.push(`${project.slug} has invalid task id: ${task.local_id}`);
61
+ if (seenTasks.has(task.local_id)) errors.push(`${project.slug} has duplicate task id: ${task.local_id}`);
62
+ seenTasks.add(task.local_id);
63
+ for (const dependency of task.depends_on || []) {
64
+ if (!seenTasks.has(dependency) && !(project.tasks || []).some((candidate) => candidate.local_id === dependency)) {
65
+ errors.push(`${project.slug}/${task.local_id} depends on missing local task ${dependency}`);
66
+ }
67
+ }
68
+ if (task.github_issue && !isUrlOrNumber(task.github_issue)) errors.push(`${project.slug}/${task.local_id} has invalid github_issue: ${task.github_issue}`);
69
+ if (task.github_pr && !isUrlOrNumber(task.github_pr)) errors.push(`${project.slug}/${task.local_id} has invalid github_pr: ${task.github_pr}`);
70
+ }
71
+ }
72
+ return errors;
73
+ }
74
+
75
+ if (import.meta.url === `file://${process.argv[1]}`) {
76
+ const syncMap = readLocalSyncMap(repoRoot);
77
+ const errors = validateLocalSyncMap(syncMap);
78
+ if (process.argv.includes("--json")) {
79
+ console.log(JSON.stringify(syncMap, null, 2));
80
+ }
81
+ if (errors.length > 0) {
82
+ console.error("Local sync map validation failed:");
83
+ for (const error of errors) console.error(`- ${error}`);
84
+ process.exit(1);
85
+ }
86
+ if (!process.argv.includes("--json")) {
87
+ const taskCount = syncMap.projects.reduce((sum, project) => sum + project.tasks.length, 0);
88
+ console.log(`Local sync map check passed for ${syncMap.projects.length} project(s) and ${taskCount} task(s).`);
89
+ }
90
+ }
91
+
92
+ function listProjectDirs(projectsRoot) {
93
+ if (!existsSync(projectsRoot)) return [];
94
+ return readdirSync(projectsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path.join(projectsRoot, entry.name)).sort();
95
+ }
96
+ function parseFrontmatter(text) {
97
+ const match = text.match(/^---\n([\s\S]*?)\n---\n/);
98
+ if (!match) return {};
99
+ const result = {};
100
+ for (const line of match[1].split("\n")) {
101
+ const index = line.indexOf(":");
102
+ if (index === -1) continue;
103
+ result[line.slice(0, index).trim()] = line.slice(index + 1).trim();
104
+ }
105
+ return result;
106
+ }
107
+ function parseList(raw) {
108
+ const value = String(raw || "").trim();
109
+ if (!value || value === "[]") return [];
110
+ if (value.startsWith("[") && value.endsWith("]")) return value.slice(1, -1).split(",").map((item) => item.trim().replace(/^['\"]|['\"]$/g, "")).filter(Boolean);
111
+ return [value.replace(/^['\"]|['\"]$/g, "")].filter(Boolean);
112
+ }
113
+ function titleFromMarkdown(text) {
114
+ const match = text.match(/^#\s+(.+)$/m);
115
+ return match ? match[1].replace(/^Task:\s*/, "").trim() : "";
116
+ }
117
+ function emptyToUndefined(value) {
118
+ const trimmed = String(value || "").trim();
119
+ return trimmed ? trimmed : undefined;
120
+ }
121
+ function isUrlOrNumber(value) {
122
+ return /^https?:\/\//.test(value) || /^#?[0-9]+$/.test(value);
123
+ }
124
+ function readOptionalJson(filePath) {
125
+ if (!existsSync(filePath)) return null;
126
+ return JSON.parse(readFileSync(filePath, "utf8"));
127
+ }
128
+ function toRepoPath(root, filePath) {
129
+ return path.relative(root, filePath).split(path.sep).join("/");
130
+ }
131
+ function resolveRepoRoot(startDir) {
132
+ const candidates = [path.resolve(startDir, ".."), path.resolve(startDir, "..", "..")];
133
+ for (const candidate of candidates) if (existsSync(path.join(candidate, ".project")) && existsSync(path.join(candidate, ".agents"))) return candidate;
134
+ return path.resolve(startDir, "..");
135
+ }
@@ -0,0 +1,22 @@
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ const repoRoot = resolveRepoRoot(__dirname);
7
+ const projectSlug = readOption("--project") || "delano-multi-agent-execution";
8
+ const stream = readOption("--stream") || "default";
9
+ const tasksDir = path.join(repoRoot, ".project", "projects", projectSlug, "tasks");
10
+ const leases = readLeases(readOption("--leases") || path.join(repoRoot, ".agents", "leases", "active-leases.json"));
11
+ const ready = readdirSync(tasksDir).filter((file)=>file.endsWith(".md")).map((file)=>readTask(path.join(tasksDir,file))).filter((task)=>task.status === "ready");
12
+ const activeZones = new Set(leases.filter((l)=>l.status === "active" && new Date(l.expires_at).getTime() > Date.now()).flatMap((l)=>l.conflict_zones || []));
13
+ const candidates = ready.map((task)=>({ ...task, stream, blocked_by_active_zone: task.conflicts_with.some((zone)=>activeZones.has(zone)) })).filter((task)=>!task.blocked_by_active_zone);
14
+ const selected = candidates[0] || null;
15
+ const result = { schema_version: 1, project: projectSlug, stream, ready_count: ready.length, candidate_count: candidates.length, selected: selected && { id: selected.id, file: selected.file, priority: selected.priority } };
16
+ if (process.argv.includes("--json")) console.log(JSON.stringify(result, null, 2)); else console.log(selected ? `Selected ${selected.id} for ${stream}.` : `No unleased ready task for ${stream}.`);
17
+ export function readTask(filePath) { const text=readFileSync(filePath,"utf8"); return { file:path.basename(filePath), id: front(text,"id"), status: front(text,"status"), priority: front(text,"priority"), conflicts_with: list(front(text,"conflicts_with")) }; }
18
+ function front(text,key){ const m=text.match(new RegExp(`^${key}:\\s*(.*)$`,"m")); return m?m[1].trim():""; }
19
+ function list(v){ const m=v.match(/^\[(.*)\]$/); return m?m[1].split(",").map(x=>x.trim()).filter(Boolean):[]; }
20
+ function readLeases(filePath){ if(!existsSync(filePath)) return []; return JSON.parse(readFileSync(filePath,"utf8")).leases || []; }
21
+ function readOption(name){ const i=process.argv.indexOf(name); return i===-1?"":process.argv[i+1]; }
22
+ function resolveRepoRoot(startDir){ for(const c of [path.resolve(startDir,".."),path.resolve(startDir,"..","..")]) if(existsSync(path.join(c,".project"))) return c; return path.resolve(startDir,".."); }
@@ -0,0 +1,15 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);
5
+ const repoRoot = resolveRepoRoot(__dirname);
6
+ const eventsPath = readOption("--events") || path.join(repoRoot, ".agents", "metrics", "delivery-events.jsonl");
7
+ const project = readOption("--project") || "all";
8
+ const events = readEvents(eventsPath).filter((e)=>project === "all" || e.project === project);
9
+ const byType = Object.create(null);
10
+ for (const e of events) byType[e.event_type] = (byType[e.event_type] || 0) + 1;
11
+ const summary = { schema_version: 1, project, event_count: events.length, by_type: byType, privacy: "summary-only" };
12
+ if (process.argv.includes("--json")) console.log(JSON.stringify(summary, null, 2)); else console.log(`Project metrics summary: ${events.length} event(s), privacy=summary-only.`);
13
+ function readEvents(filePath){ if(!existsSync(filePath)) return []; return readFileSync(filePath,"utf8").split(/\r?\n/).filter(Boolean).map((line)=>JSON.parse(line)); }
14
+ function readOption(name){ const i=process.argv.indexOf(name); return i===-1?"":process.argv[i+1]; }
15
+ function resolveRepoRoot(startDir){ for(const c of [path.resolve(startDir,".."),path.resolve(startDir,"..","..")]) if(existsSync(path.join(c,".agents"))) return c; return path.resolve(startDir,".."); }
File without changes
@@ -5,6 +5,7 @@ Handbook-aligned skill contracts.
5
5
  Core workflow skills:
6
6
 
7
7
  - `discovery-skill`
8
+ - `prototype-skill`
8
9
  - `planning-skill`
9
10
  - `breakdown-skill`
10
11
  - `sync-skill`
@@ -13,6 +14,11 @@ Core workflow skills:
13
14
  - `closeout-skill`
14
15
  - `learning-skill`
15
16
 
17
+ Utility skills:
18
+
19
+ - `manage-context`
20
+ - `onboarding`
21
+
16
22
  Each skill defines:
17
23
  - intent and trigger context
18
24
  - required inputs
@@ -17,11 +17,13 @@ description: Close the delivery loop and capture completion evidence, status upd
17
17
  - closure update
18
18
  - completion summary
19
19
  - updated status in contracts/registry
20
+ - learning proposals for any rule, skill, schema, or fixture changes discovered during closeout
20
21
 
21
22
  ## Quality checks
22
23
  - required tasks resolved
23
24
  - evidence package complete
24
25
  - outcome review captured
26
+ - learning proposals are reviewed before adoption
25
27
 
26
28
  ## Failure behavior
27
29
  - block closure when evidence is incomplete
@@ -40,3 +42,4 @@ description: Close the delivery loop and capture completion evidence, status upd
40
42
  - `references/runbook.md`
41
43
  - `templates/outcome-review.md`
42
44
  - `templates/closure-checklist.md`
45
+ - `templates/learning-proposal.md`
@@ -3,8 +3,10 @@
3
3
  1. Confirm all required tasks are in terminal state.
4
4
  2. Ensure quality evidence package is complete.
5
5
  3. Write completion summary from template.
6
- 4. Update project status and mapping registry.
7
- 5. Review event log:
6
+ 4. Draft a learning proposal for any proposed rule, skill, schema, or fixture update.
7
+ 5. Keep learning proposals in `proposed` state until reviewed and explicitly accepted.
8
+ 6. Update project status and mapping registry.
9
+ 7. Review event log:
8
10
  - `bash .agents/scripts/query-log.sh --last 100`
9
11
  6. Validate:
10
12
  - `bash .agents/scripts/pm/status.sh`
@@ -12,5 +14,6 @@
12
14
 
13
15
  Exit gate:
14
16
  - Outcome review captured
17
+ - Learning proposals reviewed before adoption
15
18
  - Evidence complete
16
19
  - Delivery state closed cleanly
@@ -4,4 +4,6 @@
4
4
  - [ ] Quality gates passed
5
5
  - [ ] Evidence package complete
6
6
  - [ ] Registry/state updated
7
+ - [ ] Learning proposals drafted for rule, skill, schema, or fixture changes
8
+ - [ ] Learning proposals reviewed before adoption
7
9
  - [ ] Retrospective scheduled
@@ -0,0 +1,21 @@
1
+ # Closeout Learning Proposal
2
+
3
+ ## Proposal Type
4
+ rule | skill | schema | fixture
5
+
6
+ ## Title
7
+
8
+ ## Rationale
9
+ What happened, what should change, and why the change is worth reviewing.
10
+
11
+ ## Target Paths
12
+ - repo/relative/path
13
+
14
+ ## Evidence
15
+ - command, task, fixture, or local event summary
16
+
17
+ ## Review Gate
18
+ Required before adoption. Do not apply the proposed rule, skill, schema, or fixture change until it has been reviewed and explicitly accepted.
19
+
20
+ ## Adoption Status
21
+ proposed
@@ -0,0 +1,25 @@
1
+ # Closeout Learning Proposals
2
+
3
+ Use this during project closeout to propose reusable runtime changes. Proposals are review-first: do not silently adopt changes to shared rules, skills, schemas, or fixtures.
4
+
5
+ ## Proposal Summary
6
+
7
+ - Project:
8
+ - Source closeout/update:
9
+ - Reviewer:
10
+ - Review status: pending
11
+
12
+ ## Proposed Changes
13
+
14
+ | Target type | Target path | Change summary | Evidence | Adoption state |
15
+ | --- | --- | --- | --- | --- |
16
+ | rule | `.agents/rules/example.md` | Replace with the observed improvement. | Link task/update evidence. | proposed |
17
+ | skill | `.agents/skills/example-skill/SKILL.md` | Replace with the observed improvement. | Link task/update evidence. | proposed |
18
+ | schema | `.agents/schemas/example.schema.json` | Replace with the observed improvement. | Link task/update evidence. | proposed |
19
+ | fixture | `.agents/validation-fixtures/example.json` | Replace with the observed improvement. | Link task/update evidence. | proposed |
20
+
21
+ ## Review Gate
22
+
23
+ - [ ] Every proposal cites observed evidence.
24
+ - [ ] No proposal is adopted before review status is approved.
25
+ - [ ] Rejected proposals retain the reason for future context.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: manage-context
3
+ description: Repair and maintain `.project/context/` so it reflects current project reality. Use when context files are stale, contradictory, still template-like, after major scope or architecture changes, before handoff, or when execution friction suggests context debt.
4
+ ---
5
+
6
+ # manage-context
7
+
8
+ ## Trigger context
9
+ - `.project/context/` still contains starter or placeholder language
10
+ - implementation reality has drifted from spec, plan, or workstreams
11
+ - repeated confusion appears around scope, terminology, ownership, architecture, or testing
12
+ - a handoff, restart, or milestone review needs trustworthy context
13
+ - a major scope, workflow, or architecture change landed and context was not refreshed
14
+
15
+ ## Required inputs
16
+ - current `.project/context/` files
17
+ - related project docs (`spec.md`, `plan.md`, `workstreams/*.md`, `decisions.md`, progress notes)
18
+ - recent execution evidence (task state, code changes, review feedback, logs)
19
+
20
+ ## Output schema
21
+ - updated `.project/context/*.md` files where needed
22
+ - context debt summary
23
+ - explicit contradictions or evidence gaps list
24
+ - recommended follow-up actions when context cannot be repaired safely
25
+
26
+ ## Quality checks
27
+ - no obvious template placeholders remain
28
+ - context matches current implementation and delivery reality
29
+ - terminology is consistent across files
30
+ - scope, constraints, and non-goals are explicit
31
+ - progress reflects evidence, not aspiration
32
+ - unresolved uncertainty is stated plainly instead of being hidden
33
+
34
+ ## Failure behavior
35
+ - do not invent missing facts
36
+ - stop short of rewriting uncertain sections as if they were confirmed
37
+ - return evidence gaps and contradiction notes when repair is partial
38
+ - prefer an explicit partial refresh over fake completeness
39
+
40
+ ## Allowed side effects
41
+ - update files under `.project/context/`
42
+ - remove stale placeholder text from context files
43
+ - normalize duplicated or conflicting phrasing across context files
44
+ - add concise dated notes when they improve handoff clarity
45
+
46
+ ## Script hooks
47
+ - `bash .agents/scripts/pm/validate.sh`
48
+ - `bash .agents/scripts/pm/status.sh`
49
+ - `bash .agents/scripts/pm/search.sh "<term>"`
50
+
51
+ ## Execution assets
52
+ - `references/runbook.md`
53
+ - `references/context-audit-checklist.md`
54
+ - `templates/context-debt-report.md`
55
+ - `templates/context-refresh-summary.md`
@@ -0,0 +1,26 @@
1
+ # Context Audit Checklist
2
+
3
+ Use this checklist before declaring the context pack healthy.
4
+
5
+ ## Reality check
6
+ - Does `project-overview.md` describe the project as it exists now?
7
+ - Does `project-brief.md` still match the active outcome and constraints?
8
+ - Does `tech-context.md` match the real implementation shape?
9
+ - Does `product-context.md` match the real user or delivery problem?
10
+ - Does `progress.md` describe actual current status rather than intended status?
11
+
12
+ ## Drift check
13
+ - Are there claims that conflict with `spec.md`, `plan.md`, or workstreams?
14
+ - Are there terms used inconsistently across context files?
15
+ - Are owners, boundaries, or dependencies implied in one file but absent in others?
16
+ - Are testing expectations current, especially in `gui-testing.md`?
17
+
18
+ ## Template debt check
19
+ - Are placeholder markers or generic starter phrases still present?
20
+ - Are sections filled with boilerplate rather than repo-specific facts?
21
+ - Does the pack still read like an install scaffold instead of a lived project?
22
+
23
+ ## Handoff check
24
+ - Could a new agent or teammate resume work from this context pack without guessing?
25
+ - Are the main constraints, risks, and non-goals easy to find?
26
+ - Are open questions explicit?
@@ -0,0 +1,26 @@
1
+ # Context Runbook
2
+
3
+ 1. Read `.project/context/README.md` to confirm the expected context pack shape.
4
+ 2. Review all current `.project/context/*.md` files.
5
+ 3. Cross-check the context pack against the active source of truth:
6
+ - `.project/projects/<slug>/spec.md`
7
+ - `.project/projects/<slug>/plan.md`
8
+ - `.project/projects/<slug>/workstreams/*.md`
9
+ - `.project/projects/<slug>/decisions.md`
10
+ - recent task state, code changes, and review feedback
11
+ 4. Mark context debt before editing:
12
+ - stale claims
13
+ - template placeholders
14
+ - contradictory terminology
15
+ - missing constraints or ownership
16
+ - progress statements without evidence
17
+ 5. Repair only what the evidence supports.
18
+ 6. Record unresolved contradictions or evidence gaps explicitly.
19
+ 7. Validate:
20
+ - `bash .agents/scripts/pm/validate.sh`
21
+ - `bash .agents/scripts/pm/status.sh`
22
+
23
+ Exit gate:
24
+ - context pack is trustworthy enough for handoff or resumed execution
25
+ - open uncertainty is visible
26
+ - no placeholder text remains in edited sections
@@ -0,0 +1,22 @@
1
+ # Context Debt Report
2
+
3
+ ## Summary
4
+
5
+ ## Stale or Contradictory Sections
6
+ - File:
7
+ - Issue:
8
+ - Evidence:
9
+ - Action:
10
+
11
+ ## Placeholder or Template Debt
12
+ - File:
13
+ - Section:
14
+ - Replacement needed:
15
+
16
+ ## Missing Context
17
+ - Gap:
18
+ - Why it matters:
19
+ - Best source of truth:
20
+
21
+ ## Recommended Follow-up
22
+ -
@@ -0,0 +1,13 @@
1
+ # Context Refresh Summary
2
+
3
+ ## Refreshed Files
4
+ -
5
+
6
+ ## What Changed
7
+ -
8
+
9
+ ## Remaining Uncertainty
10
+ -
11
+
12
+ ## Next Action
13
+ - Resume execution or handoff using the refreshed context pack.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: onboarding
3
+ description: Analyze a repository `AGENTS.md` before broader work begins and improve it only when the user gives explicit approval. Use when the user wants a first-pass review of repo instructions, wants to tighten `AGENTS.md` quality, or needs a compact operating-rules and source-of-truth map for future agent turns.
4
+ ---
5
+
6
+ # onboarding
7
+
8
+ ## Trigger context
9
+ - the user wants an explicit first-turn onboarding pass for a repository
10
+ - `AGENTS.md` exists but may be too thin, stale, or missing key guidance
11
+ - the user asks to review, critique, or improve repo-level agent instructions
12
+ - Delano has just been introduced and `AGENTS.md` should be checked before deeper work starts
13
+
14
+ ## Required inputs
15
+ - repo-root `AGENTS.md`
16
+ - directly relevant source-of-truth docs referenced by `AGENTS.md`
17
+ - explicit user approval before analyzing `AGENTS.md`
18
+ - separate explicit user approval before editing `AGENTS.md`
19
+
20
+ ## Output schema
21
+ - concise gap analysis against `references/agents-md-best-practices.md`
22
+ - keep/add/remove recommendations tied to the repo's actual workflow
23
+ - if edit approval is given, an updated `AGENTS.md` that stays compact and retrieval-oriented
24
+ - explicit note when analysis or edits were skipped because approval was not given
25
+
26
+ ## Quality checks
27
+ - do not analyze `AGENTS.md` until the user explicitly approves the review
28
+ - do not edit `AGENTS.md` until the user explicitly approves changes
29
+ - preserve repo-specific truth instead of pasting generic boilerplate
30
+ - keep `AGENTS.md` compact and point to deeper docs instead of duplicating them
31
+ - make approval boundaries, order of operations, and verification expectations explicit
32
+
33
+ ## Failure behavior
34
+ - if approval is missing, stop and ask plainly
35
+ - if `AGENTS.md` is absent, report that and propose only a minimal skeleton
36
+ - if source-of-truth docs disagree, surface the conflict instead of flattening it
37
+ - if the repo intentionally keeps `AGENTS.md` thin, prefer the minimum coherent improvement
38
+
39
+ ## Allowed side effects
40
+ - read `AGENTS.md` and directly relevant source-of-truth docs
41
+ - update `AGENTS.md` only after explicit edit approval
42
+ - add concise retrieval hints that point to canonical docs
43
+
44
+ ## Script hooks
45
+ - `delano onboarding`
46
+ - `bash .agents/scripts/pm/validate.sh`
47
+
48
+ ## Execution assets
49
+ - `references/agents-md-best-practices.md`
@@ -0,0 +1,76 @@
1
+ # How to write an AGENTS.md that works
2
+
3
+ AGENTS.md carries the context the agent needs every turn. Skills and `docs/` hold optional, task-specific workflows. Do not confuse the two.
4
+
5
+ ## What belongs in AGENTS.md
6
+
7
+ 1. Operating rules: startup sequence, approval boundaries, destructive-action handling, definition of done, default workspace.
8
+ 2. Source-of-truth map: compact index pointing to where real knowledge lives. Include version-sensitive areas and "if working on X, read Y first" hints.
9
+ 3. Order-of-operations: phrase as a sequence, not a blanket rule. Not "always read docs first" but: explore structure -> retrieve relevant docs -> implement -> verify.
10
+ 4. Stable, high-impact constraints: repo location, branch policy, style rules, runtime quirks, business-logic conventions. High-frequency, high-impact, easy to miss.
11
+
12
+ ## What does not belong
13
+
14
+ Long prose, full runbooks, rarely-used procedures, or anything duplicated from `docs/`. Point to it instead.
15
+
16
+ ## Example skeleton (Delano-style)
17
+
18
+ ```markdown
19
+ ## Mission
20
+ One line: what this project is, what good work looks like.
21
+
22
+ ## First-Turn Workflow
23
+ 1. Inspect repo structure and current git state before assuming shape or ownership.
24
+ 2. Read the relevant local source of truth for the area being changed.
25
+ 3. Prefer current repo reality over stale plans or model memory.
26
+ 4. Make the smallest coherent change that satisfies the task.
27
+ 5. Verify with the narrowest meaningful check, then report done / partial / blocked explicitly.
28
+
29
+ ## Source of Truth
30
+ - `HANDBOOK.md`: delivery model, project contracts, evidence, continuity rules.
31
+ - `ARCHITECTURE.md`: product architecture and runtime/orchestration model.
32
+ - `.project/context/`: current project memory - start with `README.md`, then only what is relevant.
33
+ - `.project/projects/<project>/`: active delivery contracts (`spec.md`, `plan.md`, `decisions.md`, `workstreams/`, `tasks/`, `updates/`).
34
+ - `.agents/`: shared delivery/runtime assets, skills, rules, hooks, PM scripts.
35
+ - `README.md`: product status, setup, commands, operational gaps.
36
+ - `src/`, `skills/`, `starter/`, `fixtures/`, `tests/`: implemented surface.
37
+ - `possible-specs.md`: archived only - not active guidance.
38
+
39
+ ## Retrieval Index
40
+ - Delivery workflow -> `HANDBOOK.md` + matching `.agents/skills/<step>-skill/SKILL.md`
41
+ - Active scope / acceptance -> `spec.md` + relevant task files
42
+ - Architecture / runtime -> `ARCHITECTURE.md`, `plan.md`, `.project/context/system-patterns.md`
43
+ - Repo layout -> `.project/context/project-structure.md`
44
+ - Stack / commands -> `.project/context/tech-context.md`, `README.md`, `package.json`
45
+ - Style / docs conventions -> `.project/context/project-style-guide.md`
46
+ - GUI/browser checks -> `.project/context/gui-testing.md`
47
+ - Status / evidence -> `.project/context/progress.md`, `updates/`
48
+ - CRM/provider work -> `src/connectors/`, `fixtures/providers/`, provider tests
49
+ - Starter/runtime assets -> `starter/`, `.runtime/` expectations, starter validation tests
50
+
51
+ ## Delano Order of Operations
52
+ Use the full flow for features, contract changes, or material improvements:
53
+ 1. Discovery - define measurable outcome in `spec.md` (`discovery-skill`).
54
+ 2. Prototype Probe - time-boxed, only if uncertainty is high; findings back to spec.
55
+ 3. Planning - architecture, milestones, rollout, rollback in `plan.md` (`planning-skill`).
56
+ 4. Breakdown - atomic tasks, binary acceptance, acyclic dependencies (`breakdown-skill`).
57
+ 5. Synchronization - reconcile with Linear/GitHub when tracker state is involved (`sync-skill`).
58
+ 6. Execution - dependency-safe tasks inside workstream boundaries, evidence in `updates/` (`execution-skill`).
59
+ 7. Quality Ops - risk-based checks, verify acceptance before closure (`quality-skill`).
60
+ 8. Closeout - compare to outcome, update project memory, close the loop (`closeout-skill`).
61
+
62
+ For small local fixes: follow the first-turn workflow; update delivery/context files only when scope, architecture, status, or evidence changes.
63
+
64
+ ## Safety
65
+ - No destructive actions without approval.
66
+ - Prefer recoverable edits.
67
+ - Confirm before outbound/public actions.
68
+
69
+ ## Verification
70
+ - Run lint/test/build when relevant; if skipped, say why.
71
+ - Mark done / partial / blocked explicitly.
72
+ ```
73
+
74
+ ## Core principle
75
+
76
+ AGENTS.md should contain the minimum persistent context needed to make correct decisions reliably, and a compact map for retrieving everything else.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: prototype-skill
3
+ description: Run a time-boxed Prototype Probe to retire material uncertainty before spec approval. Use when `spec.md` is still draft, `probe_required: true`, or a narrow experiment is needed to bound technical or delivery risk before planning.
4
+ ---
5
+
6
+ # prototype-skill
7
+
8
+ ## Trigger context
9
+ - `spec.md` is still draft and contains material uncertainty
10
+ - `probe_required: true`
11
+ - approval would otherwise be speculative
12
+ - a narrow experiment can retire a specific technical, UX, integration, or delivery risk faster than discussion alone
13
+
14
+ ## Required inputs
15
+ - `spec.md` with uncertainty and probe fields populated
16
+ - target uncertainty to retire or bound
17
+ - time-box and experiment constraints
18
+ - success or failure evidence expected from the probe
19
+
20
+ ## Output schema
21
+ - updated draft `spec.md`
22
+ - probe findings summary
23
+ - explicit approval recommendation (`approve`, `revise`, or `run another narrow probe`)
24
+ - touched surfaces and footguns list
25
+
26
+ ## Quality checks
27
+ - probe stays time-boxed, normally `<= 1 day`
28
+ - experiment is narrow and directly tied to the uncertainty being tested
29
+ - no production merge happens directly from probe output
30
+ - findings are folded back into `spec.md` before continuation
31
+ - touched surfaces, footguns, and remaining uncertainty are explicit
32
+
33
+ ## Failure behavior
34
+ - stop if the probe is too broad, open-ended, or not tied to a material uncertainty
35
+ - return a narrower probe design when the current one is not safe or useful
36
+ - do not present exploratory output as production-ready implementation
37
+
38
+ ## Allowed side effects
39
+ - update draft `spec.md`
40
+ - create or update temporary probe notes inside the project folder when needed
41
+ - record approval recommendation and follow-up actions
42
+
43
+ ## Script hooks
44
+ - `bash .agents/scripts/pm/validate.sh`
45
+ - `bash .agents/scripts/pm/status.sh`
46
+
47
+ ## Execution assets
48
+ - `references/runbook.md`
49
+ - `references/probe-design-checklist.md`
50
+ - `templates/probe-findings.md`
51
+ - `templates/probe-approval-recommendation.md`