@autonomos/core 0.7.0 → 0.7.1

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/dist/index.d.mts CHANGED
@@ -59,36 +59,46 @@ declare const InstallerSchema: z.ZodEffects<z.ZodObject<{
59
59
  targetDir: z.ZodOptional<z.ZodString>;
60
60
  skillsDir: z.ZodOptional<z.ZodString>;
61
61
  commandsDir: z.ZodOptional<z.ZodString>;
62
+ promptsDir: z.ZodOptional<z.ZodString>;
62
63
  globalTargetDir: z.ZodOptional<z.ZodString>;
63
64
  fileExtension: z.ZodString;
65
+ _note: z.ZodOptional<z.ZodString>;
64
66
  }, "strip", z.ZodTypeAny, {
65
67
  fileExtension: string;
66
68
  workflowsDir?: string | undefined;
67
69
  targetDir?: string | undefined;
68
70
  skillsDir?: string | undefined;
69
71
  commandsDir?: string | undefined;
72
+ promptsDir?: string | undefined;
70
73
  globalTargetDir?: string | undefined;
74
+ _note?: string | undefined;
71
75
  }, {
72
76
  fileExtension: string;
73
77
  workflowsDir?: string | undefined;
74
78
  targetDir?: string | undefined;
75
79
  skillsDir?: string | undefined;
76
80
  commandsDir?: string | undefined;
81
+ promptsDir?: string | undefined;
77
82
  globalTargetDir?: string | undefined;
83
+ _note?: string | undefined;
78
84
  }>, {
79
85
  fileExtension: string;
80
86
  workflowsDir?: string | undefined;
81
87
  targetDir?: string | undefined;
82
88
  skillsDir?: string | undefined;
83
89
  commandsDir?: string | undefined;
90
+ promptsDir?: string | undefined;
84
91
  globalTargetDir?: string | undefined;
92
+ _note?: string | undefined;
85
93
  }, {
86
94
  fileExtension: string;
87
95
  workflowsDir?: string | undefined;
88
96
  targetDir?: string | undefined;
89
97
  skillsDir?: string | undefined;
90
98
  commandsDir?: string | undefined;
99
+ promptsDir?: string | undefined;
91
100
  globalTargetDir?: string | undefined;
101
+ _note?: string | undefined;
92
102
  }>;
93
103
  /**
94
104
  * A single harness entry.
@@ -101,36 +111,46 @@ declare const HarnessSchema: z.ZodObject<{
101
111
  targetDir: z.ZodOptional<z.ZodString>;
102
112
  skillsDir: z.ZodOptional<z.ZodString>;
103
113
  commandsDir: z.ZodOptional<z.ZodString>;
114
+ promptsDir: z.ZodOptional<z.ZodString>;
104
115
  globalTargetDir: z.ZodOptional<z.ZodString>;
105
116
  fileExtension: z.ZodString;
117
+ _note: z.ZodOptional<z.ZodString>;
106
118
  }, "strip", z.ZodTypeAny, {
107
119
  fileExtension: string;
108
120
  workflowsDir?: string | undefined;
109
121
  targetDir?: string | undefined;
110
122
  skillsDir?: string | undefined;
111
123
  commandsDir?: string | undefined;
124
+ promptsDir?: string | undefined;
112
125
  globalTargetDir?: string | undefined;
126
+ _note?: string | undefined;
113
127
  }, {
114
128
  fileExtension: string;
115
129
  workflowsDir?: string | undefined;
116
130
  targetDir?: string | undefined;
117
131
  skillsDir?: string | undefined;
118
132
  commandsDir?: string | undefined;
133
+ promptsDir?: string | undefined;
119
134
  globalTargetDir?: string | undefined;
135
+ _note?: string | undefined;
120
136
  }>, {
121
137
  fileExtension: string;
122
138
  workflowsDir?: string | undefined;
123
139
  targetDir?: string | undefined;
124
140
  skillsDir?: string | undefined;
125
141
  commandsDir?: string | undefined;
142
+ promptsDir?: string | undefined;
126
143
  globalTargetDir?: string | undefined;
144
+ _note?: string | undefined;
127
145
  }, {
128
146
  fileExtension: string;
129
147
  workflowsDir?: string | undefined;
130
148
  targetDir?: string | undefined;
131
149
  skillsDir?: string | undefined;
132
150
  commandsDir?: string | undefined;
151
+ promptsDir?: string | undefined;
133
152
  globalTargetDir?: string | undefined;
153
+ _note?: string | undefined;
134
154
  }>;
135
155
  }, "strip", z.ZodTypeAny, {
136
156
  name: string;
@@ -141,7 +161,9 @@ declare const HarnessSchema: z.ZodObject<{
141
161
  targetDir?: string | undefined;
142
162
  skillsDir?: string | undefined;
143
163
  commandsDir?: string | undefined;
164
+ promptsDir?: string | undefined;
144
165
  globalTargetDir?: string | undefined;
166
+ _note?: string | undefined;
145
167
  };
146
168
  }, {
147
169
  name: string;
@@ -152,7 +174,9 @@ declare const HarnessSchema: z.ZodObject<{
152
174
  targetDir?: string | undefined;
153
175
  skillsDir?: string | undefined;
154
176
  commandsDir?: string | undefined;
177
+ promptsDir?: string | undefined;
155
178
  globalTargetDir?: string | undefined;
179
+ _note?: string | undefined;
156
180
  };
157
181
  }>;
158
182
  /**
@@ -167,36 +191,46 @@ declare const HarnessCodesSchema: z.ZodObject<{
167
191
  targetDir: z.ZodOptional<z.ZodString>;
168
192
  skillsDir: z.ZodOptional<z.ZodString>;
169
193
  commandsDir: z.ZodOptional<z.ZodString>;
194
+ promptsDir: z.ZodOptional<z.ZodString>;
170
195
  globalTargetDir: z.ZodOptional<z.ZodString>;
171
196
  fileExtension: z.ZodString;
197
+ _note: z.ZodOptional<z.ZodString>;
172
198
  }, "strip", z.ZodTypeAny, {
173
199
  fileExtension: string;
174
200
  workflowsDir?: string | undefined;
175
201
  targetDir?: string | undefined;
176
202
  skillsDir?: string | undefined;
177
203
  commandsDir?: string | undefined;
204
+ promptsDir?: string | undefined;
178
205
  globalTargetDir?: string | undefined;
206
+ _note?: string | undefined;
179
207
  }, {
180
208
  fileExtension: string;
181
209
  workflowsDir?: string | undefined;
182
210
  targetDir?: string | undefined;
183
211
  skillsDir?: string | undefined;
184
212
  commandsDir?: string | undefined;
213
+ promptsDir?: string | undefined;
185
214
  globalTargetDir?: string | undefined;
215
+ _note?: string | undefined;
186
216
  }>, {
187
217
  fileExtension: string;
188
218
  workflowsDir?: string | undefined;
189
219
  targetDir?: string | undefined;
190
220
  skillsDir?: string | undefined;
191
221
  commandsDir?: string | undefined;
222
+ promptsDir?: string | undefined;
192
223
  globalTargetDir?: string | undefined;
224
+ _note?: string | undefined;
193
225
  }, {
194
226
  fileExtension: string;
195
227
  workflowsDir?: string | undefined;
196
228
  targetDir?: string | undefined;
197
229
  skillsDir?: string | undefined;
198
230
  commandsDir?: string | undefined;
231
+ promptsDir?: string | undefined;
199
232
  globalTargetDir?: string | undefined;
233
+ _note?: string | undefined;
200
234
  }>;
201
235
  }, "strip", z.ZodTypeAny, {
202
236
  name: string;
@@ -207,7 +241,9 @@ declare const HarnessCodesSchema: z.ZodObject<{
207
241
  targetDir?: string | undefined;
208
242
  skillsDir?: string | undefined;
209
243
  commandsDir?: string | undefined;
244
+ promptsDir?: string | undefined;
210
245
  globalTargetDir?: string | undefined;
246
+ _note?: string | undefined;
211
247
  };
212
248
  }, {
213
249
  name: string;
@@ -218,7 +254,9 @@ declare const HarnessCodesSchema: z.ZodObject<{
218
254
  targetDir?: string | undefined;
219
255
  skillsDir?: string | undefined;
220
256
  commandsDir?: string | undefined;
257
+ promptsDir?: string | undefined;
221
258
  globalTargetDir?: string | undefined;
259
+ _note?: string | undefined;
222
260
  };
223
261
  }>>;
224
262
  }, "strip", z.ZodTypeAny, {
@@ -231,7 +269,9 @@ declare const HarnessCodesSchema: z.ZodObject<{
231
269
  targetDir?: string | undefined;
232
270
  skillsDir?: string | undefined;
233
271
  commandsDir?: string | undefined;
272
+ promptsDir?: string | undefined;
234
273
  globalTargetDir?: string | undefined;
274
+ _note?: string | undefined;
235
275
  };
236
276
  }>;
237
277
  }, {
@@ -244,7 +284,9 @@ declare const HarnessCodesSchema: z.ZodObject<{
244
284
  targetDir?: string | undefined;
245
285
  skillsDir?: string | undefined;
246
286
  commandsDir?: string | undefined;
287
+ promptsDir?: string | undefined;
247
288
  globalTargetDir?: string | undefined;
289
+ _note?: string | undefined;
248
290
  };
249
291
  }>;
250
292
  }>;
@@ -530,6 +572,7 @@ declare function listPreferredHarnesses(): Array<{
530
572
  id: string;
531
573
  harness: Harness;
532
574
  }>;
575
+ type TargetKind = 'flat' | 'skill';
533
576
  /**
534
577
  * A resolved target directory where workflow files will be written.
535
578
  * One per unique path, with the list of harness ids that share it.
@@ -539,15 +582,17 @@ interface ResolvedTarget {
539
582
  path: string;
540
583
  /** File extension to use (e.g. ".md", ".agent.md") */
541
584
  fileExtension: string;
585
+ /** Whether target receives flat files (e.g. session.md) or skill bundles (e.g. protocol-session/SKILL.md) */
586
+ kind: TargetKind;
542
587
  /** Ids of the harnesses that will read from this directory */
543
588
  usedBy: string[];
544
589
  }
545
590
  /**
546
591
  * Resolve the unique target directories for a set of harness ids.
547
592
  *
548
- * Harnesses that share the same `skillsDir` (e.g. Codex, OpenCode, KiloCode
549
- * all use `.agents/skills/`) are deduplicated: the directory appears once
550
- * in the output, with all the harness ids listed in `usedBy`.
593
+ * Harnesses that share the same `skillsDir` (e.g. Codex, OpenCode, KiloCode,
594
+ * Antigravity, Claude Code all use `.agents/skills/`) are deduplicated:
595
+ * the directory appears once in the output, with all the harness ids listed in `usedBy`.
551
596
  *
552
597
  * The `path` is returned relative to the project root (caller is responsible
553
598
  * for joining with the project cwd).
@@ -559,5 +604,5 @@ declare function resolveTargets(harnessIds: string[], cwd?: string): ResolvedTar
559
604
  */
560
605
  declare function getRawHarnessCodes(): HarnessCodes;
561
606
  //#endregion
562
- export { AGENT_FILE, AGENT_TEMPLATE, ARCHIVE_DIR, AUTONOMOS_DIR, AgentConfig, AgentContext, AgentParser, AgentSection, AncestorAgent, COMPLEXITIES, Complexity, DECISIONS_DIR, Harness, HarnessCodes, HarnessCodesSchema, HarnessSchema, Installer, InstallerSchema, LOCAL_AGENT_TEMPLATE, MANIFEST_FILE, Manifest, ManifestSchema, PRIORITIES, PROTOCOL_FILE, PROTOCOL_TEMPLATE, PROTOCOL_TEMPLATE_V2026_1, PROTOCOL_VERSION, Priority, ResolvedTarget, SPECS_DIR, TASKS_FILE, TASKS_TEMPLATE, Task, TaskParser, TaskReference, TaskRegistry, TaskStatus, WORKLOGS_DIR, createManifest, displayRelative, findAncestorAgents, findProjectRoot, generateAgentTemplate, generateLocalAgentTemplate, generateManifestContent, generateWorklogContent, getHarness, getRawHarnessCodes, isSamePath, listHarnesses, listPreferredHarnesses, mapTaskStatusToWorklogStatus, parseManifest, readTaskRegistry, resolveTargets };
607
+ export { AGENT_FILE, AGENT_TEMPLATE, ARCHIVE_DIR, AUTONOMOS_DIR, AgentConfig, AgentContext, AgentParser, AgentSection, AncestorAgent, COMPLEXITIES, Complexity, DECISIONS_DIR, Harness, HarnessCodes, HarnessCodesSchema, HarnessSchema, Installer, InstallerSchema, LOCAL_AGENT_TEMPLATE, MANIFEST_FILE, Manifest, ManifestSchema, PRIORITIES, PROTOCOL_FILE, PROTOCOL_TEMPLATE, PROTOCOL_TEMPLATE_V2026_1, PROTOCOL_VERSION, Priority, ResolvedTarget, SPECS_DIR, TASKS_FILE, TASKS_TEMPLATE, TargetKind, Task, TaskParser, TaskReference, TaskRegistry, TaskStatus, WORKLOGS_DIR, createManifest, displayRelative, findAncestorAgents, findProjectRoot, generateAgentTemplate, generateLocalAgentTemplate, generateManifestContent, generateWorklogContent, getHarness, getRawHarnessCodes, isSamePath, listHarnesses, listPreferredHarnesses, mapTaskStatusToWorklogStatus, parseManifest, readTaskRegistry, resolveTargets };
563
608
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/schemas/harness-codes.ts","../src/schemas/manifest.ts","../src/types.ts","../src/templates/agent.ts","../src/templates/manifest.ts","../src/templates/protocol.ts","../src/templates/tasks.ts","../src/templates/worklog.ts","../src/parsers/agent-finder.ts","../src/parsers/agent-parser.ts","../src/parsers/project-root.ts","../src/parsers/task-parser.ts","../src/parsers/task-registry.ts","../src/harness-codes.ts"],"mappings":";;;;;;AAIA;cAAa,gBAAA;;;AAAgB;cAKhB,aAAA;;;;cAKA,aAAA;AAAb;;;AAAA,cAKa,aAAA;AALa;AAK1B;;AAL0B,cAUb,UAAA;;AALa;AAK1B;cAKa,UAAA;;;AALU;cAUV,YAAA;;;;cAKA,SAAA;AALb;;;AAAA,cAUa,aAAA;AAVY;AAAA,cAaZ,WAAA;;;;;AA3Cb;;;;AAA6B;AAK7B;;;;AAA0B;cCKb,eAAA,EAAe,CAAA,CAAA,UAAA,CAAA,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;EACrC,IAAA;;EAEA,IAAA;AAAA;AAAA,UAGa,YAAA;EACb,OAAA,EAAS,aAAA;EACT,QAAA,EAAU,aAAa;EACvB,YAAA;EACA,QAAA;EbJS;EaMT,QAAA;AAAA;;iBAIY,gBAAA,CAAiB,IAAA,UAAc,OAAA;EAAW,OAAA;AAAA,IAA2B,YAAY;;;;;AbpBjG;;iBccgB,UAAA,CAAW,EAAA,WAAa,OAAO;;AddlB;AAK7B;;iBcsBgB,aAAA,IAAiB,KAAK;EAAG,EAAA;EAAY,OAAA,EAAS,OAAA;AAAA;;;;iBAO9C,sBAAA,IAA0B,KAAK;EAAG,EAAA;EAAY,OAAA,EAAS,OAAA;AAAA;;AdnB7C;AAK1B;;UcsBiB,cAAA;EdtBM;EcwBnB,IAAA;EdnBS;EcqBT,aAAA;;EAEA,MAAA;AAAA;AdlBJ;;;;AAAyB;AAKzB;;;;AAAsB;AALtB,iBc+BgB,cAAA,CAAe,UAAA,YAAsB,GAAA,YAAoB,cAAc;;;;AdrB7D;iBc6EV,kBAAA,IAAsB,YAAY"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/constants.ts","../src/schemas/harness-codes.ts","../src/schemas/manifest.ts","../src/types.ts","../src/templates/agent.ts","../src/templates/manifest.ts","../src/templates/protocol.ts","../src/templates/tasks.ts","../src/templates/worklog.ts","../src/parsers/agent-finder.ts","../src/parsers/agent-parser.ts","../src/parsers/project-root.ts","../src/parsers/task-parser.ts","../src/parsers/task-registry.ts","../src/harness-codes.ts"],"mappings":";;;;;;AAIA;cAAa,gBAAA;;;AAAgB;cAKhB,aAAA;;;;cAKA,aAAA;AAAb;;;AAAA,cAKa,aAAA;AALa;AAK1B;;AAL0B,cAUb,UAAA;;AALa;AAK1B;cAKa,UAAA;;;AALU;cAUV,YAAA;;;;cAKA,SAAA;AALb;;;AAAA,cAUa,aAAA;AAVY;AAAA,cAaZ,WAAA;;;;;AA3Cb;;;;AAA6B;AAK7B;;;;AAA0B;cCKb,eAA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AAA;AAAA;;;UChDF,aAAA;EACb,EAAA;EACA,MAAA,EAAQ,UAAU,QAAQ,UAAA,CAAW,UAAA;EACrC,IAAA;;EAEA,IAAA;AAAA;AAAA,UAGa,YAAA;EACb,OAAA,EAAS,aAAA;EACT,QAAA,EAAU,aAAa;EACvB,YAAA;EACA,QAAA;EbJS;EaMT,QAAA;AAAA;;iBAIY,gBAAA,CAAiB,IAAA,UAAc,OAAA;EAAW,OAAA;AAAA,IAA2B,YAAY;;;;;AbpBjG;;iBccgB,UAAA,CAAW,EAAA,WAAa,OAAO;;AddlB;AAK7B;;iBcsBgB,aAAA,IAAiB,KAAK;EAAG,EAAA;EAAY,OAAA,EAAS,OAAA;AAAA;;;;iBAO9C,sBAAA,IAA0B,KAAK;EAAG,EAAA;EAAY,OAAA,EAAS,OAAA;AAAA;AAAA,KAI3D,UAAA;AdvBc;AAK1B;;;AAL0B,Uc6BT,cAAA;EdxBM;Ec0BnB,IAAA;EdrBmB;EcuBnB,aAAA;EdvBmB;EcyBnB,IAAA,EAAM,UAAU;EdpBP;EcsBT,MAAA;AAAA;;AdtBqB;AAKzB;;;;AAAsB;AAKtB;;;iBcyBgB,cAAA,CAAe,UAAA,YAAsB,GAAA,YAAoB,cAAc;AdzB7D;AAG1B;;;AAH0B,iBcuFV,kBAAA,IAAsB,YAAY"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{z as e}from"zod";import{existsSync as t,lstatSync as n,readFileSync as r,readdirSync as i,statSync as a}from"node:fs";import{dirname as o,isAbsolute as s,join as c,relative as l,resolve as u,sep as d}from"node:path";import f from"js-yaml";const p=`0.7.0-alpha`,m=`.autonomos`,h=`manifest.json`,g=`PROTOCOL.md`,_=`TASKS.md`,v=`AGENT.md`,ee=`worklogs`,te=`specs`,y=`decisions`,b=`archive`,x=e.object({workflowsDir:e.string().optional(),targetDir:e.string().optional(),skillsDir:e.string().optional(),commandsDir:e.string().optional(),globalTargetDir:e.string().optional(),fileExtension:e.string()}).refine(e=>!!e.workflowsDir||!!e.targetDir||!!e.skillsDir,{message:"At least one of `workflowsDir`, `targetDir`, or `skillsDir` must be defined"}),S=e.object({name:e.string().min(1),preferred:e.boolean(),installer:x}),C=e.object({platforms:e.record(e.string(),S)}),w=e.object({protocolVersion:e.string().describe(`Version of the Agent Protocol specification`),cliVersion:e.string().describe(`Version of the CLI that last updated this project`),initializedAt:e.string().datetime().describe(`ISO timestamp of project initialization`),lastUpdated:e.string().datetime().describe(`ISO timestamp of last protocol update`)}),T=[`🔴 Critical`,`🟠 High`,`🔵 Medium`,`⚪ Low`],E=[`S`,`M`,`L`,`XL`];function D(e=`Project`){return`---
1
+ import{z as e}from"zod";import{existsSync as t,lstatSync as n,readFileSync as r,readdirSync as i,statSync as a}from"node:fs";import{dirname as o,isAbsolute as s,join as c,relative as l,resolve as u,sep as d}from"node:path";import f from"js-yaml";const p=`0.7.0-alpha`,m=`.autonomos`,h=`manifest.json`,g=`PROTOCOL.md`,_=`TASKS.md`,v=`AGENT.md`,ee=`worklogs`,te=`specs`,y=`decisions`,b=`archive`,x=e.object({workflowsDir:e.string().optional(),targetDir:e.string().optional(),skillsDir:e.string().optional(),commandsDir:e.string().optional(),promptsDir:e.string().optional(),globalTargetDir:e.string().optional(),fileExtension:e.string(),_note:e.string().optional()}).refine(e=>!!e.workflowsDir||!!e.targetDir||!!e.skillsDir||!!e.commandsDir||!!e.promptsDir,{message:"At least one of `workflowsDir`, `targetDir`, `skillsDir`, `commandsDir`, or `promptsDir` must be defined"}),S=e.object({name:e.string().min(1),preferred:e.boolean(),installer:x}),C=e.object({platforms:e.record(e.string(),S)}),w=e.object({protocolVersion:e.string().describe(`Version of the Agent Protocol specification`),cliVersion:e.string().describe(`Version of the CLI that last updated this project`),initializedAt:e.string().datetime().describe(`ISO timestamp of project initialization`),lastUpdated:e.string().datetime().describe(`ISO timestamp of last protocol update`)}),T=[`🔴 Critical`,`🟠 High`,`🔵 Medium`,`⚪ Low`],E=[`S`,`M`,`L`,`XL`];function D(e=`Project`){return`---
2
2
  name: "${e}"
3
3
  type: "project"
4
4
  status: "active"
@@ -228,5 +228,5 @@ ${e.nextSteps.map(e=>`- ${e}`).join(`
228
228
  `)}
229
229
  `}function I(e){switch(e){case`DONE`:return`Complete`;case`BLOCKED`:return`Blocked`;default:return`Partial`}}function L(e,n=process.cwd()){let r=u(n),i=R(e,r),a=l(r,i);if(a.startsWith(`..`)||s(a))throw Error(`Target "${e}" is outside the project root "${r}". findAncestorAgents only handles paths within the project.`);let d=z(V(i)?i:o(i),r),f=[];for(let e of d){let n=c(e,v);t(n)&&f.push({dir:e,path:n,relativeDir:B(e,r)})}return f}function R(e,t){return s(e)?e:c(t,e)}function z(e,t){let n=l(t,e);if(n===``||n===`.`)return[t];let r=n.split(d).filter(e=>e!==``&&e!==`.`),i=[t],a=t;for(let e of r)a=c(a,e),i.push(a);return i}function B(e,t){let n=l(t,e);return n===``?`.`:n}function V(e){try{return a(e).isDirectory()}catch{return!1}}var H=class{static parse(e){let t=e,n={},r=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(r)try{n=f.load(r[1]),t=e.slice(r[0].length).trim()}catch(e){console.error(`Failed to parse Agent frontmatter:`,e)}let i=t.split(/\r?\n/),a=[],o=n.name??`Unknown Agent`,s=null,c=[];for(let e of i){if(e.startsWith(`# `)&&!n.name){let t=e.replace(`# `,``).trim();o=t.toUpperCase().startsWith(`AGENT CONTEXT:`)?t.slice(14).replace(/^[:\s-]+/,``).trim():t;continue}if(e.startsWith(`## `)){s&&(s.content=c.join(`
230
230
  `).trim(),a.push(s)),s={title:e.replace(`## `,``).trim(),content:``},c=[];continue}s&&c.push(e)}return s&&(s.content=c.join(`
231
- `).trim(),a.push(s)),{title:o,sections:a,metadata:n}}};const U=[m,`.git`];function W(e){if(!e)return null;let n=u(e);for(;;){if(U.some(e=>t(c(n,e))))return n;let e=o(n);if(e===n)return null;n=e}}function G(e,t){return!e||!t?!1:u(e)===u(t)}function K(e,t){let n=l(t,e);return n===``||n===`.`?`.`:n.startsWith(`..${d}`)||n===`..`||s(n)?u(e):n}var q=class{static references(e){let t=[],n;for(let[r,i]of e.split(/\r?\n/).entries()){let e=i.match(/^\s{0,3}(`{3,}|~{3,})/);if(e?.[1]){n?e[1][0]===n[0]&&e[1].length>=n.length&&!i.slice(e[0].length).trim()&&(n=void 0):n=e[1];continue}if(n)continue;let a=i.match(/^\s*- \[([ x/!])\] \*\*\[([^\]]+)\]\*\*/);a?.[1]&&a[2]?.trim()&&t.push({id:a[2].trim(),status:this.mapStatus(a[1]),line:r+1})}return t}static parse(e){let t=[],n=e.split(/\r?\n/),r=/- \[([ x/!])\] \*\*\[(.+)\]\*\* (.+) `Priority: (.+)` `Complexity: (.+)`/;for(let e of n){let n=e.match(r);if(n){let[,e=` `,r=``,i=``,a=``,o=``]=n;t.push({id:r,title:i.trim(),priority:a,complexity:o,status:this.mapStatus(e)})}}return t}static mapStatus(e){switch(e){case` `:return`TODO`;case`/`:return`IN_PROGRESS`;case`x`:return`DONE`;case`!`:return`BLOCKED`;default:return`TODO`}}};function J(e,t={}){let a={current:[],archived:[],duplicateIds:[],warnings:[],complete:!0};function o(t,n){a.complete=!1,a.warnings.push(`${l(e,t)}: ${n}`)}function s(t,i){try{if(!n(t).isFile()){o(t,`Expected a regular task registry; symbolic links are not followed`);return}i.push(...q.references(r(t,`utf8`)).map(n=>({...n,path:l(e,t)})))}catch(e){o(t,e instanceof Error?e.message:String(e))}}function u(e,t=!1){try{if(!n(e).isDirectory()){o(e,`Expected an archive directory; symbolic links are not followed`);return}for(let t of i(e,{withFileTypes:!0}).sort((e,t)=>e.name.localeCompare(t.name))){let n=c(e,t.name);t.isSymbolicLink()?o(n,`Skipped symbolic link in archive`):t.isDirectory()?u(n):t.name===`TASKS.md`&&s(n,a.archived)}}catch(n){if(t&&n.code===`ENOENT`)return;o(e,n instanceof Error?n.message:String(n))}}let d=c(e,m);try{if(!n(d).isDirectory())return o(d,`Expected a regular project directory; symbolic links are not followed`),a}catch(e){return e.code!==`ENOENT`&&o(d,e instanceof Error?e.message:String(e)),a}let f=c(d,_);try{n(f),s(f,a.current)}catch(e){e.code!==`ENOENT`&&o(f,e instanceof Error?e.message:String(e))}t.history&&u(c(e,m,b),!0);let p=new Set,h=new Set;for(let e of[...a.current,...a.archived])p.has(e.id)&&h.add(e.id),p.add(e.id);return a.duplicateIds=[...h].sort(),a}const Y=C.parse({$schema:`./harness-codes.schema.json`,_comment:"Autonomos harness codes. Each entry tells `autonomos init` where to write the protocol workflow files. The shape is intentionally minimal: only what the installer needs. To add a new harness, add an entry here. To remove one, delete it. The schema is enforced at load time by Zod (see schemas/harness-codes.ts).",platforms:{cline:{name:`Cline`,preferred:!0,installer:{workflowsDir:`.clinerules/workflows`,fileExtension:`.md`,_note:"In Cline, a single .md file in .clinerules/workflows/ acts as both a workflow (auto-discovered via the frontmatter `description` field) and a slash command (invoked via /<name>)."}},"claude-code":{name:`Claude Code`,preferred:!0,installer:{workflowsDir:`.claude/skills`,commandsDir:`.claude/commands`,fileExtension:`.md`}},codex:{name:`Codex`,preferred:!0,installer:{workflowsDir:`.agents/skills`,fileExtension:`.md`,globalTargetDir:`~/.codex/skills`,_note:`OpenAI Codex. Uses the cross-tool .agents/skills/ standard.`}},antigravity:{name:`Antigravity`,preferred:!0,installer:{workflowsDir:`.agent/workflows`,fileExtension:`.md`,globalTargetDir:`~/.gemini/antigravity/skills`,_note:"Google Antigravity. Uses `.agent/workflows/` (not `.agent/skills/`). Singular `.agent/` (NOT the cross-tool `.agents/` standard). Cannot be deduplicated with the others."}},opencode:{name:`OpenCode`,preferred:!0,installer:{workflowsDir:`.agents/skills`,commandsDir:`.opencode/commands`,fileExtension:`.md`}},kilocode:{name:`KiloCode`,preferred:!0,installer:{workflowsDir:`.agents/skills`,fileExtension:`.md`,globalTargetDir:`~/.kilocode/skills`}}}});function X(e){let t=Y.platforms[e];if(!t){let t=Object.keys(Y.platforms).join(`, `);throw Error(`Unknown harness: "${e}". Known harnesses: ${t}`)}return t}function Z(){return Object.entries(Y.platforms).map(([e,t])=>({id:e,harness:t}))}function ie(){return Z().filter(({harness:e})=>e.preferred)}function ae(e,t=`.`){let n=new Map;for(let r of e){let{installer:e}=X(r);oe(n,e,r,t)}return Array.from(n.values())}function oe(e,t,n,r){let i=t.fileExtension;t.workflowsDir?Q(e,$(r,t.workflowsDir),i,n):t.targetDir?Q(e,$(r,t.targetDir),i,n):t.skillsDir&&Q(e,$(r,t.skillsDir),i,n),t.commandsDir&&Q(e,$(r,t.commandsDir),i,n)}function Q(e,t,n,r){let i=e.get(t);i?i.usedBy.includes(r)||i.usedBy.push(r):e.set(t,{path:t,fileExtension:n,usedBy:[r]})}function $(e,t){return e===`.`||e===``?t:t.startsWith(`/`)?`${e}${t}`:`${e}/${t}`}function se(){return Y}export{v as AGENT_FILE,ne as AGENT_TEMPLATE,b as ARCHIVE_DIR,m as AUTONOMOS_DIR,H as AgentParser,E as COMPLEXITIES,y as DECISIONS_DIR,C as HarnessCodesSchema,S as HarnessSchema,x as InstallerSchema,re as LOCAL_AGENT_TEMPLATE,h as MANIFEST_FILE,w as ManifestSchema,T as PRIORITIES,g as PROTOCOL_FILE,M as PROTOCOL_TEMPLATE,N as PROTOCOL_TEMPLATE_V2026_1,p as PROTOCOL_VERSION,te as SPECS_DIR,_ as TASKS_FILE,P as TASKS_TEMPLATE,q as TaskParser,ee as WORKLOGS_DIR,k as createManifest,K as displayRelative,L as findAncestorAgents,W as findProjectRoot,D as generateAgentTemplate,O as generateLocalAgentTemplate,A as generateManifestContent,F as generateWorklogContent,X as getHarness,se as getRawHarnessCodes,G as isSamePath,Z as listHarnesses,ie as listPreferredHarnesses,I as mapTaskStatusToWorklogStatus,j as parseManifest,J as readTaskRegistry,ae as resolveTargets};
231
+ `).trim(),a.push(s)),{title:o,sections:a,metadata:n}}};const U=[m,`.git`];function W(e){if(!e)return null;let n=u(e);for(;;){if(U.some(e=>t(c(n,e))))return n;let e=o(n);if(e===n)return null;n=e}}function G(e,t){return!e||!t?!1:u(e)===u(t)}function K(e,t){let n=l(t,e);return n===``||n===`.`?`.`:n.startsWith(`..${d}`)||n===`..`||s(n)?u(e):n}var q=class{static references(e){let t=[],n;for(let[r,i]of e.split(/\r?\n/).entries()){let e=i.match(/^\s{0,3}(`{3,}|~{3,})/);if(e?.[1]){n?e[1][0]===n[0]&&e[1].length>=n.length&&!i.slice(e[0].length).trim()&&(n=void 0):n=e[1];continue}if(n)continue;let a=i.match(/^\s*- \[([ x/!])\] \*\*\[([^\]]+)\]\*\*/);a?.[1]&&a[2]?.trim()&&t.push({id:a[2].trim(),status:this.mapStatus(a[1]),line:r+1})}return t}static parse(e){let t=[],n=e.split(/\r?\n/),r=/- \[([ x/!])\] \*\*\[(.+)\]\*\* (.+) `Priority: (.+)` `Complexity: (.+)`/;for(let e of n){let n=e.match(r);if(n){let[,e=` `,r=``,i=``,a=``,o=``]=n;t.push({id:r,title:i.trim(),priority:a,complexity:o,status:this.mapStatus(e)})}}return t}static mapStatus(e){switch(e){case` `:return`TODO`;case`/`:return`IN_PROGRESS`;case`x`:return`DONE`;case`!`:return`BLOCKED`;default:return`TODO`}}};function J(e,t={}){let a={current:[],archived:[],duplicateIds:[],warnings:[],complete:!0};function o(t,n){a.complete=!1,a.warnings.push(`${l(e,t)}: ${n}`)}function s(t,i){try{if(!n(t).isFile()){o(t,`Expected a regular task registry; symbolic links are not followed`);return}i.push(...q.references(r(t,`utf8`)).map(n=>({...n,path:l(e,t)})))}catch(e){o(t,e instanceof Error?e.message:String(e))}}function u(e,t=!1){try{if(!n(e).isDirectory()){o(e,`Expected an archive directory; symbolic links are not followed`);return}for(let t of i(e,{withFileTypes:!0}).sort((e,t)=>e.name.localeCompare(t.name))){let n=c(e,t.name);t.isSymbolicLink()?o(n,`Skipped symbolic link in archive`):t.isDirectory()?u(n):t.name===`TASKS.md`&&s(n,a.archived)}}catch(n){if(t&&n.code===`ENOENT`)return;o(e,n instanceof Error?n.message:String(n))}}let d=c(e,m);try{if(!n(d).isDirectory())return o(d,`Expected a regular project directory; symbolic links are not followed`),a}catch(e){return e.code!==`ENOENT`&&o(d,e instanceof Error?e.message:String(e)),a}let f=c(d,_);try{n(f),s(f,a.current)}catch(e){e.code!==`ENOENT`&&o(f,e instanceof Error?e.message:String(e))}t.history&&u(c(e,m,b),!0);let p=new Set,h=new Set;for(let e of[...a.current,...a.archived])p.has(e.id)&&h.add(e.id),p.add(e.id);return a.duplicateIds=[...h].sort(),a}const Y=C.parse({$schema:`./harness-codes.schema.json`,_comment:"Autonomos harness codes. Each entry tells `autonomos init` where to write the protocol workflow files. The shape is intentionally minimal: only what the installer needs. To add a new harness, add an entry here. To remove one, delete it. The schema is enforced at load time by Zod (see schemas/harness-codes.ts).",platforms:{cline:{name:`Cline`,preferred:!0,installer:{workflowsDir:`.clinerules/workflows`,fileExtension:`.md`,_note:"In Cline, a single .md file in .clinerules/workflows/ acts as both a workflow (auto-discovered via the frontmatter `description` field) and a slash command (invoked via /<name>)."}},"claude-code":{name:`Claude Code`,preferred:!0,installer:{commandsDir:`.claude/commands`,skillsDir:`.agents/skills`,fileExtension:`.md`}},codex:{name:`Codex`,preferred:!0,installer:{promptsDir:`.codex/prompts`,skillsDir:`.agents/skills`,fileExtension:`.md`,globalTargetDir:`~/.codex/prompts`,_note:`OpenAI Codex CLI. Slash commands live in .codex/prompts/, skills live in the cross-tool .agents/skills/ standard.`}},antigravity:{name:`Antigravity`,preferred:!0,installer:{workflowsDir:`.agents/workflows`,skillsDir:`.agents/skills`,fileExtension:`.md`,globalTargetDir:`~/.gemini/config/workflows`,_note:`Google Antigravity. Workflows live in .agents/workflows/, skills live in the cross-tool .agents/skills/ standard.`}},opencode:{name:`OpenCode`,preferred:!0,installer:{commandsDir:`.opencode/commands`,skillsDir:`.agents/skills`,fileExtension:`.md`}},kilocode:{name:`KiloCode`,preferred:!0,installer:{workflowsDir:`.agents/workflows`,skillsDir:`.agents/skills`,fileExtension:`.md`,globalTargetDir:`~/.kilocode/skills`}}}});function X(e){let t=Y.platforms[e];if(!t){let t=Object.keys(Y.platforms).join(`, `);throw Error(`Unknown harness: "${e}". Known harnesses: ${t}`)}return t}function Z(){return Object.entries(Y.platforms).map(([e,t])=>({id:e,harness:t}))}function ie(){return Z().filter(({harness:e})=>e.preferred)}function ae(e,t=`.`){let n=new Map;for(let r of e){let{installer:e}=X(r);oe(n,e,r,t)}return Array.from(n.values())}function oe(e,t,n,r){let i=t.fileExtension;t.workflowsDir&&Q(e,$(r,t.workflowsDir),i,`flat`,n),t.commandsDir&&Q(e,$(r,t.commandsDir),i,`flat`,n),t.promptsDir&&Q(e,$(r,t.promptsDir),i,`flat`,n),t.targetDir&&Q(e,$(r,t.targetDir),i,`flat`,n),t.skillsDir&&Q(e,$(r,t.skillsDir),i,`skill`,n)}function Q(e,t,n,r,i){let a=e.get(t);a?a.usedBy.includes(i)||a.usedBy.push(i):e.set(t,{path:t,fileExtension:n,kind:r,usedBy:[i]})}function $(e,t){return e===`.`||e===``?t:t.startsWith(`/`)?`${e}${t}`:`${e}/${t}`}function se(){return Y}export{v as AGENT_FILE,ne as AGENT_TEMPLATE,b as ARCHIVE_DIR,m as AUTONOMOS_DIR,H as AgentParser,E as COMPLEXITIES,y as DECISIONS_DIR,C as HarnessCodesSchema,S as HarnessSchema,x as InstallerSchema,re as LOCAL_AGENT_TEMPLATE,h as MANIFEST_FILE,w as ManifestSchema,T as PRIORITIES,g as PROTOCOL_FILE,M as PROTOCOL_TEMPLATE,N as PROTOCOL_TEMPLATE_V2026_1,p as PROTOCOL_VERSION,te as SPECS_DIR,_ as TASKS_FILE,P as TASKS_TEMPLATE,q as TaskParser,ee as WORKLOGS_DIR,k as createManifest,K as displayRelative,L as findAncestorAgents,W as findProjectRoot,D as generateAgentTemplate,O as generateLocalAgentTemplate,A as generateManifestContent,F as generateWorklogContent,X as getHarness,se as getRawHarnessCodes,G as isSamePath,Z as listHarnesses,ie as listPreferredHarnesses,I as mapTaskStatusToWorklogStatus,j as parseManifest,J as readTaskRegistry,ae as resolveTargets};
232
232
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["harnessCodesData"],"sources":["../src/constants.ts","../src/schemas/harness-codes.ts","../src/schemas/manifest.ts","../src/types.ts","../src/templates/agent.ts","../src/templates/manifest.ts","../src/templates/protocol.ts","../src/templates/tasks.ts","../src/templates/worklog.ts","../src/parsers/agent-finder.ts","../src/parsers/agent-parser.ts","../src/parsers/project-root.ts","../src/parsers/task-parser.ts","../src/parsers/task-registry.ts","../src/data/harness-codes.json","../src/harness-codes.ts"],"sourcesContent":["/**\n * Agent Protocol Specification Version (Independent of Package versions)\n * This refers to the schema and behavioral contract version.\n */\nexport const PROTOCOL_VERSION = '0.7.0-alpha'\n\n/**\n * Directory name for Autonomos configuration\n */\nexport const AUTONOMOS_DIR = '.autonomos'\n\n/**\n * Manifest filename\n */\nexport const MANIFEST_FILE = 'manifest.json'\n\n/**\n * Protocol filename\n */\nexport const PROTOCOL_FILE = 'PROTOCOL.md'\n\n/**\n * Tasks filename\n */\nexport const TASKS_FILE = 'TASKS.md'\n\n/**\n * Agent context filename (at project root)\n */\nexport const AGENT_FILE = 'AGENT.md'\n\n/**\n * Worklogs directory name\n */\nexport const WORKLOGS_DIR = 'worklogs'\n\n/**\n * Optional project-owned directory for durable target-state specifications\n */\nexport const SPECS_DIR = 'specs'\n\n/**\n * Optional project-owned directory for technical decision records (ADRs)\n */\nexport const DECISIONS_DIR = 'decisions'\n\n/** Optional project-owned history, never loaded by default. */\nexport const ARCHIVE_DIR = 'archive'\n","import { z } from 'zod'\n\n/**\n * Installer configuration for a single harness.\n *\n * At least one of `workflowsDir`, `targetDir`, or `skillsDir` must be defined.\n *\n * - `workflowsDir`: Where the protocol workflow files are written.\n * Preferred field — used by most harnesses.\n * - `targetDir`: Single directory (legacy, like Cline's .clinerules/workflows/).\n * - `skillsDir`: Skills directory (legacy, for harnesses that don't distinguish\n * skills from workflows).\n * - `commandsDir`: Additional commands directory (optional).\n */\nexport const InstallerSchema = z\n .object({\n workflowsDir: z.string().optional(),\n targetDir: z.string().optional(),\n skillsDir: z.string().optional(),\n commandsDir: z.string().optional(),\n globalTargetDir: z.string().optional(),\n fileExtension: z.string(),\n })\n .refine(\n data => Boolean(data.workflowsDir) || Boolean(data.targetDir) || Boolean(data.skillsDir),\n {\n message: 'At least one of `workflowsDir`, `targetDir`, or `skillsDir` must be defined',\n }\n )\n\n/**\n * A single harness entry.\n */\nexport const HarnessSchema = z.object({\n name: z.string().min(1),\n preferred: z.boolean(),\n installer: InstallerSchema,\n})\n\n/**\n * Root schema for the harness-codes configuration file.\n */\nexport const HarnessCodesSchema = z.object({\n platforms: z.record(z.string(), HarnessSchema),\n})\n\nexport type Installer = z.infer<typeof InstallerSchema>\nexport type Harness = z.infer<typeof HarnessSchema>\nexport type HarnessCodes = z.infer<typeof HarnessCodesSchema>\n","import { z } from 'zod'\n\n/**\n * Manifest Schema for .autonomos/manifest.json\n */\nexport const ManifestSchema = z.object({\n protocolVersion: z.string().describe('Version of the Agent Protocol specification'),\n cliVersion: z.string().describe('Version of the CLI that last updated this project'),\n initializedAt: z.string().datetime().describe('ISO timestamp of project initialization'),\n lastUpdated: z.string().datetime().describe('ISO timestamp of last protocol update'),\n})\n\nexport type Manifest = z.infer<typeof ManifestSchema>\n","/**\n * Priority levels for tasks\n */\nexport type Priority = '🔴 Critical' | '🟠 High' | '🔵 Medium' | '⚪ Low'\n\n/**\n * Complexity estimates for tasks\n */\nexport type Complexity = 'S' | 'M' | 'L' | 'XL'\n\n/**\n * Task status markers\n */\nexport type TaskStatus = 'TODO' | 'IN_PROGRESS' | 'DONE' | 'BLOCKED'\n\n/**\n * Task entity parsed from TASKS.md\n */\nexport interface Task {\n id: string\n title: string\n priority: Priority\n complexity: Complexity\n status: TaskStatus\n worklogPath?: string\n}\n\n/**\n * Agent configuration parsed from AGENT.md\n */\nexport interface AgentConfig {\n name: string\n description?: string\n stack: string[]\n preferences?: Record<string, any>\n}\n\nexport interface AgentSection {\n title: string\n content: string\n}\n\nexport interface AgentContext {\n title: string\n description?: string\n sections: AgentSection[]\n metadata?: Record<string, any>\n}\n\nexport const PRIORITIES: Priority[] = ['🔴 Critical', '🟠 High', '🔵 Medium', '⚪ Low']\nexport const COMPLEXITIES: Complexity[] = ['S', 'M', 'L', 'XL']\n","/**\n * Template for AGENT.md - The context anchor at project root\n * @param projectName - Name of the project to personalize the template\n */\nexport function generateAgentTemplate(projectName: string = 'Project'): string {\n return `---\nname: \"${projectName}\"\ntype: \"project\"\nstatus: \"active\"\n---\n# AGENT CONTEXT: ${projectName}\n\n## 🧠 Context & Objectives\n\n*Describe what this project does and its main goals.*\n\n## ⚙️ Workflow & Preferences\n\n- **Commits:** Conventional Commits\n- **Language:** English\n- **Design:** If present, read root \\`DESIGN.md\\` before changing a user-facing surface; use \\`/design\\` for new direction, critique, or design-knowledge extraction.\n\n## 🏗 Stack & Architecture\n\n- **Tech:** *(List frameworks, libraries)*\n- **Patterns:** *(Architecture patterns used)*\n\n## 📁 Key Directories\n\n| Path | Description |\n|------|-------------|\n| \\`src/\\` | Source code |\n| \\`.autonomos/\\` | Agent Protocol files |\n\n## ⚠️ Known Constraints\n\n*List any technical debts, missing features, or external limitations.*\n`\n}\n\n/**\n * Generate a minimal local AGENT.md for subdirectories.\n * Free format by design — low friction encourages creation.\n * @param dirName - Name of the directory\n */\nexport function generateLocalAgentTemplate(dirName: string): string {\n return `# AGENT: ${dirName}\n\n- **Stack:** *(frameworks, libs specific to this module)*\n- **Conventions:** *(naming, exports, test patterns)*\n- **Constraints:** *(known issues, tech debt)*\n`\n}\n\n/**\n * Default root AGENT.md template\n */\nexport const AGENT_TEMPLATE = generateAgentTemplate()\n\n/**\n * Default local AGENT.md template\n */\nexport const LOCAL_AGENT_TEMPLATE = generateLocalAgentTemplate('module')\n","import { PROTOCOL_VERSION } from '../constants'\nimport { ManifestSchema, type Manifest } from '../schemas/manifest'\n\n/**\n * Creates a new manifest object with current timestamps\n */\nexport function createManifest(cliVersion: string): Manifest {\n const now = new Date().toISOString()\n return {\n protocolVersion: PROTOCOL_VERSION,\n cliVersion,\n initializedAt: now,\n lastUpdated: now,\n }\n}\n\n/**\n * Generates the manifest.json content as a formatted string\n */\nexport function generateManifestContent(manifest: Manifest): string {\n return JSON.stringify(manifest, null, 4) + '\\n'\n}\n\n/**\n * Parses manifest.json content into a Manifest object with validation\n */\nexport function parseManifest(content: string): Manifest {\n const data = JSON.parse(content)\n return ManifestSchema.parse(data)\n}\n","import { PROTOCOL_VERSION } from '../constants'\n\n/**\n * The Protocol kernel template — v0.7\n *\n * Design principles (v0.7):\n * - PROTOCOL.md is a compact REFERENCE, not an executable workflow.\n * - All step-by-step instructions live in the workflow files.\n * - No duplication between PROTOCOL.md and workflows.\n * - Short enough that an LLM can re-scan it mid-session without cost.\n */\nexport const PROTOCOL_TEMPLATE = `# AUTONOMOS PROTOCOL (v${PROTOCOL_VERSION})\n\n> This file defines the project's AI workflow contract. The workflows execute it. Do not duplicate workflow steps here.\n\n## Quick Reference\n\n| Action | How |\n| -------------------------------- | ---------------------------------------------------------------------------------- |\n| Start a session | Read the \\`/session\\` workflow |\n| Start a task | Read the \\`/task\\` workflow |\n| Triage a problem or proposal | Read the optional \\`/issue\\` workflow |\n| Adopt existing project knowledge | Read the optional \\`/adopt\\` workflow |\n| Reconcile drift and archive history | Read the \\`/reconcile\\` workflow |\n| Design or critique a surface | Read the optional \\`/design\\` workflow |\n| End a session | Read the \\`/crystallize\\` workflow |\n| Get context | Read root \\`AGENT.md\\`, then only the selected scope's ancestor chain |\n| Resolve objective | Explicit user request first; otherwise resume \\`[/]\\` or pick highest-priority \\`[ ]\\` |\n| Log session work | Create \\`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md\\` |\n\n## File Map\n\n| File | Location | Role |\n| --------------- | -------------------------- | ------------------------------------------------- |\n| \\`AGENT.md\\` | Root + any subdirectory | Durable guidance for its directory scope |\n| \\`TASKS.md\\` | \\`.autonomos/TASKS.md\\` | Current task state and optional Current direction |\n| \\`ISSUES.md\\` | \\`.autonomos/ISSUES.md\\` | Optional problem, proposal, and question intake |\n| \\`worklogs/\\` | \\`.autonomos/worklogs/\\` | Historical session evidence, not current guidance |\n| \\`archive/\\` | \\`.autonomos/archive/\\` | Optional history, searched only when justified |\n| \\`specs/\\` | \\`.autonomos/specs/\\` | Optional project-owned normative target state |\n| \\`decisions/\\` | \\`.autonomos/decisions/\\` | Optional project-owned decision records (ADRs) |\n| \\`DESIGN.md\\` | Root or target scope | Optional project-owned visual/interaction direction |\n| \\`PROTOCOL.md\\` | \\`.autonomos/PROTOCOL.md\\` | This file — read-only reference |\n| \\`manifest.json\\` | \\`.autonomos/manifest.json\\` | Protocol version metadata |\n\n## Design Direction Boundary\n\n\\`DESIGN.md\\` is optional project-owned direction, not a managed protocol\nartifact. Use \\`/design\\` when a surface needs direction, critique, or\ndesign-knowledge extraction; keep the project's identity and examples local.\nThe workflow supplies routing and evidence rules, not a universal visual style.\n\n## AGENT.md Format Rules\n\nStore only stable guidance that will affect different future tasks. Keep transient evidence in worklogs and operational explanations in component documentation. Use the narrowest applicable \\`AGENT.md\\`; consolidate or replace obsolete entries instead of appending history. Preserve valid subclaims in mixed paragraphs. Check the resulting text for completed-action narratives, task progress and unsupported prohibitions; these do not belong in operating guidance.\n\n**Root \\`AGENT.md\\`** — Must use the structured template (frontmatter + sections: Context, Workflow, Stack, Key Directories, Constraints).\n\n**Local \\`AGENT.md\\`** (in any subdirectory) — Free format. One line is enough if it is clear. What matters: the next session can use it. Example:\n\n\\`\\`\\`markdown\n# AGENT: packages/core\n\n- Stack: TypeScript, Vitest, tsdown\n- Conventions: exports via src/index.ts, tests co-located (\\\\*.test.ts)\n- Constraint: template changes require workflow test updates\n\\`\\`\\`\n\n## Issue, Specification, Decision, and Task Rules\n\nIssues describe evidence, impact, and a desired outcome without choosing implementation; proposed directions remain hypotheses until an approach is accepted. Specifications describe accepted target behavior or requirements that may guide multiple tasks. A decision record (commonly ADR, Architecture Decision Record) captures one technical choice and its rationale. Tasks describe an accepted intervention and completion criteria. Use optional \\`ISSUES.md\\`, \\`specs/\\`, and \\`decisions/\\` only when they provide value; direct, clear changes may become tasks immediately. Link related issues, specs, decisions, and tasks in both directions.\n\n## Specification and Decision Rules\n\n- \\`.autonomos/specs/\\` and \\`.autonomos/decisions/\\` are optional, project-owned, first-use directories; \\`init\\`, \\`update\\`, and artifact-integrity checks do not create or overwrite them.\n- Keep one Markdown file per bounded specification or decision. Include status, scope, provenance, acceptance criteria or consequences, and replacement links where relevant; no parser or independent version is required initially.\n- Specification status is \\`draft\\`, \\`accepted\\`, or \\`superseded\\`. Only \\`accepted\\` is normative; \\`superseded\\` points to its successor. Acceptance does not mean implementation is complete.\n- Decision records use \\`proposed\\`, \\`accepted\\`, or \\`superseded\\`; they preserve rationale and alternatives rather than duplicating the full specification.\n- Keep stable agent operating rules in \\`AGENT.md\\`, user/developer reference in \\`docs/\\`, execution state in \\`TASKS.md\\`, and historical evidence in \\`worklogs/\\`.\n- Read only relevant accepted records at task start. Use \\`/adopt\\` to extract legacy knowledge; never rewrite historical worklogs, issues, or tasks to create current artifacts.\n\nThe protocol-facing name is **decision record**. **ADR** (Architecture Decision Record) is a common convention for the same kind of document, not a required external standard. Use these lightweight Markdown shapes as a starting point; they are conventions, not parser-enforced schemas:\n\n\\`\\`\\`markdown\n# SPEC-001 — Concise target-state title\n\n- Status: draft | accepted | superseded\n- Scope: component, capability, or boundary\n- Provenance: issue, discussion, or source links\n- Related decisions: ADR-001, ...\n- Superseded by: SPEC-002 (when applicable)\n\n## Intent\n\n## Requirements\n\n## Acceptance criteria\n\n## Out of scope\n\\`\\`\\`\n\n\\`\\`\\`markdown\n# ADR-001 — Concise decision title\n\n- Status: proposed | accepted | superseded\n- Scope: component or technical boundary\n- Provenance: issue, task, or investigation links\n- Related specs: SPEC-001, ...\n- Superseded by: ADR-002 (when applicable)\n\n## Context\n\n## Decision\n\n## Alternatives considered\n\n## Consequences\n\\`\\`\\`\n\nOnly user/project governance accepts a specification or decision as normative. Agents may draft and link records, but must not silently promote them; acceptance is separate from implementation completion.\n\n## Current Context and Archival Lifecycle\n\n- Current context must support ordinary work without archives. Keep applicable guidance, accepted requirements/decisions, unresolved work, dependencies and necessary next actions discoverable. Acceptance is independent of implementation; dated temporary directives remain active until lifted or their stated end condition is met.\n- A completed task or resolved/declined issue is an archival candidate only when its own scope is settled and still-needed outcomes/constraints/references are retained in current context. Explicitly abandoned work may be archived with its reason, without claiming it was completed. A completed child does not satisfy unmet parent acceptance criteria.\n- Record new task completion dates as \\`Completed: YYYY-MM-DD\\`; do not infer missing old dates from worklog filenames. Age, a checkbox, absent code or a newer statement alone is not proof of obsolescence.\n- Group archival at coherent completed-work boundaries, not per task or calendar interval. No Sprint object or scheduled maintenance is required. Correct certain in-scope drift proactively during normal work; use \\`/reconcile\\` for investigation, consolidation and archival.\n- Before moving history, consolidate current knowledge in its existing narrowest home. Optional \\`Current direction\\` in \\`TASKS.md\\` explains present aims, recent consequential outcomes and next work; rewrite it rather than append chronology. Keep progress out of \\`AGENT.md\\`.\n- Create project-owned \\`.autonomos/archive/README.md\\` and meaningful batch directories on first use only. A batch can contain \\`TASKS.md\\`, \\`ISSUES.md\\`, \\`worklogs/\\` and provenance for retired guidance. Group/split batches by useful scope; there is no fixed age, size or mandatory per-record schema.\n- Archive means move, not delete or rewrite conclusions. Preserve historical record content, identifiers and provenance; repair relative paths when necessary. Preserve original mixed-source text when retiring only some claims. Applicable specs/decisions stay current independently of execution records. Extraction into new normative artifacts still uses \\`/adopt\\`.\n- The archive index maps batch topics to records, not a second task journal. Search by ID or subject only when a specific question requires history; neither archives nor their entire index are routine startup context. Keep only necessary dependency/outcome pointers in current records, not a permanent stub for every completed task.\n- Archived task and issue IDs remain reserved. Before assigning an ID, search current and archived registries. With a CLI, \\`readTaskRegistry(root, { history: true })\\` exposes task references and duplicates; plain Markdown search works without it.\n- Verify exact source text before edits, retained current knowledge, IDs and resolvable references after moves. Do not confuse tool annotations with file content or historical validation with a current observation. Re-read shared files before writing and preserve unrelated concurrent changes. Stop when a second pass yields no deterministic correction.\n- \\`autonomos status\\` summarizes the current task registry; \\`--history\\` adds separate archived counts and read/collision diagnostics. Archived means historical, not necessarily completed. History uses batch \\`TASKS.md\\` files, not arbitrary worklog checklists.\n- Archives are project-owned, like specs and decisions. Initialization, updates and integrity checks neither create empty archives nor overwrite, relocate or judge their contents. Installing a new protocol performs no automatic cleanup. Version-control policy stays project-owned; Git is not required for archival or retrieval.\n\nExample (only files needed by a batch are created):\n\n\\`\\`\\`text\n.autonomos/\n TASKS.md\n ISSUES.md\n archive/\n README.md\n realtime-experiment-retirement/\n TASKS.md\n ISSUES.md\n worklogs/\n\\`\\`\\`\n\n## Task Format\n\n\\`- [Status] **[ID]** Title \\\\\\`Priority\\\\\\` \\\\\\`Complexity\\\\\\`\\`\n\n| Status | Priority | Complexity |\n| ----------------- | ------------- | ---------- |\n| \\`[ ]\\` Todo | \\`🔴 Critical\\` | \\`S\\` Small |\n| \\`[/]\\` In Progress | \\`🟠 High\\` | \\`M\\` Medium |\n| \\`[x]\\` Done | \\`🔵 Medium\\` | \\`L\\` Large |\n| \\`[!]\\` Blocked | \\`⚪ Low\\` | \\`XL\\` Huge |\n\n## Metadata Rules\n\n- **Language:** English unless AGENT.md says otherwise.\n- **Tone:** Technical, concise, fact-based.\n- **Continuity:** Refer to previous work as \"we\" or \"the project\".\n`\n\n/**\n * @deprecated Use PROTOCOL_TEMPLATE instead\n */\nexport const PROTOCOL_TEMPLATE_V2026_1 = PROTOCOL_TEMPLATE\n","/**\n * Template for TASKS.md - The task registry\n */\nexport const TASKS_TEMPLATE = `# PROJECT TASKS & ROADMAP\n\n> **LEGEND**\n> **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]\n> **Complexity:** [S] Small, [M] Medium, [L] Large, [XL] Huge (Planning required)\n> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked\n\n## 🚀 Current work\n\n- [ ] **[INIT-01]** Review project context and structure \\`Priority: 🔵\\` \\`Complexity: S\\`\n\n## 🔮 Backlog\n\n*(Add future tasks here)*\n`\n","import type { TaskStatus } from '../types'\n\ninterface WorklogOptions {\n taskId: string\n taskName: string\n date?: string\n status: 'Complete' | 'Partial' | 'Blocked'\n description: string\n filesModified: string[]\n decisions: string[]\n challenges: string[]\n nextSteps: string[]\n}\n\n/**\n * Generate a Worklog markdown content\n */\nexport function generateWorklogContent(options: WorklogOptions): string {\n const date = options.date ?? new Date().toISOString().split('T')[0]\n\n return `# WORKLOG: [${options.taskId}] ${options.taskName}\n**Date:** ${date}\n**Agent Status:** [${options.status}]\n\n## 📝 Description\n${options.description}\n\n## 🛠 Technical Details\n- **Files Modified:**\n${options.filesModified.map(f => ` - ${f}`).join('\\n')}\n- **Key Decisions:**\n${options.decisions.map(d => ` - ${d}`).join('\\n')}\n- **Challenges:**\n${options.challenges.map(c => ` - ${c}`).join('\\n')}\n\n## ⏭ Next Steps / Context for Successor\n${options.nextSteps.map(s => `- ${s}`).join('\\n')}\n`\n}\n\n/**\n * Common status mapping for worklogs\n */\nexport function mapTaskStatusToWorklogStatus(\n status: TaskStatus\n): 'Complete' | 'Partial' | 'Blocked' {\n switch (status) {\n case 'DONE':\n return 'Complete'\n case 'BLOCKED':\n return 'Blocked'\n default:\n return 'Partial'\n }\n}\n","import { existsSync, statSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\n\nimport { AGENT_FILE } from '../constants'\n\n/**\n * Result of an ancestor lookup: a single AGENT.md entry that exists on the\n * path between a target file or directory and the project root.\n */\nexport interface AncestorAgent {\n /** Absolute path to the directory containing the AGENT.md */\n dir: string\n /** Absolute path to the AGENT.md file */\n path: string\n /** Path of the directory relative to the project root */\n relativeDir: string\n}\n\n/**\n * Return the ordered list of AGENT.md files that exist on the path from a\n * target file or directory up to the project root. The order is root-first,\n * then each intermediate directory, then the target directory itself.\n *\n * Non-existent AGENT.md files are silently skipped (the chain can have gaps).\n *\n * @param target - The absolute or project-relative path to a file or directory.\n * @param projectRoot - The absolute path of the project root (where the root\n * AGENT.md lives). Defaults to the current working directory.\n *\n * @example\n * findAncestorAgents('/proj/apps/web/components/ui/button.tsx', '/proj')\n * // Returns, in order:\n * // - { dir: '/proj', path: '/proj/AGENT.md' }\n * // - { dir: '/proj/apps/web', path: '/proj/apps/web/AGENT.md' }\n * // (apps/, components/ skipped because they have no AGENT.md)\n * // (button.tsx itself is a file, so its parent dir is the last one checked)\n */\nexport function findAncestorAgents(\n target: string,\n projectRoot: string = process.cwd()\n): AncestorAgent[] {\n const absRoot = resolve(projectRoot)\n const absTarget = resolveAgainstRoot(target, absRoot)\n\n // Validate that the target lives within the project root\n const relToRoot = relative(absRoot, absTarget)\n if (relToRoot.startsWith('..') || isAbsolute(relToRoot)) {\n throw new Error(\n `Target \"${target}\" is outside the project root \"${absRoot}\". ` +\n `findAncestorAgents only handles paths within the project.`\n )\n }\n\n // Collect every directory from the target up to the root, in root-first order.\n // For a file target, we only look at the directory chain (not the file itself).\n // For a directory target, the directory itself is included as the last entry.\n const targetDir = isDirectory(absTarget) ? absTarget : dirname(absTarget)\n const dirs = collectAncestorDirs(targetDir, absRoot)\n\n const result: AncestorAgent[] = []\n for (const dir of dirs) {\n const agentPath = join(dir, AGENT_FILE)\n if (existsSync(agentPath)) {\n result.push({\n dir,\n path: agentPath,\n relativeDir: relativeDir(dir, absRoot),\n })\n }\n }\n\n return result\n}\n\n/**\n * Resolve a target path against the project root. Accepts absolute paths\n * (returned as-is) and project-relative paths (joined with the root).\n */\nfunction resolveAgainstRoot(target: string, absRoot: string): string {\n if (isAbsolute(target)) return target\n return join(absRoot, target)\n}\n\n/**\n * Return the directory chain from a starting directory up to (and including)\n * the project root, in root-first order. The chain is computed by walking\n * the relative path segments from the starting dir back to the root.\n */\nfunction collectAncestorDirs(startDir: string, absRoot: string): string[] {\n const rel = relative(absRoot, startDir)\n if (rel === '' || rel === '.') {\n return [absRoot]\n }\n\n const segments = rel.split(sep).filter(s => s !== '' && s !== '.')\n const chain: string[] = [absRoot]\n let acc = absRoot\n for (const seg of segments) {\n acc = join(acc, seg)\n chain.push(acc)\n }\n return chain\n}\n\n/**\n * Compute the directory's path relative to the project root, in a form\n * suitable for display. The root itself is rendered as \".\".\n */\nfunction relativeDir(dir: string, absRoot: string): string {\n const rel = relative(absRoot, dir)\n return rel === '' ? '.' : rel\n}\n\nfunction isDirectory(p: string): boolean {\n try {\n return statSync(p).isDirectory()\n } catch {\n return false\n }\n}\n","import yaml from 'js-yaml'\nimport type { AgentContext, AgentSection } from '../types'\n\nexport class AgentParser {\n /**\n * Parse an AGENT.md content into a structured AgentContext\n */\n static parse(markdown: string): AgentContext {\n let content = markdown\n let metadata: Record<string, any> = {}\n\n // Parse Frontmatter\n const frontmatterRegex = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---/\n const match = markdown.match(frontmatterRegex)\n if (match) {\n try {\n metadata = yaml.load(match[1] as string) as Record<string, any>\n content = markdown.slice(match[0].length).trim()\n } catch (e) {\n console.error('Failed to parse Agent frontmatter:', e)\n }\n }\n\n const lines = content.split(/\\r?\\n/)\n const sections: AgentSection[] = []\n let title = metadata.name ?? 'Unknown Agent'\n let currentSection: AgentSection | null = null\n let currentContent: string[] = []\n\n for (const line of lines) {\n // Parse Title (Only if not already set by frontmatter)\n if (line.startsWith('# ') && !metadata.name) {\n const rawTitle = line.replace('# ', '').trim()\n // Handle \"AGENT CONTEXT: [Name]\" format\n if (rawTitle.toUpperCase().startsWith('AGENT CONTEXT:')) {\n title = rawTitle\n .slice(14)\n .replace(/^[:\\s-]+/, '')\n .trim()\n } else {\n title = rawTitle\n }\n continue\n }\n\n // Parse Sections\n if (line.startsWith('## ')) {\n // Save previous section\n if (currentSection) {\n currentSection.content = currentContent.join('\\n').trim()\n sections.push(currentSection)\n }\n\n currentSection = {\n title: line.replace('## ', '').trim(),\n content: '',\n }\n currentContent = []\n continue\n }\n\n // Collect content\n if (currentSection) {\n currentContent.push(line)\n }\n }\n\n // Save last section\n if (currentSection) {\n currentSection.content = currentContent.join('\\n').trim()\n sections.push(currentSection)\n }\n\n return {\n title,\n sections,\n metadata,\n }\n }\n}\n","import { existsSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\n\nimport { AUTONOMOS_DIR } from '../constants'\n\n/**\n * Markers that identify the root of an Autonomos / git project.\n *\n * `.autonomos/` is a strong signal: if it exists, the project has already\n * been initialized with the protocol and the directory containing it is,\n * by definition, the project root.\n *\n * `.git/` is a weaker signal: it only tells us the directory is inside a\n * git working tree. We still stop at the first `.git/` we see, which is\n * good enough for the common monorepo case (the monorepo root contains\n * the `.git/`, package subdirectories do not).\n */\nconst PROJECT_MARKERS = [AUTONOMOS_DIR, '.git'] as const\n\n/**\n * Find the directory that owns this project by walking up from `startDir`\n * until we find a directory containing `.autonomos/` or `.git/`.\n *\n * Returns `null` if no such directory exists before we reach the\n * filesystem root.\n *\n * Notes on behavior:\n * - The search stops at the first directory that contains any of the\n * markers. For monorepos this is the monorepo root, not the package\n * directory the caller is sitting in.\n * - A directory containing `.git/` is preferred over walking further up:\n * this prevents leaking into a parent repository in nested-worktree\n * setups. Callers that need the absolute git toplevel can run\n * `git rev-parse --show-toplevel` themselves after this returns.\n *\n * @param startDir - Absolute path to start the search from.\n */\nexport function findProjectRoot(startDir: string): string | null {\n if (!startDir) return null\n const start = resolve(startDir)\n let current = start\n\n while (true) {\n if (PROJECT_MARKERS.some(marker => existsSync(join(current, marker)))) {\n return current\n }\n const parent = dirname(current)\n if (parent === current) return null\n current = parent\n }\n}\n\n/**\n * Check whether two absolute paths refer to the same directory.\n *\n * Resolves `.` / `..` segments before comparing, so `/a/b` and\n * `/a/b/./` are considered the same.\n */\nexport function isSamePath(a: string, b: string): boolean {\n if (!a || !b) return false\n return resolve(a) === resolve(b)\n}\n\n/**\n * Render a path relative to another path, with one guarantee that the\n * default `path.relative` doesn't give us: we never return a value that\n * starts with `..`. If `target` is not under `base`, we return the\n * absolute resolved path of `target` so the caller can still show a\n * useful location.\n */\nexport function displayRelative(target: string, base: string): string {\n const rel = relative(base, target)\n if (rel === '' || rel === '.') return '.'\n if (rel.startsWith(`..${sep}`) || rel === '..' || isAbsolute(rel)) {\n return resolve(target)\n }\n return rel\n}\n","import type { Complexity, Priority, Task, TaskStatus } from '../types'\n\nexport class TaskParser {\n /** Discover IDs/status without requiring optional priority or complexity metadata. */\n static references(markdown: string): { id: string; status: TaskStatus; line: number }[] {\n const references: { id: string; status: TaskStatus; line: number }[] = []\n let fence: string | undefined\n for (const [index, line] of markdown.split(/\\r?\\n/).entries()) {\n const marker = line.match(/^\\s{0,3}(`{3,}|~{3,})/)\n if (marker?.[1]) {\n if (!fence) fence = marker[1]\n else if (\n marker[1][0] === fence[0] &&\n marker[1].length >= fence.length &&\n !line.slice(marker[0].length).trim()\n )\n fence = undefined\n continue\n }\n if (fence) continue\n const match = line.match(/^\\s*- \\[([ x/!])\\] \\*\\*\\[([^\\]]+)\\]\\*\\*/)\n if (match?.[1] && match[2]?.trim()) {\n references.push({\n id: match[2].trim(),\n status: this.mapStatus(match[1]),\n line: index + 1,\n })\n }\n }\n return references\n }\n\n static parse(markdown: string): Task[] {\n const tasks: Task[] = []\n const lines = markdown.split(/\\r?\\n/)\n const taskRegex = /- \\[([ x/!])\\] \\*\\*\\[(.+)\\]\\*\\* (.+) `Priority: (.+)` `Complexity: (.+)`/\n\n for (const line of lines) {\n const match = line.match(taskRegex)\n if (match) {\n const [, statusChar = ' ', id = '', title = '', priority = '', complexity = ''] =\n match\n tasks.push({\n id,\n title: title.trim(),\n priority: priority as Priority,\n complexity: complexity as Complexity,\n status: this.mapStatus(statusChar),\n })\n }\n }\n return tasks\n }\n\n private static mapStatus(char: string): TaskStatus {\n switch (char) {\n case ' ':\n return 'TODO'\n case '/':\n return 'IN_PROGRESS'\n case 'x':\n return 'DONE'\n case '!':\n return 'BLOCKED'\n default:\n return 'TODO'\n }\n }\n}\n","import { lstatSync, readFileSync, readdirSync } from 'node:fs'\nimport { join, relative } from 'node:path'\n\nimport { ARCHIVE_DIR, AUTONOMOS_DIR, TASKS_FILE } from '../constants'\nimport { TaskParser } from './task-parser'\n\nexport interface TaskReference {\n id: string\n status: ReturnType<typeof TaskParser.references>[number]['status']\n line: number\n /** Source path relative to the supplied project root. */\n path: string\n}\n\nexport interface TaskRegistry {\n current: TaskReference[]\n archived: TaskReference[]\n duplicateIds: string[]\n warnings: string[]\n /** False if a requested registry could not be inspected completely. */\n complete: boolean\n}\n\n/** Read current task IDs; opt into history for reporting or reserving a new ID. */\nexport function readTaskRegistry(root: string, options: { history?: boolean } = {}): TaskRegistry {\n const registry: TaskRegistry = {\n current: [],\n archived: [],\n duplicateIds: [],\n warnings: [],\n complete: true,\n }\n function warn(path: string, message: string): void {\n registry.complete = false\n registry.warnings.push(`${relative(root, path)}: ${message}`)\n }\n function read(path: string, target: TaskReference[]): void {\n try {\n const stat = lstatSync(path)\n if (!stat.isFile()) {\n warn(path, 'Expected a regular task registry; symbolic links are not followed')\n return\n }\n target.push(\n ...TaskParser.references(readFileSync(path, 'utf8')).map(task => ({\n ...task,\n path: relative(root, path),\n }))\n )\n } catch (error) {\n warn(path, error instanceof Error ? error.message : String(error))\n }\n }\n function scan(path: string, optional = false): void {\n try {\n const stat = lstatSync(path)\n if (!stat.isDirectory()) {\n warn(path, 'Expected an archive directory; symbolic links are not followed')\n return\n }\n for (const entry of readdirSync(path, { withFileTypes: true }).sort((a, b) =>\n a.name.localeCompare(b.name)\n )) {\n const child = join(path, entry.name)\n if (entry.isSymbolicLink()) warn(child, 'Skipped symbolic link in archive')\n else if (entry.isDirectory()) scan(child)\n else if (entry.name === TASKS_FILE) read(child, registry.archived)\n }\n } catch (error) {\n if (optional && (error as NodeJS.ErrnoException).code === 'ENOENT') return\n warn(path, error instanceof Error ? error.message : String(error))\n }\n }\n const autonomosPath = join(root, AUTONOMOS_DIR)\n try {\n if (!lstatSync(autonomosPath).isDirectory()) {\n warn(\n autonomosPath,\n 'Expected a regular project directory; symbolic links are not followed'\n )\n return registry\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n warn(autonomosPath, error instanceof Error ? error.message : String(error))\n }\n return registry\n }\n const currentPath = join(autonomosPath, TASKS_FILE)\n try {\n lstatSync(currentPath)\n read(currentPath, registry.current)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n warn(currentPath, error instanceof Error ? error.message : String(error))\n }\n }\n if (options.history) scan(join(root, AUTONOMOS_DIR, ARCHIVE_DIR), true)\n const seen = new Set<string>()\n const duplicates = new Set<string>()\n for (const task of [...registry.current, ...registry.archived]) {\n if (seen.has(task.id)) duplicates.add(task.id)\n seen.add(task.id)\n }\n registry.duplicateIds = [...duplicates].sort()\n return registry\n}\n","","import harnessCodesData from './data/harness-codes.json' with { type: 'json' }\nimport {\n HarnessCodesSchema,\n type Harness,\n type HarnessCodes,\n type Installer,\n} from './schemas/harness-codes'\n\n/**\n * Validated, in-memory representation of the harness codes config.\n * Loaded once at module init, validated via Zod.\n */\nconst codes: HarnessCodes = HarnessCodesSchema.parse(harnessCodesData)\n\n/**\n * Get a single harness entry by its id.\n * Throws if the id is unknown.\n */\nexport function getHarness(id: string): Harness {\n const entry = codes.platforms[id]\n if (!entry) {\n const known = Object.keys(codes.platforms).join(', ')\n throw new Error(`Unknown harness: \"${id}\". Known harnesses: ${known}`)\n }\n return entry\n}\n\n/**\n * List all configured harnesses, as an array of {id, harness} pairs.\n * Stable order: insertion order of the JSON object.\n */\nexport function listHarnesses(): Array<{ id: string; harness: Harness }> {\n return Object.entries(codes.platforms).map(([id, harness]) => ({ id, harness }))\n}\n\n/**\n * Get the list of preferred harnesses (shown as recommended options).\n */\nexport function listPreferredHarnesses(): Array<{ id: string; harness: Harness }> {\n return listHarnesses().filter(({ harness }) => harness.preferred)\n}\n\n/**\n * A resolved target directory where workflow files will be written.\n * One per unique path, with the list of harness ids that share it.\n */\nexport interface ResolvedTarget {\n /** Absolute or project-relative path to the directory */\n path: string\n /** File extension to use (e.g. \".md\", \".agent.md\") */\n fileExtension: string\n /** Ids of the harnesses that will read from this directory */\n usedBy: string[]\n}\n\n/**\n * Resolve the unique target directories for a set of harness ids.\n *\n * Harnesses that share the same `skillsDir` (e.g. Codex, OpenCode, KiloCode\n * all use `.agents/skills/`) are deduplicated: the directory appears once\n * in the output, with all the harness ids listed in `usedBy`.\n *\n * The `path` is returned relative to the project root (caller is responsible\n * for joining with the project cwd).\n */\nexport function resolveTargets(harnessIds: string[], cwd: string = '.'): ResolvedTarget[] {\n const map = new Map<string, ResolvedTarget>()\n\n for (const id of harnessIds) {\n const { installer } = getHarness(id)\n collectFromInstaller(map, installer, id, cwd)\n }\n\n return Array.from(map.values())\n}\n\nfunction collectFromInstaller(\n map: Map<string, ResolvedTarget>,\n installer: Installer,\n harnessId: string,\n cwd: string\n): void {\n const ext = installer.fileExtension\n if (installer.workflowsDir) {\n addTarget(map, joinPath(cwd, installer.workflowsDir), ext, harnessId)\n } else if (installer.targetDir) {\n addTarget(map, joinPath(cwd, installer.targetDir), ext, harnessId)\n } else if (installer.skillsDir) {\n addTarget(map, joinPath(cwd, installer.skillsDir), ext, harnessId)\n }\n if (installer.commandsDir) {\n addTarget(map, joinPath(cwd, installer.commandsDir), ext, harnessId)\n }\n}\n\nfunction addTarget(\n map: Map<string, ResolvedTarget>,\n path: string,\n fileExtension: string,\n harnessId: string\n): void {\n const existing = map.get(path)\n if (existing) {\n if (!existing.usedBy.includes(harnessId)) {\n existing.usedBy.push(harnessId)\n }\n } else {\n map.set(path, { path, fileExtension, usedBy: [harnessId] })\n }\n}\n\nfunction joinPath(a: string, b: string): string {\n if (a === '.' || a === '') return b\n if (b.startsWith('/')) return `${a}${b}`\n return `${a}/${b}`\n}\n\n/**\n * Get the raw (validated) codes object, for advanced use cases.\n * Most callers should use the hig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AW,EAAG,EAAK,CAAS,CAE3E,CAEA,SAAS,EACL,EACA,EACA,EACA,EACI,CACJ,IAAM,EAAW,EAAI,IAAI,CAAI,EACzB,EACK,EAAS,OAAO,SAAS,CAAS,GACnC,EAAS,OAAO,KAAK,CAAS,EAGlC,EAAI,IAAI,EAAM,CAAE,OAAM,gBAAe,OAAQ,CAAC,CAAS,CAAE,CAAC,CAElE,CAEA,SAAS,EAAS,EAAW,EAAmB,CAG5C,OAFI,IAAM,KAAO,IAAM,GAAW,EAC9B,EAAE,WAAW,GAAG,EAAU,GAAG,IAAI,IAC9B,GAAG,EAAE,GAAG,GACnB,CAMA,SAAgB,IAAmC,CAC/C,OAAO,CACX"}
1
+ {"version":3,"file":"index.mjs","names":["harnessCodesData"],"sources":["../src/constants.ts","../src/schemas/harness-codes.ts","../src/schemas/manifest.ts","../src/types.ts","../src/templates/agent.ts","../src/templates/manifest.ts","../src/templates/protocol.ts","../src/templates/tasks.ts","../src/templates/worklog.ts","../src/parsers/agent-finder.ts","../src/parsers/agent-parser.ts","../src/parsers/project-root.ts","../src/parsers/task-parser.ts","../src/parsers/task-registry.ts","../src/data/harness-codes.json","../src/harness-codes.ts"],"sourcesContent":["/**\n * Agent Protocol Specification Version (Independent of Package versions)\n * This refers to the schema and behavioral contract version.\n */\nexport const PROTOCOL_VERSION = '0.7.0-alpha'\n\n/**\n * Directory name for Autonomos configuration\n */\nexport const AUTONOMOS_DIR = '.autonomos'\n\n/**\n * Manifest filename\n */\nexport const MANIFEST_FILE = 'manifest.json'\n\n/**\n * Protocol filename\n */\nexport const PROTOCOL_FILE = 'PROTOCOL.md'\n\n/**\n * Tasks filename\n */\nexport const TASKS_FILE = 'TASKS.md'\n\n/**\n * Agent context filename (at project root)\n */\nexport const AGENT_FILE = 'AGENT.md'\n\n/**\n * Worklogs directory name\n */\nexport const WORKLOGS_DIR = 'worklogs'\n\n/**\n * Optional project-owned directory for durable target-state specifications\n */\nexport const SPECS_DIR = 'specs'\n\n/**\n * Optional project-owned directory for technical decision records (ADRs)\n */\nexport const DECISIONS_DIR = 'decisions'\n\n/** Optional project-owned history, never loaded by default. */\nexport const ARCHIVE_DIR = 'archive'\n","import { z } from 'zod'\n\n/**\n * Installer configuration for a single harness.\n *\n * At least one of `workflowsDir`, `targetDir`, or `skillsDir` must be defined.\n *\n * - `workflowsDir`: Where the protocol workflow files are written.\n * Preferred field — used by most harnesses.\n * - `targetDir`: Single directory (legacy, like Cline's .clinerules/workflows/).\n * - `skillsDir`: Skills directory (legacy, for harnesses that don't distinguish\n * skills from workflows).\n * - `commandsDir`: Additional commands directory (optional).\n */\nexport const InstallerSchema = z\n .object({\n workflowsDir: z.string().optional(),\n targetDir: z.string().optional(),\n skillsDir: z.string().optional(),\n commandsDir: z.string().optional(),\n promptsDir: z.string().optional(),\n globalTargetDir: z.string().optional(),\n fileExtension: z.string(),\n _note: z.string().optional(),\n })\n .refine(\n data =>\n Boolean(data.workflowsDir) ||\n Boolean(data.targetDir) ||\n Boolean(data.skillsDir) ||\n Boolean(data.commandsDir) ||\n Boolean(data.promptsDir),\n {\n message:\n 'At least one of `workflowsDir`, `targetDir`, `skillsDir`, `commandsDir`, or `promptsDir` must be defined',\n }\n )\n\n/**\n * A single harness entry.\n */\nexport const HarnessSchema = z.object({\n name: z.string().min(1),\n preferred: z.boolean(),\n installer: InstallerSchema,\n})\n\n/**\n * Root schema for the harness-codes configuration file.\n */\nexport const HarnessCodesSchema = z.object({\n platforms: z.record(z.string(), HarnessSchema),\n})\n\nexport type Installer = z.infer<typeof InstallerSchema>\nexport type Harness = z.infer<typeof HarnessSchema>\nexport type HarnessCodes = z.infer<typeof HarnessCodesSchema>\n","import { z } from 'zod'\n\n/**\n * Manifest Schema for .autonomos/manifest.json\n */\nexport const ManifestSchema = z.object({\n protocolVersion: z.string().describe('Version of the Agent Protocol specification'),\n cliVersion: z.string().describe('Version of the CLI that last updated this project'),\n initializedAt: z.string().datetime().describe('ISO timestamp of project initialization'),\n lastUpdated: z.string().datetime().describe('ISO timestamp of last protocol update'),\n})\n\nexport type Manifest = z.infer<typeof ManifestSchema>\n","/**\n * Priority levels for tasks\n */\nexport type Priority = '🔴 Critical' | '🟠 High' | '🔵 Medium' | '⚪ Low'\n\n/**\n * Complexity estimates for tasks\n */\nexport type Complexity = 'S' | 'M' | 'L' | 'XL'\n\n/**\n * Task status markers\n */\nexport type TaskStatus = 'TODO' | 'IN_PROGRESS' | 'DONE' | 'BLOCKED'\n\n/**\n * Task entity parsed from TASKS.md\n */\nexport interface Task {\n id: string\n title: string\n priority: Priority\n complexity: Complexity\n status: TaskStatus\n worklogPath?: string\n}\n\n/**\n * Agent configuration parsed from AGENT.md\n */\nexport interface AgentConfig {\n name: string\n description?: string\n stack: string[]\n preferences?: Record<string, any>\n}\n\nexport interface AgentSection {\n title: string\n content: string\n}\n\nexport interface AgentContext {\n title: string\n description?: string\n sections: AgentSection[]\n metadata?: Record<string, any>\n}\n\nexport const PRIORITIES: Priority[] = ['🔴 Critical', '🟠 High', '🔵 Medium', '⚪ Low']\nexport const COMPLEXITIES: Complexity[] = ['S', 'M', 'L', 'XL']\n","/**\n * Template for AGENT.md - The context anchor at project root\n * @param projectName - Name of the project to personalize the template\n */\nexport function generateAgentTemplate(projectName: string = 'Project'): string {\n return `---\nname: \"${projectName}\"\ntype: \"project\"\nstatus: \"active\"\n---\n# AGENT CONTEXT: ${projectName}\n\n## 🧠 Context & Objectives\n\n*Describe what this project does and its main goals.*\n\n## ⚙️ Workflow & Preferences\n\n- **Commits:** Conventional Commits\n- **Language:** English\n- **Design:** If present, read root \\`DESIGN.md\\` before changing a user-facing surface; use \\`/design\\` for new direction, critique, or design-knowledge extraction.\n\n## 🏗 Stack & Architecture\n\n- **Tech:** *(List frameworks, libraries)*\n- **Patterns:** *(Architecture patterns used)*\n\n## 📁 Key Directories\n\n| Path | Description |\n|------|-------------|\n| \\`src/\\` | Source code |\n| \\`.autonomos/\\` | Agent Protocol files |\n\n## ⚠️ Known Constraints\n\n*List any technical debts, missing features, or external limitations.*\n`\n}\n\n/**\n * Generate a minimal local AGENT.md for subdirectories.\n * Free format by design — low friction encourages creation.\n * @param dirName - Name of the directory\n */\nexport function generateLocalAgentTemplate(dirName: string): string {\n return `# AGENT: ${dirName}\n\n- **Stack:** *(frameworks, libs specific to this module)*\n- **Conventions:** *(naming, exports, test patterns)*\n- **Constraints:** *(known issues, tech debt)*\n`\n}\n\n/**\n * Default root AGENT.md template\n */\nexport const AGENT_TEMPLATE = generateAgentTemplate()\n\n/**\n * Default local AGENT.md template\n */\nexport const LOCAL_AGENT_TEMPLATE = generateLocalAgentTemplate('module')\n","import { PROTOCOL_VERSION } from '../constants'\nimport { ManifestSchema, type Manifest } from '../schemas/manifest'\n\n/**\n * Creates a new manifest object with current timestamps\n */\nexport function createManifest(cliVersion: string): Manifest {\n const now = new Date().toISOString()\n return {\n protocolVersion: PROTOCOL_VERSION,\n cliVersion,\n initializedAt: now,\n lastUpdated: now,\n }\n}\n\n/**\n * Generates the manifest.json content as a formatted string\n */\nexport function generateManifestContent(manifest: Manifest): string {\n return JSON.stringify(manifest, null, 4) + '\\n'\n}\n\n/**\n * Parses manifest.json content into a Manifest object with validation\n */\nexport function parseManifest(content: string): Manifest {\n const data = JSON.parse(content)\n return ManifestSchema.parse(data)\n}\n","import { PROTOCOL_VERSION } from '../constants'\n\n/**\n * The Protocol kernel template — v0.7\n *\n * Design principles (v0.7):\n * - PROTOCOL.md is a compact REFERENCE, not an executable workflow.\n * - All step-by-step instructions live in the workflow files.\n * - No duplication between PROTOCOL.md and workflows.\n * - Short enough that an LLM can re-scan it mid-session without cost.\n */\nexport const PROTOCOL_TEMPLATE = `# AUTONOMOS PROTOCOL (v${PROTOCOL_VERSION})\n\n> This file defines the project's AI workflow contract. The workflows execute it. Do not duplicate workflow steps here.\n\n## Quick Reference\n\n| Action | How |\n| -------------------------------- | ---------------------------------------------------------------------------------- |\n| Start a session | Read the \\`/session\\` workflow |\n| Start a task | Read the \\`/task\\` workflow |\n| Triage a problem or proposal | Read the optional \\`/issue\\` workflow |\n| Adopt existing project knowledge | Read the optional \\`/adopt\\` workflow |\n| Reconcile drift and archive history | Read the \\`/reconcile\\` workflow |\n| Design or critique a surface | Read the optional \\`/design\\` workflow |\n| End a session | Read the \\`/crystallize\\` workflow |\n| Get context | Read root \\`AGENT.md\\`, then only the selected scope's ancestor chain |\n| Resolve objective | Explicit user request first; otherwise resume \\`[/]\\` or pick highest-priority \\`[ ]\\` |\n| Log session work | Create \\`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md\\` |\n\n## File Map\n\n| File | Location | Role |\n| --------------- | -------------------------- | ------------------------------------------------- |\n| \\`AGENT.md\\` | Root + any subdirectory | Durable guidance for its directory scope |\n| \\`TASKS.md\\` | \\`.autonomos/TASKS.md\\` | Current task state and optional Current direction |\n| \\`ISSUES.md\\` | \\`.autonomos/ISSUES.md\\` | Optional problem, proposal, and question intake |\n| \\`worklogs/\\` | \\`.autonomos/worklogs/\\` | Historical session evidence, not current guidance |\n| \\`archive/\\` | \\`.autonomos/archive/\\` | Optional history, searched only when justified |\n| \\`specs/\\` | \\`.autonomos/specs/\\` | Optional project-owned normative target state |\n| \\`decisions/\\` | \\`.autonomos/decisions/\\` | Optional project-owned decision records (ADRs) |\n| \\`DESIGN.md\\` | Root or target scope | Optional project-owned visual/interaction direction |\n| \\`PROTOCOL.md\\` | \\`.autonomos/PROTOCOL.md\\` | This file — read-only reference |\n| \\`manifest.json\\` | \\`.autonomos/manifest.json\\` | Protocol version metadata |\n\n## Design Direction Boundary\n\n\\`DESIGN.md\\` is optional project-owned direction, not a managed protocol\nartifact. Use \\`/design\\` when a surface needs direction, critique, or\ndesign-knowledge extraction; keep the project's identity and examples local.\nThe workflow supplies routing and evidence rules, not a universal visual style.\n\n## AGENT.md Format Rules\n\nStore only stable guidance that will affect different future tasks. Keep transient evidence in worklogs and operational explanations in component documentation. Use the narrowest applicable \\`AGENT.md\\`; consolidate or replace obsolete entries instead of appending history. Preserve valid subclaims in mixed paragraphs. Check the resulting text for completed-action narratives, task progress and unsupported prohibitions; these do not belong in operating guidance.\n\n**Root \\`AGENT.md\\`** — Must use the structured template (frontmatter + sections: Context, Workflow, Stack, Key Directories, Constraints).\n\n**Local \\`AGENT.md\\`** (in any subdirectory) — Free format. One line is enough if it is clear. What matters: the next session can use it. Example:\n\n\\`\\`\\`markdown\n# AGENT: packages/core\n\n- Stack: TypeScript, Vitest, tsdown\n- Conventions: exports via src/index.ts, tests co-located (\\\\*.test.ts)\n- Constraint: template changes require workflow test updates\n\\`\\`\\`\n\n## Issue, Specification, Decision, and Task Rules\n\nIssues describe evidence, impact, and a desired outcome without choosing implementation; proposed directions remain hypotheses until an approach is accepted. Specifications describe accepted target behavior or requirements that may guide multiple tasks. A decision record (commonly ADR, Architecture Decision Record) captures one technical choice and its rationale. Tasks describe an accepted intervention and completion criteria. Use optional \\`ISSUES.md\\`, \\`specs/\\`, and \\`decisions/\\` only when they provide value; direct, clear changes may become tasks immediately. Link related issues, specs, decisions, and tasks in both directions.\n\n## Specification and Decision Rules\n\n- \\`.autonomos/specs/\\` and \\`.autonomos/decisions/\\` are optional, project-owned, first-use directories; \\`init\\`, \\`update\\`, and artifact-integrity checks do not create or overwrite them.\n- Keep one Markdown file per bounded specification or decision. Include status, scope, provenance, acceptance criteria or consequences, and replacement links where relevant; no parser or independent version is required initially.\n- Specification status is \\`draft\\`, \\`accepted\\`, or \\`superseded\\`. Only \\`accepted\\` is normative; \\`superseded\\` points to its successor. Acceptance does not mean implementation is complete.\n- Decision records use \\`proposed\\`, \\`accepted\\`, or \\`superseded\\`; they preserve rationale and alternatives rather than duplicating the full specification.\n- Keep stable agent operating rules in \\`AGENT.md\\`, user/developer reference in \\`docs/\\`, execution state in \\`TASKS.md\\`, and historical evidence in \\`worklogs/\\`.\n- Read only relevant accepted records at task start. Use \\`/adopt\\` to extract legacy knowledge; never rewrite historical worklogs, issues, or tasks to create current artifacts.\n\nThe protocol-facing name is **decision record**. **ADR** (Architecture Decision Record) is a common convention for the same kind of document, not a required external standard. Use these lightweight Markdown shapes as a starting point; they are conventions, not parser-enforced schemas:\n\n\\`\\`\\`markdown\n# SPEC-001 — Concise target-state title\n\n- Status: draft | accepted | superseded\n- Scope: component, capability, or boundary\n- Provenance: issue, discussion, or source links\n- Related decisions: ADR-001, ...\n- Superseded by: SPEC-002 (when applicable)\n\n## Intent\n\n## Requirements\n\n## Acceptance criteria\n\n## Out of scope\n\\`\\`\\`\n\n\\`\\`\\`markdown\n# ADR-001 — Concise decision title\n\n- Status: proposed | accepted | superseded\n- Scope: component or technical boundary\n- Provenance: issue, task, or investigation links\n- Related specs: SPEC-001, ...\n- Superseded by: ADR-002 (when applicable)\n\n## Context\n\n## Decision\n\n## Alternatives considered\n\n## Consequences\n\\`\\`\\`\n\nOnly user/project governance accepts a specification or decision as normative. Agents may draft and link records, but must not silently promote them; acceptance is separate from implementation completion.\n\n## Current Context and Archival Lifecycle\n\n- Current context must support ordinary work without archives. Keep applicable guidance, accepted requirements/decisions, unresolved work, dependencies and necessary next actions discoverable. Acceptance is independent of implementation; dated temporary directives remain active until lifted or their stated end condition is met.\n- A completed task or resolved/declined issue is an archival candidate only when its own scope is settled and still-needed outcomes/constraints/references are retained in current context. Explicitly abandoned work may be archived with its reason, without claiming it was completed. A completed child does not satisfy unmet parent acceptance criteria.\n- Record new task completion dates as \\`Completed: YYYY-MM-DD\\`; do not infer missing old dates from worklog filenames. Age, a checkbox, absent code or a newer statement alone is not proof of obsolescence.\n- Group archival at coherent completed-work boundaries, not per task or calendar interval. No Sprint object or scheduled maintenance is required. Correct certain in-scope drift proactively during normal work; use \\`/reconcile\\` for investigation, consolidation and archival.\n- Before moving history, consolidate current knowledge in its existing narrowest home. Optional \\`Current direction\\` in \\`TASKS.md\\` explains present aims, recent consequential outcomes and next work; rewrite it rather than append chronology. Keep progress out of \\`AGENT.md\\`.\n- Create project-owned \\`.autonomos/archive/README.md\\` and meaningful batch directories on first use only. A batch can contain \\`TASKS.md\\`, \\`ISSUES.md\\`, \\`worklogs/\\` and provenance for retired guidance. Group/split batches by useful scope; there is no fixed age, size or mandatory per-record schema.\n- Archive means move, not delete or rewrite conclusions. Preserve historical record content, identifiers and provenance; repair relative paths when necessary. Preserve original mixed-source text when retiring only some claims. Applicable specs/decisions stay current independently of execution records. Extraction into new normative artifacts still uses \\`/adopt\\`.\n- The archive index maps batch topics to records, not a second task journal. Search by ID or subject only when a specific question requires history; neither archives nor their entire index are routine startup context. Keep only necessary dependency/outcome pointers in current records, not a permanent stub for every completed task.\n- Archived task and issue IDs remain reserved. Before assigning an ID, search current and archived registries. With a CLI, \\`readTaskRegistry(root, { history: true })\\` exposes task references and duplicates; plain Markdown search works without it.\n- Verify exact source text before edits, retained current knowledge, IDs and resolvable references after moves. Do not confuse tool annotations with file content or historical validation with a current observation. Re-read shared files before writing and preserve unrelated concurrent changes. Stop when a second pass yields no deterministic correction.\n- \\`autonomos status\\` summarizes the current task registry; \\`--history\\` adds separate archived counts and read/collision diagnostics. Archived means historical, not necessarily completed. History uses batch \\`TASKS.md\\` files, not arbitrary worklog checklists.\n- Archives are project-owned, like specs and decisions. Initialization, updates and integrity checks neither create empty archives nor overwrite, relocate or judge their contents. Installing a new protocol performs no automatic cleanup. Version-control policy stays project-owned; Git is not required for archival or retrieval.\n\nExample (only files needed by a batch are created):\n\n\\`\\`\\`text\n.autonomos/\n TASKS.md\n ISSUES.md\n archive/\n README.md\n realtime-experiment-retirement/\n TASKS.md\n ISSUES.md\n worklogs/\n\\`\\`\\`\n\n## Task Format\n\n\\`- [Status] **[ID]** Title \\\\\\`Priority\\\\\\` \\\\\\`Complexity\\\\\\`\\`\n\n| Status | Priority | Complexity |\n| ----------------- | ------------- | ---------- |\n| \\`[ ]\\` Todo | \\`🔴 Critical\\` | \\`S\\` Small |\n| \\`[/]\\` In Progress | \\`🟠 High\\` | \\`M\\` Medium |\n| \\`[x]\\` Done | \\`🔵 Medium\\` | \\`L\\` Large |\n| \\`[!]\\` Blocked | \\`⚪ Low\\` | \\`XL\\` Huge |\n\n## Metadata Rules\n\n- **Language:** English unless AGENT.md says otherwise.\n- **Tone:** Technical, concise, fact-based.\n- **Continuity:** Refer to previous work as \"we\" or \"the project\".\n`\n\n/**\n * @deprecated Use PROTOCOL_TEMPLATE instead\n */\nexport const PROTOCOL_TEMPLATE_V2026_1 = PROTOCOL_TEMPLATE\n","/**\n * Template for TASKS.md - The task registry\n */\nexport const TASKS_TEMPLATE = `# PROJECT TASKS & ROADMAP\n\n> **LEGEND**\n> **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]\n> **Complexity:** [S] Small, [M] Medium, [L] Large, [XL] Huge (Planning required)\n> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked\n\n## 🚀 Current work\n\n- [ ] **[INIT-01]** Review project context and structure \\`Priority: 🔵\\` \\`Complexity: S\\`\n\n## 🔮 Backlog\n\n*(Add future tasks here)*\n`\n","import type { TaskStatus } from '../types'\n\ninterface WorklogOptions {\n taskId: string\n taskName: string\n date?: string\n status: 'Complete' | 'Partial' | 'Blocked'\n description: string\n filesModified: string[]\n decisions: string[]\n challenges: string[]\n nextSteps: string[]\n}\n\n/**\n * Generate a Worklog markdown content\n */\nexport function generateWorklogContent(options: WorklogOptions): string {\n const date = options.date ?? new Date().toISOString().split('T')[0]\n\n return `# WORKLOG: [${options.taskId}] ${options.taskName}\n**Date:** ${date}\n**Agent Status:** [${options.status}]\n\n## 📝 Description\n${options.description}\n\n## 🛠 Technical Details\n- **Files Modified:**\n${options.filesModified.map(f => ` - ${f}`).join('\\n')}\n- **Key Decisions:**\n${options.decisions.map(d => ` - ${d}`).join('\\n')}\n- **Challenges:**\n${options.challenges.map(c => ` - ${c}`).join('\\n')}\n\n## ⏭ Next Steps / Context for Successor\n${options.nextSteps.map(s => `- ${s}`).join('\\n')}\n`\n}\n\n/**\n * Common status mapping for worklogs\n */\nexport function mapTaskStatusToWorklogStatus(\n status: TaskStatus\n): 'Complete' | 'Partial' | 'Blocked' {\n switch (status) {\n case 'DONE':\n return 'Complete'\n case 'BLOCKED':\n return 'Blocked'\n default:\n return 'Partial'\n }\n}\n","import { existsSync, statSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\n\nimport { AGENT_FILE } from '../constants'\n\n/**\n * Result of an ancestor lookup: a single AGENT.md entry that exists on the\n * path between a target file or directory and the project root.\n */\nexport interface AncestorAgent {\n /** Absolute path to the directory containing the AGENT.md */\n dir: string\n /** Absolute path to the AGENT.md file */\n path: string\n /** Path of the directory relative to the project root */\n relativeDir: string\n}\n\n/**\n * Return the ordered list of AGENT.md files that exist on the path from a\n * target file or directory up to the project root. The order is root-first,\n * then each intermediate directory, then the target directory itself.\n *\n * Non-existent AGENT.md files are silently skipped (the chain can have gaps).\n *\n * @param target - The absolute or project-relative path to a file or directory.\n * @param projectRoot - The absolute path of the project root (where the root\n * AGENT.md lives). Defaults to the current working directory.\n *\n * @example\n * findAncestorAgents('/proj/apps/web/components/ui/button.tsx', '/proj')\n * // Returns, in order:\n * // - { dir: '/proj', path: '/proj/AGENT.md' }\n * // - { dir: '/proj/apps/web', path: '/proj/apps/web/AGENT.md' }\n * // (apps/, components/ skipped because they have no AGENT.md)\n * // (button.tsx itself is a file, so its parent dir is the last one checked)\n */\nexport function findAncestorAgents(\n target: string,\n projectRoot: string = process.cwd()\n): AncestorAgent[] {\n const absRoot = resolve(projectRoot)\n const absTarget = resolveAgainstRoot(target, absRoot)\n\n // Validate that the target lives within the project root\n const relToRoot = relative(absRoot, absTarget)\n if (relToRoot.startsWith('..') || isAbsolute(relToRoot)) {\n throw new Error(\n `Target \"${target}\" is outside the project root \"${absRoot}\". ` +\n `findAncestorAgents only handles paths within the project.`\n )\n }\n\n // Collect every directory from the target up to the root, in root-first order.\n // For a file target, we only look at the directory chain (not the file itself).\n // For a directory target, the directory itself is included as the last entry.\n const targetDir = isDirectory(absTarget) ? absTarget : dirname(absTarget)\n const dirs = collectAncestorDirs(targetDir, absRoot)\n\n const result: AncestorAgent[] = []\n for (const dir of dirs) {\n const agentPath = join(dir, AGENT_FILE)\n if (existsSync(agentPath)) {\n result.push({\n dir,\n path: agentPath,\n relativeDir: relativeDir(dir, absRoot),\n })\n }\n }\n\n return result\n}\n\n/**\n * Resolve a target path against the project root. Accepts absolute paths\n * (returned as-is) and project-relative paths (joined with the root).\n */\nfunction resolveAgainstRoot(target: string, absRoot: string): string {\n if (isAbsolute(target)) return target\n return join(absRoot, target)\n}\n\n/**\n * Return the directory chain from a starting directory up to (and including)\n * the project root, in root-first order. The chain is computed by walking\n * the relative path segments from the starting dir back to the root.\n */\nfunction collectAncestorDirs(startDir: string, absRoot: string): string[] {\n const rel = relative(absRoot, startDir)\n if (rel === '' || rel === '.') {\n return [absRoot]\n }\n\n const segments = rel.split(sep).filter(s => s !== '' && s !== '.')\n const chain: string[] = [absRoot]\n let acc = absRoot\n for (const seg of segments) {\n acc = join(acc, seg)\n chain.push(acc)\n }\n return chain\n}\n\n/**\n * Compute the directory's path relative to the project root, in a form\n * suitable for display. The root itself is rendered as \".\".\n */\nfunction relativeDir(dir: string, absRoot: string): string {\n const rel = relative(absRoot, dir)\n return rel === '' ? '.' : rel\n}\n\nfunction isDirectory(p: string): boolean {\n try {\n return statSync(p).isDirectory()\n } catch {\n return false\n }\n}\n","import yaml from 'js-yaml'\nimport type { AgentContext, AgentSection } from '../types'\n\nexport class AgentParser {\n /**\n * Parse an AGENT.md content into a structured AgentContext\n */\n static parse(markdown: string): AgentContext {\n let content = markdown\n let metadata: Record<string, any> = {}\n\n // Parse Frontmatter\n const frontmatterRegex = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---/\n const match = markdown.match(frontmatterRegex)\n if (match) {\n try {\n metadata = yaml.load(match[1] as string) as Record<string, any>\n content = markdown.slice(match[0].length).trim()\n } catch (e) {\n console.error('Failed to parse Agent frontmatter:', e)\n }\n }\n\n const lines = content.split(/\\r?\\n/)\n const sections: AgentSection[] = []\n let title = metadata.name ?? 'Unknown Agent'\n let currentSection: AgentSection | null = null\n let currentContent: string[] = []\n\n for (const line of lines) {\n // Parse Title (Only if not already set by frontmatter)\n if (line.startsWith('# ') && !metadata.name) {\n const rawTitle = line.replace('# ', '').trim()\n // Handle \"AGENT CONTEXT: [Name]\" format\n if (rawTitle.toUpperCase().startsWith('AGENT CONTEXT:')) {\n title = rawTitle\n .slice(14)\n .replace(/^[:\\s-]+/, '')\n .trim()\n } else {\n title = rawTitle\n }\n continue\n }\n\n // Parse Sections\n if (line.startsWith('## ')) {\n // Save previous section\n if (currentSection) {\n currentSection.content = currentContent.join('\\n').trim()\n sections.push(currentSection)\n }\n\n currentSection = {\n title: line.replace('## ', '').trim(),\n content: '',\n }\n currentContent = []\n continue\n }\n\n // Collect content\n if (currentSection) {\n currentContent.push(line)\n }\n }\n\n // Save last section\n if (currentSection) {\n currentSection.content = currentContent.join('\\n').trim()\n sections.push(currentSection)\n }\n\n return {\n title,\n sections,\n metadata,\n }\n }\n}\n","import { existsSync } from 'node:fs'\nimport { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\n\nimport { AUTONOMOS_DIR } from '../constants'\n\n/**\n * Markers that identify the root of an Autonomos / git project.\n *\n * `.autonomos/` is a strong signal: if it exists, the project has already\n * been initialized with the protocol and the directory containing it is,\n * by definition, the project root.\n *\n * `.git/` is a weaker signal: it only tells us the directory is inside a\n * git working tree. We still stop at the first `.git/` we see, which is\n * good enough for the common monorepo case (the monorepo root contains\n * the `.git/`, package subdirectories do not).\n */\nconst PROJECT_MARKERS = [AUTONOMOS_DIR, '.git'] as const\n\n/**\n * Find the directory that owns this project by walking up from `startDir`\n * until we find a directory containing `.autonomos/` or `.git/`.\n *\n * Returns `null` if no such directory exists before we reach the\n * filesystem root.\n *\n * Notes on behavior:\n * - The search stops at the first directory that contains any of the\n * markers. For monorepos this is the monorepo root, not the package\n * directory the caller is sitting in.\n * - A directory containing `.git/` is preferred over walking further up:\n * this prevents leaking into a parent repository in nested-worktree\n * setups. Callers that need the absolute git toplevel can run\n * `git rev-parse --show-toplevel` themselves after this returns.\n *\n * @param startDir - Absolute path to start the search from.\n */\nexport function findProjectRoot(startDir: string): string | null {\n if (!startDir) return null\n const start = resolve(startDir)\n let current = start\n\n while (true) {\n if (PROJECT_MARKERS.some(marker => existsSync(join(current, marker)))) {\n return current\n }\n const parent = dirname(current)\n if (parent === current) return null\n current = parent\n }\n}\n\n/**\n * Check whether two absolute paths refer to the same directory.\n *\n * Resolves `.` / `..` segments before comparing, so `/a/b` and\n * `/a/b/./` are considered the same.\n */\nexport function isSamePath(a: string, b: string): boolean {\n if (!a || !b) return false\n return resolve(a) === resolve(b)\n}\n\n/**\n * Render a path relative to another path, with one guarantee that the\n * default `path.relative` doesn't give us: we never return a value that\n * starts with `..`. If `target` is not under `base`, we return the\n * absolute resolved path of `target` so the caller can still show a\n * useful location.\n */\nexport function displayRelative(target: string, base: string): string {\n const rel = relative(base, target)\n if (rel === '' || rel === '.') return '.'\n if (rel.startsWith(`..${sep}`) || rel === '..' || isAbsolute(rel)) {\n return resolve(target)\n }\n return rel\n}\n","import type { Complexity, Priority, Task, TaskStatus } from '../types'\n\nexport class TaskParser {\n /** Discover IDs/status without requiring optional priority or complexity metadata. */\n static references(markdown: string): { id: string; status: TaskStatus; line: number }[] {\n const references: { id: string; status: TaskStatus; line: number }[] = []\n let fence: string | undefined\n for (const [index, line] of markdown.split(/\\r?\\n/).entries()) {\n const marker = line.match(/^\\s{0,3}(`{3,}|~{3,})/)\n if (marker?.[1]) {\n if (!fence) fence = marker[1]\n else if (\n marker[1][0] === fence[0] &&\n marker[1].length >= fence.length &&\n !line.slice(marker[0].length).trim()\n )\n fence = undefined\n continue\n }\n if (fence) continue\n const match = line.match(/^\\s*- \\[([ x/!])\\] \\*\\*\\[([^\\]]+)\\]\\*\\*/)\n if (match?.[1] && match[2]?.trim()) {\n references.push({\n id: match[2].trim(),\n status: this.mapStatus(match[1]),\n line: index + 1,\n })\n }\n }\n return references\n }\n\n static parse(markdown: string): Task[] {\n const tasks: Task[] = []\n const lines = markdown.split(/\\r?\\n/)\n const taskRegex = /- \\[([ x/!])\\] \\*\\*\\[(.+)\\]\\*\\* (.+) `Priority: (.+)` `Complexity: (.+)`/\n\n for (const line of lines) {\n const match = line.match(taskRegex)\n if (match) {\n const [, statusChar = ' ', id = '', title = '', priority = '', complexity = ''] =\n match\n tasks.push({\n id,\n title: title.trim(),\n priority: priority as Priority,\n complexity: complexity as Complexity,\n status: this.mapStatus(statusChar),\n })\n }\n }\n return tasks\n }\n\n private static mapStatus(char: string): TaskStatus {\n switch (char) {\n case ' ':\n return 'TODO'\n case '/':\n return 'IN_PROGRESS'\n case 'x':\n return 'DONE'\n case '!':\n return 'BLOCKED'\n default:\n return 'TODO'\n }\n }\n}\n","import { lstatSync, readFileSync, readdirSync } from 'node:fs'\nimport { join, relative } from 'node:path'\n\nimport { ARCHIVE_DIR, AUTONOMOS_DIR, TASKS_FILE } from '../constants'\nimport { TaskParser } from './task-parser'\n\nexport interface TaskReference {\n id: string\n status: ReturnType<typeof TaskParser.references>[number]['status']\n line: number\n /** Source path relative to the supplied project root. */\n path: string\n}\n\nexport interface TaskRegistry {\n current: TaskReference[]\n archived: TaskReference[]\n duplicateIds: string[]\n warnings: string[]\n /** False if a requested registry could not be inspected completely. */\n complete: boolean\n}\n\n/** Read current task IDs; opt into history for reporting or reserving a new ID. */\nexport function readTaskRegistry(root: string, options: { history?: boolean } = {}): TaskRegistry {\n const registry: TaskRegistry = {\n current: [],\n archived: [],\n duplicateIds: [],\n warnings: [],\n complete: true,\n }\n function warn(path: string, message: string): void {\n registry.complete = false\n registry.warnings.push(`${relative(root, path)}: ${message}`)\n }\n function read(path: string, target: TaskReference[]): void {\n try {\n const stat = lstatSync(path)\n if (!stat.isFile()) {\n warn(path, 'Expected a regular task registry; symbolic links are not followed')\n return\n }\n target.push(\n ...TaskParser.references(readFileSync(path, 'utf8')).map(task => ({\n ...task,\n path: relative(root, path),\n }))\n )\n } catch (error) {\n warn(path, error instanceof Error ? error.message : String(error))\n }\n }\n function scan(path: string, optional = false): void {\n try {\n const stat = lstatSync(path)\n if (!stat.isDirectory()) {\n warn(path, 'Expected an archive directory; symbolic links are not followed')\n return\n }\n for (const entry of readdirSync(path, { withFileTypes: true }).sort((a, b) =>\n a.name.localeCompare(b.name)\n )) {\n const child = join(path, entry.name)\n if (entry.isSymbolicLink()) warn(child, 'Skipped symbolic link in archive')\n else if (entry.isDirectory()) scan(child)\n else if (entry.name === TASKS_FILE) read(child, registry.archived)\n }\n } catch (error) {\n if (optional && (error as NodeJS.ErrnoException).code === 'ENOENT') return\n warn(path, error instanceof Error ? error.message : String(error))\n }\n }\n const autonomosPath = join(root, AUTONOMOS_DIR)\n try {\n if (!lstatSync(autonomosPath).isDirectory()) {\n warn(\n autonomosPath,\n 'Expected a regular project directory; symbolic links are not followed'\n )\n return registry\n }\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n warn(autonomosPath, error instanceof Error ? error.message : String(error))\n }\n return registry\n }\n const currentPath = join(autonomosPath, TASKS_FILE)\n try {\n lstatSync(currentPath)\n read(currentPath, registry.current)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n warn(currentPath, error instanceof Error ? error.message : String(error))\n }\n }\n if (options.history) scan(join(root, AUTONOMOS_DIR, ARCHIVE_DIR), true)\n const seen = new Set<string>()\n const duplicates = new Set<string>()\n for (const task of [...registry.current, ...registry.archived]) {\n if (seen.has(task.id)) duplicates.add(task.id)\n seen.add(task.id)\n }\n registry.duplicateIds = [...duplicates].sort()\n return registry\n}\n","","import harnessCodesData from './data/harness-codes.json' with { type: 'json' }\nimport {\n HarnessCodesSchema,\n type Harness,\n type HarnessCodes,\n type Installer,\n} from './schemas/harness-codes'\n\n/**\n * Validated, in-memory representation of the harness codes config.\n * Loaded once at module init, validated via Zod.\n */\nconst codes: HarnessCodes = HarnessCodesSchema.parse(harnessCodesData)\n\n/**\n * Get a single harness entry by its id.\n * Throws if the id is unknown.\n */\nexport function getHarness(id: string): Harness {\n const entry = codes.platforms[id]\n if (!entry) {\n const known = Object.keys(codes.platforms).join(', ')\n throw new Error(`Unknown harness: \"${id}\". Known harnesses: ${known}`)\n }\n return entry\n}\n\n/**\n * List all configured harnesses, as an array of {id, harness} pairs.\n * Stable order: insertion order of the JSON object.\n */\nexport function listHarnesses(): Array<{ id: string; harness: Harness }> {\n return Object.entries(codes.platforms).map(([id, harness]) => ({ id, harness }))\n}\n\n/**\n * Get the list of preferred harnesses (shown as recommended options).\n */\nexport function listPreferredHarnesses(): Array<{ id: string; harness: Harness }> {\n return listHarnesses().filter(({ harness }) => harness.preferred)\n}\n\nexport type TargetKind = 'flat' | 'skill'\n\n/**\n * A resolved target directory where workflow files will be written.\n * One per unique path, with the list of harness ids that share it.\n */\nexport interface ResolvedTarget {\n /** Absolute or project-relative path to the directory */\n path: string\n /** File extension to use (e.g. \".md\", \".agent.md\") */\n fileExtension: string\n /** Whether target receives flat files (e.g. session.md) or skill bundles (e.g. protocol-session/SKILL.md) */\n kind: TargetKind\n /** Ids of the harnesses that will read from this directory */\n usedBy: string[]\n}\n\n/**\n * Resolve the unique target directories for a set of harness ids.\n *\n * Harnesses that share the same `skillsDir` (e.g. Codex, OpenCode, KiloCode,\n * Antigravity, Claude Code all use `.agents/skills/`) are deduplicated:\n * the directory appears once in the output, with all the harness ids listed in `usedBy`.\n *\n * The `path` is returned relative to the project root (caller is responsible\n * for joining with the project cwd).\n */\nexport function resolveTargets(harnessIds: string[], cwd: string = '.'): ResolvedTarget[] {\n const map = new Map<string, ResolvedTarget>()\n\n for (const id of harnessIds) {\n const { installer } = getHarness(id)\n collectFromInstaller(map, installer, id, cwd)\n }\n\n return Array.from(map.values())\n}\n\nfunction collectFromInstaller(\n map: Map<string, ResolvedTarget>,\n installer: Installer,\n harnessId: string,\n cwd: string\n): void {\n const ext = installer.fileExtension\n if (installer.workflowsDir) {\n addTarget(map, joinPath(cwd, installer.workflowsDir), ext, 'flat', harnessId)\n }\n if (installer.commandsDir) {\n addTarget(map, joinPath(cwd, installer.commandsDir), ext, 'flat', harnessId)\n }\n if (installer.promptsDir) {\n addTarget(map, joinPath(cwd, installer.promptsDir), ext, 'flat', harnessId)\n }\n if (installer.targetDir) {\n addTarget(map, joinPath(cwd, installer.targetDir), ext, 'flat', harnessId)\n }\n if (installer.skillsDir) {\n addTarget(map, joinPath(cwd, installer.skillsDir), ext, 'skill', harnessId)\n }\n}\n\nfunction addTarget(\n map: Map<string, ResolvedTarget>,\n path: string,\n fileExtension: string,\n kind: TargetKind,\n harnessId: string\n): void {\n const existing = map.get(path)\n if (existing) {\n if (!existing.usedBy.includes(harnessId)) {\n existing.usedBy.push(harnessId)\n }\n } else {\n map.set(path, { path, fileExtension, kind, usedBy: [harnessId] })\n }\n}\n\nfunction joinPath(a: string, b: string): string {\n if (a === '.' || a === '') return b\n if (b.startsWith('/')) return `${a}${b}`\n return `${a}/${b}`\n}\n\n/**\n * Get the raw (validated) codes object, for advanced use cases.\n * Most callers should use the higher-level helpers above.\n */\nexport function getRawHarnessCodes(): HarnessCodes {\n return codes\n}\n"],"mappings":"sPAIA,MAAa,EAAmB,cAKnB,EAAgB,aAKhB,EAAgB,gBAKhB,EAAgB,cAKhB,EAAa,WAKb,EAAa,WAKb,GAAe,WAKf,GAAY,QAKZ,EAAgB,YAGhB,EAAc,UCjCd,EAAkB,EAC1B,OAAO,CACJ,aAAc,EAAE,OAAO,CAAC,CAAC,SAAS,EAClC,UAAW,EAAE,OAAO,CAAC,CAAC,SAAS,EAC/B,UAAW,EAAE,OAAO,CAAC,CAAC,SAAS,EAC/B,YAAa,EAAE,OAAO,CAAC,CAAC,SAAS,EACjC,WAAY,EAAE,OAAO,CAAC,CAAC,SAAS,EAChC,gBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS,EACrC,cAAe,EAAE,OAAO,EACxB,MAAO,EAAE,OAAO,CAAC,C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B,EAAE,WAAW,GAAG,EAAU,GAAG,IAAI,IAC9B,GAAG,EAAE,GAAG,GACnB,CAMA,SAAgB,IAAmC,CAC/C,OAAO,CACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autonomos/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "SDK and core definitions for the Agent Protocol",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.mts",