@autonomos/core 0.0.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.
@@ -0,0 +1,15 @@
1
+
2
+ > @autonomos/core@0.0.1 build /home/runner/work/autonomos/autonomos/packages/core
3
+ > tsdown
4
+
5
+ ℹ tsdown v0.18.4 powered by rolldown v1.0.0-beta.57
6
+ ℹ config file: /home/runner/work/autonomos/autonomos/packages/core/tsdown.config.ts
7
+ ℹ entry: src/index.ts
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ dist/index.mjs  9.78 kB │ gzip: 4.19 kB
11
+ ℹ dist/index.d.mts 17.09 kB │ gzip: 4.28 kB
12
+ ℹ 2 files, total: 26.88 kB
13
+ ✔ Build complete in 1302ms
14
+ ✔ [publint] No issues found (329ms)
15
+ 🙏 Build succeeded!
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hakim Saoudi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ The Software may include icons that are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). Commercial use is allowed, but attribution is required for the use of these icons. See LICENSE-THIRD-PARTY for more details.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @autonomos/core
2
+
3
+ The core logic and specification for the Autonomos Agent Protocol.
4
+
5
+ ## Overview
6
+
7
+ This package contains the shared constants, types, templates, and parsers that define the Autonomos Agent Protocol. It is designed to be used by the CLI and other tools that need to interact with the protocol.
8
+
9
+ ## Features
10
+
11
+ - **Constants**: Shared directory and file names (`.autonomos`, `manifest.json`, etc.)
12
+ - **Templates**: Immutable templates for `PROTOCOL.md`, `TASKS.md`, `AGENT.md`, and `manifest.json`.
13
+ - **Types**: TypeScript definitions for protocol entities (Tasks, Agents, Manifest).
14
+ - **Parsers**: Tools for extracting structured data from markdown (e.g., `TaskParser`).
15
+
16
+ ## Usage
17
+
18
+ ```typescript
19
+ import { PROTOCOL_VERSION, TaskParser } from '@autonomos/core'
20
+
21
+ console.log(`Current Protocol Version: ${PROTOCOL_VERSION}`)
22
+
23
+ const tasks = TaskParser.parse(markdownContent)
24
+ ```
25
+
26
+ ## Structure
27
+
28
+ - `src/constants.ts`: Global constants and versioning.
29
+ - `src/types.ts`: Core type definitions.
30
+ - `src/templates/`: Protocol file templates.
31
+ - `src/parsers/`: Logic for parsing protocol files.
32
+
33
+ ## License
34
+
35
+ MIT
@@ -0,0 +1,180 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/constants.d.ts
4
+
5
+ /**
6
+ * Protocol version using SemVer
7
+ * Alpha phase - not yet published to npm
8
+ */
9
+ declare const PROTOCOL_VERSION = "0.1.0-alpha";
10
+ /**
11
+ * Directory name for Autonomos configuration
12
+ */
13
+ declare const AUTONOMOS_DIR = ".autonomos";
14
+ /**
15
+ * Manifest filename
16
+ */
17
+ declare const MANIFEST_FILE = "manifest.json";
18
+ /**
19
+ * Protocol filename
20
+ */
21
+ declare const PROTOCOL_FILE = "PROTOCOL.md";
22
+ /**
23
+ * Tasks filename
24
+ */
25
+ declare const TASKS_FILE = "TASKS.md";
26
+ /**
27
+ * Agent context filename (at project root)
28
+ */
29
+ declare const AGENT_FILE = "AGENT.md";
30
+ /**
31
+ * Worklogs directory name
32
+ */
33
+ declare const WORKLOGS_DIR = "worklogs";
34
+ //#endregion
35
+ //#region src/schemas/manifest.d.ts
36
+ /**
37
+ * Manifest Schema for .autonomos/manifest.json
38
+ */
39
+ declare const ManifestSchema: z.ZodObject<{
40
+ protocolVersion: z.ZodString;
41
+ cliVersion: z.ZodString;
42
+ initializedAt: z.ZodString;
43
+ lastUpdated: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ protocolVersion: string;
46
+ cliVersion: string;
47
+ initializedAt: string;
48
+ lastUpdated: string;
49
+ }, {
50
+ protocolVersion: string;
51
+ cliVersion: string;
52
+ initializedAt: string;
53
+ lastUpdated: string;
54
+ }>;
55
+ type Manifest = z.infer<typeof ManifestSchema>;
56
+ //#endregion
57
+ //#region src/types.d.ts
58
+ /**
59
+ * Priority levels for tasks
60
+ */
61
+ type Priority = '🔴 Critical' | '🟠 High' | '🔵 Medium' | '⚪ Low';
62
+ /**
63
+ * Complexity estimates for tasks
64
+ */
65
+ type Complexity = 'S' | 'M' | 'L' | 'XL';
66
+ /**
67
+ * Task status markers
68
+ */
69
+ type TaskStatus = 'TODO' | 'IN_PROGRESS' | 'DONE' | 'BLOCKED';
70
+ /**
71
+ * Task entity parsed from TASKS.md
72
+ */
73
+ interface Task {
74
+ id: string;
75
+ title: string;
76
+ priority: Priority;
77
+ complexity: Complexity;
78
+ status: TaskStatus;
79
+ worklogPath?: string;
80
+ }
81
+ /**
82
+ * Agent configuration parsed from AGENT.md
83
+ */
84
+ interface AgentConfig {
85
+ name: string;
86
+ description?: string;
87
+ stack: string[];
88
+ preferences?: Record<string, any>;
89
+ }
90
+ interface AgentSection {
91
+ title: string;
92
+ content: string;
93
+ }
94
+ interface AgentContext {
95
+ title: string;
96
+ description?: string;
97
+ sections: AgentSection[];
98
+ metadata?: Record<string, any>;
99
+ }
100
+ declare const PRIORITIES: Priority[];
101
+ declare const COMPLEXITIES: Complexity[];
102
+ //#endregion
103
+ //#region src/templates/agent.d.ts
104
+ /**
105
+ * Template for AGENT.md - The context anchor at project root
106
+ * @param projectName - Name of the project to personalize the template
107
+ */
108
+ declare function generateAgentTemplate(projectName?: string): string;
109
+ /**
110
+ * Default AGENT.md template
111
+ */
112
+ declare const AGENT_TEMPLATE: string;
113
+ //#endregion
114
+ //#region src/templates/manifest.d.ts
115
+ /**
116
+ * Creates a new manifest object with current timestamps
117
+ */
118
+ declare function createManifest(cliVersion: string): Manifest;
119
+ /**
120
+ * Generates the manifest.json content as a formatted string
121
+ */
122
+ declare function generateManifestContent(manifest: Manifest): string;
123
+ /**
124
+ * Parses manifest.json content into a Manifest object with validation
125
+ */
126
+ declare function parseManifest(content: string): Manifest;
127
+ //#endregion
128
+ //#region src/templates/protocol.d.ts
129
+ /**
130
+ * The immutable Protocol kernel template
131
+ * This is the core specification that defines how AI agents interact with the project
132
+ */
133
+ declare const PROTOCOL_TEMPLATE = "# AI AGENT PROTOCOL (v0.1.0-alpha)\n\n> **SYSTEM INTEGRITY WARNING:** This file is the IMMUTABLE KERNEL of the project's AI workflow. Do not modify this file. Your instructions are to execute tasks and manage the project state based strictly on the definitions below.\n\n## 0. \u26A1 QUICK REFERENCE\n| Action | File / Command |\n|--------|----------------|\n| **Get Context** | Read `AGENT.md` (Root + Local) |\n| **Pick Task** | Check `.autonomos/TASKS.md` (Highest Priority) |\n| **Track Progress** | Update `.autonomos/TASKS.md` to `[/]` |\n| **Log Session** | Create `.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md` |\n| **Finalize Task** | Update `.autonomos/TASKS.md` to `[x]` + Link Worklog |\n\n---\n\n## 1. BOOTSTRAPPING & INITIALIZATION\n**IF** this is your first time seeing this project, or if key system files are missing, you **MUST** initialize them immediately before doing any work.\n\n### Check for existence:\n1. `.autonomos/TASKS.md` (task registry)\n2. `.autonomos/worklogs/` (directory)\n3. `AGENT.md` (at project root)\n\n**IF MISSING**, create them using the **TEMPLATES** defined in Section 2.\n\n---\n\n## 2. STRICT FILE STRUCTURES & TEMPLATES\nYou must adhere to these schemas. Do not invent new formats.\n\n### A. The Task Registry (`.autonomos/TASKS.md`)\n**Role:** The single source of truth for project state.\n**Location:** `.autonomos/TASKS.md`\n**Structure:**\n* Must use the specific Header and Legend.\n* Tasks must follow the format: `- [Status] **[ID]** Title of task `Priority` `Complexity``\n* Valid Priorities: `\uD83D\uDD34 Critical`, `\uD83D\uDFE0 High`, `\uD83D\uDD35 Medium`, `\u26AA Low`\n* Valid Complexities: `S`, `M`, `L`, `XL`\n* Valid Statuses: ` [ ] ` (Todo), `[/]` (In Progress), ` [x] ` (Done), ` [!] ` (Blocked)\n\n**TEMPLATE FOR NEW TASKS.md:**\n```markdown\n# PROJECT TASKS & ROADMAP\n\n> **LEGEND**\n> **Priority:** [\uD83D\uDD34 Critical] [\uD83D\uDFE0 High] [\uD83D\uDD35 Medium] [\u26AA Low]\n> **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)\n> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked\n\n## \uD83D\uDE80 Active Sprint\n- [ ] **[INIT-01]** Verify project structure and context `Priority: \uD83D\uDD34` `Complexity: S`\n\n## \uD83D\uDD2E Backlog\n*(Empty initially)*\n\n```\n\n### B. The Worklog (`.autonomos/worklogs/`)\n**Role:** Detailed history of complex tasks to save context tokens for future sessions.\n**Location:** `.autonomos/worklogs/YYYY-MM-DD-[TASK_ID]-[slug].md`\n**Trigger:** Create a log when a task is finished, blocked, or if the session ends mid-task.\n\n**TEMPLATE FOR WORKLOG:**\n```markdown\n# WORKLOG: [TASK ID] [Task Name]\n**Date:** YYYY-MM-DD\n**Agent Status:** [Complete / Partial / Blocked]\n\n## \uD83D\uDCDD Description\nBrief summary of what was attempted/achieved.\n\n## \uD83D\uDEE0 Technical Details\n- **Files Modified:** List of files.\n- **Key Decisions:** Why did you choose this library/pattern?\n- **Challenges:** Any errors encountered and how they were solved.\n\n## \u23ED Next Steps / Context for Successor\nClear instructions for the next agent picking this up.\n```\n\n### C. The Context Anchor (`AGENT.md`)\n**Role:** Fractal knowledge base. Contains facts, stack details, and user preferences.\n**Location:** Root (`/AGENT.md`) and any subdirectory requiring specific context (e.g., `/packages/core/AGENT.md`).\n\n**TEMPLATE FOR AGENT.md:**\n```markdown\n---\nname: \"[Name of directory or project]\"\ntype: \"[project / package / module / script]\"\nstatus: \"[active / maintenance / poc]\"\n---\n# AGENT CONTEXT: [Directory Name or Root]\n\n## \uD83E\uDDE0 Context & Objectives\nWhat does this specific folder/module do?\n\n## \u2699\uFE0F Workflow & Preferences\n- **Commits:** [e.g. Conventional Commits]\n- **Language:** [English (default)]\n\n## \uD83C\uDFD7 Stack & Architecture\n- **Tech:** [Frameworks, Libs specific to this module]\n- **Patterns:** [Architecture patterns used]\n\n## \uD83D\uDCC1 Key Directories\n| Path | Description |\n|------|-------------|\n| `src/` | Source code |\n| `scripts/` | Build or utility scripts |\n\n## \u26A0\uFE0F Known Constraints\n*List any technical debts, missing features, or external limitations.*\n```\n\n## 3. CORE WORKFLOW (The Loop)\n\n### Phase 1: Context Loading (Read-Only)\n1. **Read Root AGENT.md:** Absorb global preferences (Commit style, package manager, strict rules).\n2. **Read .autonomos/TASKS.md:** Identify the highest priority task (\uD83D\uDD34 or \uD83D\uDFE0) that is not [x] or [!].\n3. **Read Target AGENT.md:** If the task is in a subdirectory, check for a local `AGENT.md`.\n * *Note:* If the local `AGENT.md` contradicts the root, the local one wins for that specific scope.\n\n### Phase 2: Execution\n1. **Mark the task as [/] (In Progress)** in `.autonomos/TASKS.md`.\n2. **Perform the task.**\n3. **Constraint Check:** Constantly refer to \"Workflow & Preferences\" in `AGENT.md`.\n\n### Phase 3: Crystallization (Write-Only)\nBefore ending the session, you **MUST**:\n\n1. **Update AGENT.md:**\n * Did you learn a new command? Add it to \u2699\uFE0F Workflow.\n * Did you create a new complex module (>5 files)? Create a new `AGENT.md` inside it using the template above.\n\n2. **Create Worklog:**\n * Write a file in `.autonomos/worklogs/` summarizing your work.\n\n3. **Update TASKS.md:**\n * Mark task as [x] (Done) or [!] (Blocked).\n * Add a link to your worklog: `- [x] **[ID]** Title... *See: .autonomos/worklogs/...*`\n\n## 4. METADATA RULES\n* **Language:** Documentation (`AGENT.md`, `TASKS.md`) must be written in **English** unless specified otherwise in User Preferences.\n* **Tone:** Technical, concise, \"Fact-based\". No fluff.\n* **Anonymity:** You are a continuous entity. Refer to previous work as \"we\" or \"the project\", not \"the previous AI\".\n";
134
+ /**
135
+ * @deprecated Use PROTOCOL_TEMPLATE instead
136
+ */
137
+ declare const PROTOCOL_TEMPLATE_V2026_1 = "# AI AGENT PROTOCOL (v0.1.0-alpha)\n\n> **SYSTEM INTEGRITY WARNING:** This file is the IMMUTABLE KERNEL of the project's AI workflow. Do not modify this file. Your instructions are to execute tasks and manage the project state based strictly on the definitions below.\n\n## 0. \u26A1 QUICK REFERENCE\n| Action | File / Command |\n|--------|----------------|\n| **Get Context** | Read `AGENT.md` (Root + Local) |\n| **Pick Task** | Check `.autonomos/TASKS.md` (Highest Priority) |\n| **Track Progress** | Update `.autonomos/TASKS.md` to `[/]` |\n| **Log Session** | Create `.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md` |\n| **Finalize Task** | Update `.autonomos/TASKS.md` to `[x]` + Link Worklog |\n\n---\n\n## 1. BOOTSTRAPPING & INITIALIZATION\n**IF** this is your first time seeing this project, or if key system files are missing, you **MUST** initialize them immediately before doing any work.\n\n### Check for existence:\n1. `.autonomos/TASKS.md` (task registry)\n2. `.autonomos/worklogs/` (directory)\n3. `AGENT.md` (at project root)\n\n**IF MISSING**, create them using the **TEMPLATES** defined in Section 2.\n\n---\n\n## 2. STRICT FILE STRUCTURES & TEMPLATES\nYou must adhere to these schemas. Do not invent new formats.\n\n### A. The Task Registry (`.autonomos/TASKS.md`)\n**Role:** The single source of truth for project state.\n**Location:** `.autonomos/TASKS.md`\n**Structure:**\n* Must use the specific Header and Legend.\n* Tasks must follow the format: `- [Status] **[ID]** Title of task `Priority` `Complexity``\n* Valid Priorities: `\uD83D\uDD34 Critical`, `\uD83D\uDFE0 High`, `\uD83D\uDD35 Medium`, `\u26AA Low`\n* Valid Complexities: `S`, `M`, `L`, `XL`\n* Valid Statuses: ` [ ] ` (Todo), `[/]` (In Progress), ` [x] ` (Done), ` [!] ` (Blocked)\n\n**TEMPLATE FOR NEW TASKS.md:**\n```markdown\n# PROJECT TASKS & ROADMAP\n\n> **LEGEND**\n> **Priority:** [\uD83D\uDD34 Critical] [\uD83D\uDFE0 High] [\uD83D\uDD35 Medium] [\u26AA Low]\n> **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)\n> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked\n\n## \uD83D\uDE80 Active Sprint\n- [ ] **[INIT-01]** Verify project structure and context `Priority: \uD83D\uDD34` `Complexity: S`\n\n## \uD83D\uDD2E Backlog\n*(Empty initially)*\n\n```\n\n### B. The Worklog (`.autonomos/worklogs/`)\n**Role:** Detailed history of complex tasks to save context tokens for future sessions.\n**Location:** `.autonomos/worklogs/YYYY-MM-DD-[TASK_ID]-[slug].md`\n**Trigger:** Create a log when a task is finished, blocked, or if the session ends mid-task.\n\n**TEMPLATE FOR WORKLOG:**\n```markdown\n# WORKLOG: [TASK ID] [Task Name]\n**Date:** YYYY-MM-DD\n**Agent Status:** [Complete / Partial / Blocked]\n\n## \uD83D\uDCDD Description\nBrief summary of what was attempted/achieved.\n\n## \uD83D\uDEE0 Technical Details\n- **Files Modified:** List of files.\n- **Key Decisions:** Why did you choose this library/pattern?\n- **Challenges:** Any errors encountered and how they were solved.\n\n## \u23ED Next Steps / Context for Successor\nClear instructions for the next agent picking this up.\n```\n\n### C. The Context Anchor (`AGENT.md`)\n**Role:** Fractal knowledge base. Contains facts, stack details, and user preferences.\n**Location:** Root (`/AGENT.md`) and any subdirectory requiring specific context (e.g., `/packages/core/AGENT.md`).\n\n**TEMPLATE FOR AGENT.md:**\n```markdown\n---\nname: \"[Name of directory or project]\"\ntype: \"[project / package / module / script]\"\nstatus: \"[active / maintenance / poc]\"\n---\n# AGENT CONTEXT: [Directory Name or Root]\n\n## \uD83E\uDDE0 Context & Objectives\nWhat does this specific folder/module do?\n\n## \u2699\uFE0F Workflow & Preferences\n- **Commits:** [e.g. Conventional Commits]\n- **Language:** [English (default)]\n\n## \uD83C\uDFD7 Stack & Architecture\n- **Tech:** [Frameworks, Libs specific to this module]\n- **Patterns:** [Architecture patterns used]\n\n## \uD83D\uDCC1 Key Directories\n| Path | Description |\n|------|-------------|\n| `src/` | Source code |\n| `scripts/` | Build or utility scripts |\n\n## \u26A0\uFE0F Known Constraints\n*List any technical debts, missing features, or external limitations.*\n```\n\n## 3. CORE WORKFLOW (The Loop)\n\n### Phase 1: Context Loading (Read-Only)\n1. **Read Root AGENT.md:** Absorb global preferences (Commit style, package manager, strict rules).\n2. **Read .autonomos/TASKS.md:** Identify the highest priority task (\uD83D\uDD34 or \uD83D\uDFE0) that is not [x] or [!].\n3. **Read Target AGENT.md:** If the task is in a subdirectory, check for a local `AGENT.md`.\n * *Note:* If the local `AGENT.md` contradicts the root, the local one wins for that specific scope.\n\n### Phase 2: Execution\n1. **Mark the task as [/] (In Progress)** in `.autonomos/TASKS.md`.\n2. **Perform the task.**\n3. **Constraint Check:** Constantly refer to \"Workflow & Preferences\" in `AGENT.md`.\n\n### Phase 3: Crystallization (Write-Only)\nBefore ending the session, you **MUST**:\n\n1. **Update AGENT.md:**\n * Did you learn a new command? Add it to \u2699\uFE0F Workflow.\n * Did you create a new complex module (>5 files)? Create a new `AGENT.md` inside it using the template above.\n\n2. **Create Worklog:**\n * Write a file in `.autonomos/worklogs/` summarizing your work.\n\n3. **Update TASKS.md:**\n * Mark task as [x] (Done) or [!] (Blocked).\n * Add a link to your worklog: `- [x] **[ID]** Title... *See: .autonomos/worklogs/...*`\n\n## 4. METADATA RULES\n* **Language:** Documentation (`AGENT.md`, `TASKS.md`) must be written in **English** unless specified otherwise in User Preferences.\n* **Tone:** Technical, concise, \"Fact-based\". No fluff.\n* **Anonymity:** You are a continuous entity. Refer to previous work as \"we\" or \"the project\", not \"the previous AI\".\n";
138
+ //#endregion
139
+ //#region src/templates/tasks.d.ts
140
+ /**
141
+ * Template for TASKS.md - The task registry
142
+ */
143
+ declare const TASKS_TEMPLATE = "# PROJECT TASKS & ROADMAP\n\n> **LEGEND**\n> **Priority:** [\uD83D\uDD34 Critical] [\uD83D\uDFE0 High] [\uD83D\uDD35 Medium] [\u26AA Low]\n> **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)\n> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked\n\n## \uD83D\uDE80 Active Sprint\n\n- [ ] **[INIT-01]** Review project context and structure `Priority: \uD83D\uDD35` `Complexity: S`\n\n## \uD83D\uDD2E Backlog\n\n*(Add future tasks here)*\n";
144
+ //#endregion
145
+ //#region src/templates/worklog.d.ts
146
+ interface WorklogOptions {
147
+ taskId: string;
148
+ taskName: string;
149
+ date?: string;
150
+ status: 'Complete' | 'Partial' | 'Blocked';
151
+ description: string;
152
+ filesModified: string[];
153
+ decisions: string[];
154
+ challenges: string[];
155
+ nextSteps: string[];
156
+ }
157
+ /**
158
+ * Generate a Worklog markdown content
159
+ */
160
+ declare function generateWorklogContent(options: WorklogOptions): string;
161
+ /**
162
+ * Common status mapping for worklogs
163
+ */
164
+ declare function mapTaskStatusToWorklogStatus(status: TaskStatus): 'Complete' | 'Partial' | 'Blocked';
165
+ //#endregion
166
+ //#region src/parsers/agent-parser.d.ts
167
+ declare class AgentParser {
168
+ /**
169
+ * Parse an AGENT.md content into a structured AgentContext
170
+ */
171
+ static parse(markdown: string): AgentContext;
172
+ }
173
+ //#endregion
174
+ //#region src/parsers/task-parser.d.ts
175
+ declare class TaskParser {
176
+ static parse(markdown: string): Task[];
177
+ private static mapStatus;
178
+ }
179
+ //#endregion
180
+ export { AGENT_FILE, AGENT_TEMPLATE, AUTONOMOS_DIR, AgentConfig, AgentContext, AgentParser, AgentSection, COMPLEXITIES, Complexity, MANIFEST_FILE, Manifest, ManifestSchema, PRIORITIES, PROTOCOL_FILE, PROTOCOL_TEMPLATE, PROTOCOL_TEMPLATE_V2026_1, PROTOCOL_VERSION, Priority, TASKS_FILE, TASKS_TEMPLATE, Task, TaskParser, TaskStatus, WORKLOGS_DIR, createManifest, generateAgentTemplate, generateManifestContent, generateWorklogContent, mapTaskStatusToWorklogStatus, parseManifest };
package/dist/index.mjs ADDED
@@ -0,0 +1,215 @@
1
+ import{z as e}from"zod";import t from"js-yaml";const n=`0.1.0-alpha`,r=`.autonomos`,i=`manifest.json`,a=`PROTOCOL.md`,o=`TASKS.md`,s=`AGENT.md`,c=`worklogs`,l=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`)}),u=[`🔴 Critical`,`🟠 High`,`🔵 Medium`,`⚪ Low`],d=[`S`,`M`,`L`,`XL`];function f(e=`Project`){return`---
2
+ name: "${e}"
3
+ type: "project"
4
+ status: "active"
5
+ ---
6
+ # AGENT CONTEXT: ${e}
7
+
8
+ ## 🧠 Context & Objectives
9
+
10
+ *Describe what this project does and its main goals.*
11
+
12
+ ## ⚙️ Workflow & Preferences
13
+
14
+ - **Commits:** Conventional Commits
15
+ - **Language:** English
16
+
17
+ ## 🏗 Stack & Architecture
18
+
19
+ - **Tech:** *(List frameworks, libraries)*
20
+ - **Patterns:** *(Architecture patterns used)*
21
+
22
+ ## 📁 Key Directories
23
+
24
+ | Path | Description |
25
+ |------|-------------|
26
+ | \`src/\` | Source code |
27
+ | \`.autonomos/\` | Agent Protocol files |
28
+
29
+ ## ⚠️ Known Constraints
30
+
31
+ *List any technical debts, missing features, or external limitations.*
32
+ `}const p=f();function m(e){let t=new Date().toISOString();return{protocolVersion:n,cliVersion:e,initializedAt:t,lastUpdated:t}}function h(e){return JSON.stringify(e,null,4)+`
33
+ `}function g(e){let t=JSON.parse(e);return l.parse(t)}const _=`# AI AGENT PROTOCOL (v${n})
34
+
35
+ > **SYSTEM INTEGRITY WARNING:** This file is the IMMUTABLE KERNEL of the project's AI workflow. Do not modify this file. Your instructions are to execute tasks and manage the project state based strictly on the definitions below.
36
+
37
+ ## 0. ⚡ QUICK REFERENCE
38
+ | Action | File / Command |
39
+ |--------|----------------|
40
+ | **Get Context** | Read \`AGENT.md\` (Root + Local) |
41
+ | **Pick Task** | Check \`.autonomos/TASKS.md\` (Highest Priority) |
42
+ | **Track Progress** | Update \`.autonomos/TASKS.md\` to \`[/]\` |
43
+ | **Log Session** | Create \`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md\` |
44
+ | **Finalize Task** | Update \`.autonomos/TASKS.md\` to \`[x]\` + Link Worklog |
45
+
46
+ ---
47
+
48
+ ## 1. BOOTSTRAPPING & INITIALIZATION
49
+ **IF** this is your first time seeing this project, or if key system files are missing, you **MUST** initialize them immediately before doing any work.
50
+
51
+ ### Check for existence:
52
+ 1. \`.autonomos/TASKS.md\` (task registry)
53
+ 2. \`.autonomos/worklogs/\` (directory)
54
+ 3. \`AGENT.md\` (at project root)
55
+
56
+ **IF MISSING**, create them using the **TEMPLATES** defined in Section 2.
57
+
58
+ ---
59
+
60
+ ## 2. STRICT FILE STRUCTURES & TEMPLATES
61
+ You must adhere to these schemas. Do not invent new formats.
62
+
63
+ ### A. The Task Registry (\`.autonomos/TASKS.md\`)
64
+ **Role:** The single source of truth for project state.
65
+ **Location:** \`.autonomos/TASKS.md\`
66
+ **Structure:**
67
+ * Must use the specific Header and Legend.
68
+ * Tasks must follow the format: \`- [Status] **[ID]** Title of task \`Priority\` \`Complexity\`\`
69
+ * Valid Priorities: \`🔴 Critical\`, \`🟠 High\`, \`🔵 Medium\`, \`⚪ Low\`
70
+ * Valid Complexities: \`S\`, \`M\`, \`L\`, \`XL\`
71
+ * Valid Statuses: \` [ ] \` (Todo), \`[/]\` (In Progress), \` [x] \` (Done), \` [!] \` (Blocked)
72
+
73
+ **TEMPLATE FOR NEW TASKS.md:**
74
+ \`\`\`markdown
75
+ # PROJECT TASKS & ROADMAP
76
+
77
+ > **LEGEND**
78
+ > **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]
79
+ > **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)
80
+ > **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked
81
+
82
+ ## 🚀 Active Sprint
83
+ - [ ] **[INIT-01]** Verify project structure and context \`Priority: 🔴\` \`Complexity: S\`
84
+
85
+ ## 🔮 Backlog
86
+ *(Empty initially)*
87
+
88
+ \`\`\`
89
+
90
+ ### B. The Worklog (\`.autonomos/worklogs/\`)
91
+ **Role:** Detailed history of complex tasks to save context tokens for future sessions.
92
+ **Location:** \`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID]-[slug].md\`
93
+ **Trigger:** Create a log when a task is finished, blocked, or if the session ends mid-task.
94
+
95
+ **TEMPLATE FOR WORKLOG:**
96
+ \`\`\`markdown
97
+ # WORKLOG: [TASK ID] [Task Name]
98
+ **Date:** YYYY-MM-DD
99
+ **Agent Status:** [Complete / Partial / Blocked]
100
+
101
+ ## 📝 Description
102
+ Brief summary of what was attempted/achieved.
103
+
104
+ ## 🛠 Technical Details
105
+ - **Files Modified:** List of files.
106
+ - **Key Decisions:** Why did you choose this library/pattern?
107
+ - **Challenges:** Any errors encountered and how they were solved.
108
+
109
+ ## ⏭ Next Steps / Context for Successor
110
+ Clear instructions for the next agent picking this up.
111
+ \`\`\`
112
+
113
+ ### C. The Context Anchor (\`AGENT.md\`)
114
+ **Role:** Fractal knowledge base. Contains facts, stack details, and user preferences.
115
+ **Location:** Root (\`/AGENT.md\`) and any subdirectory requiring specific context (e.g., \`/packages/core/AGENT.md\`).
116
+
117
+ **TEMPLATE FOR AGENT.md:**
118
+ \`\`\`markdown
119
+ ---
120
+ name: "[Name of directory or project]"
121
+ type: "[project / package / module / script]"
122
+ status: "[active / maintenance / poc]"
123
+ ---
124
+ # AGENT CONTEXT: [Directory Name or Root]
125
+
126
+ ## 🧠 Context & Objectives
127
+ What does this specific folder/module do?
128
+
129
+ ## ⚙️ Workflow & Preferences
130
+ - **Commits:** [e.g. Conventional Commits]
131
+ - **Language:** [English (default)]
132
+
133
+ ## 🏗 Stack & Architecture
134
+ - **Tech:** [Frameworks, Libs specific to this module]
135
+ - **Patterns:** [Architecture patterns used]
136
+
137
+ ## 📁 Key Directories
138
+ | Path | Description |
139
+ |------|-------------|
140
+ | \`src/\` | Source code |
141
+ | \`scripts/\` | Build or utility scripts |
142
+
143
+ ## ⚠️ Known Constraints
144
+ *List any technical debts, missing features, or external limitations.*
145
+ \`\`\`
146
+
147
+ ## 3. CORE WORKFLOW (The Loop)
148
+
149
+ ### Phase 1: Context Loading (Read-Only)
150
+ 1. **Read Root AGENT.md:** Absorb global preferences (Commit style, package manager, strict rules).
151
+ 2. **Read .autonomos/TASKS.md:** Identify the highest priority task (🔴 or 🟠) that is not [x] or [!].
152
+ 3. **Read Target AGENT.md:** If the task is in a subdirectory, check for a local \`AGENT.md\`.
153
+ * *Note:* If the local \`AGENT.md\` contradicts the root, the local one wins for that specific scope.
154
+
155
+ ### Phase 2: Execution
156
+ 1. **Mark the task as [/] (In Progress)** in \`.autonomos/TASKS.md\`.
157
+ 2. **Perform the task.**
158
+ 3. **Constraint Check:** Constantly refer to "Workflow & Preferences" in \`AGENT.md\`.
159
+
160
+ ### Phase 3: Crystallization (Write-Only)
161
+ Before ending the session, you **MUST**:
162
+
163
+ 1. **Update AGENT.md:**
164
+ * Did you learn a new command? Add it to ⚙️ Workflow.
165
+ * Did you create a new complex module (>5 files)? Create a new \`AGENT.md\` inside it using the template above.
166
+
167
+ 2. **Create Worklog:**
168
+ * Write a file in \`.autonomos/worklogs/\` summarizing your work.
169
+
170
+ 3. **Update TASKS.md:**
171
+ * Mark task as [x] (Done) or [!] (Blocked).
172
+ * Add a link to your worklog: \`- [x] **[ID]** Title... *See: .autonomos/worklogs/...*\`
173
+
174
+ ## 4. METADATA RULES
175
+ * **Language:** Documentation (\`AGENT.md\`, \`TASKS.md\`) must be written in **English** unless specified otherwise in User Preferences.
176
+ * **Tone:** Technical, concise, "Fact-based". No fluff.
177
+ * **Anonymity:** You are a continuous entity. Refer to previous work as "we" or "the project", not "the previous AI".
178
+ `,v=_,y=`# PROJECT TASKS & ROADMAP
179
+
180
+ > **LEGEND**
181
+ > **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]
182
+ > **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)
183
+ > **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked
184
+
185
+ ## 🚀 Active Sprint
186
+
187
+ - [ ] **[INIT-01]** Review project context and structure \`Priority: 🔵\` \`Complexity: S\`
188
+
189
+ ## 🔮 Backlog
190
+
191
+ *(Add future tasks here)*
192
+ `;function b(e){let t=e.date??new Date().toISOString().split(`T`)[0];return`# WORKLOG: [${e.taskId}] ${e.taskName}
193
+ **Date:** ${t}
194
+ **Agent Status:** [${e.status}]
195
+
196
+ ## 📝 Description
197
+ ${e.description}
198
+
199
+ ## 🛠 Technical Details
200
+ - **Files Modified:**
201
+ ${e.filesModified.map(e=>` - ${e}`).join(`
202
+ `)}
203
+ - **Key Decisions:**
204
+ ${e.decisions.map(e=>` - ${e}`).join(`
205
+ `)}
206
+ - **Challenges:**
207
+ ${e.challenges.map(e=>` - ${e}`).join(`
208
+ `)}
209
+
210
+ ## ⏭ Next Steps / Context for Successor
211
+ ${e.nextSteps.map(e=>`- ${e}`).join(`
212
+ `)}
213
+ `}function x(e){switch(e){case`DONE`:return`Complete`;case`BLOCKED`:return`Blocked`;default:return`Partial`}}var S=class{static parse(e){let n=e,r={},i=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(i)try{r=t.load(i[1]),n=e.slice(i[0].length).trim()}catch(e){console.error(`Failed to parse Agent frontmatter:`,e)}let a=n.split(/\r?\n/),o=[],s=r.name??`Unknown Agent`,c=null,l=[];for(let e of a){if(e.startsWith(`# `)&&!r.name){let t=e.replace(`# `,``).trim();s=t.toUpperCase().startsWith(`AGENT CONTEXT:`)?t.slice(14).replace(/^[:\s-]+/,``).trim():t;continue}if(e.startsWith(`## `)){c&&(c.content=l.join(`
214
+ `).trim(),o.push(c)),c={title:e.replace(`## `,``).trim(),content:``},l=[];continue}c&&l.push(e)}return c&&(c.content=l.join(`
215
+ `).trim(),o.push(c)),{title:s,sections:o,metadata:r}}},C=class{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`}}};export{s as AGENT_FILE,p as AGENT_TEMPLATE,r as AUTONOMOS_DIR,S as AgentParser,d as COMPLEXITIES,i as MANIFEST_FILE,l as ManifestSchema,u as PRIORITIES,a as PROTOCOL_FILE,_ as PROTOCOL_TEMPLATE,v as PROTOCOL_TEMPLATE_V2026_1,n as PROTOCOL_VERSION,o as TASKS_FILE,y as TASKS_TEMPLATE,C as TaskParser,c as WORKLOGS_DIR,m as createManifest,f as generateAgentTemplate,h as generateManifestContent,b as generateWorklogContent,x as mapTaskStatusToWorklogStatus,g as parseManifest};
@@ -0,0 +1,18 @@
1
+ import type { Config } from '@repo/eslint'
2
+ import { base } from '@repo/eslint'
3
+ import { defineConfig } from 'eslint/config'
4
+
5
+ const config: Config[] = defineConfig([
6
+ ...base,
7
+ {
8
+ ignores: [
9
+ 'eslint.config.ts',
10
+ 'eslint-types.d.ts',
11
+ 'prettier.config.mjs',
12
+ 'lint-staged.config.mjs',
13
+ 'tsdown.config.ts',
14
+ ],
15
+ },
16
+ ])
17
+
18
+ export default config
@@ -0,0 +1,4 @@
1
+ export default {
2
+ '**/*.{ts,tsx}': ['prettier --write', 'eslint --fix --no-warn-ignored'],
3
+ '**/*.{json,md,mdx}': 'prettier --write',
4
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@autonomos/core",
3
+ "version": "0.0.1",
4
+ "description": "SDK and core definitions for the Agent Protocol",
5
+ "type": "module",
6
+ "main": "./dist/index.mjs",
7
+ "types": "./dist/index.d.mts",
8
+ "keywords": [
9
+ "agent",
10
+ "protocol",
11
+ "ai",
12
+ "workflow"
13
+ ],
14
+ "author": "Autonomos",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "@types/js-yaml": "4.0.9",
18
+ "typescript": "^5.0.0",
19
+ "@repo/eslint": "1.0.0",
20
+ "@repo/prettier": "1.0.0",
21
+ "@repo/tsdown": "1.0.0",
22
+ "@repo/vitest": "1.0.0"
23
+ },
24
+ "module": "./dist/index.mjs",
25
+ "exports": {
26
+ ".": "./dist/index.mjs",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "dependencies": {
30
+ "js-yaml": "4.1.0",
31
+ "zod": "3.24.1"
32
+ },
33
+ "scripts": {
34
+ "dev": "tsdown --watch",
35
+ "build": "tsdown",
36
+ "lint": "eslint . --max-warnings 0",
37
+ "lint:fix": "eslint . --max-warnings 0 --fix",
38
+ "format:check": "prettier \"**/*\" --ignore-unknown --list-different",
39
+ "format:fix": "prettier \"**/*\" --ignore-unknown --write",
40
+ "clean": "rimraf node_modules dist",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit",
42
+ "test": "vitest",
43
+ "test:ui": "vitest --ui",
44
+ "test:run": "vitest run",
45
+ "test:coverage": "vitest run --coverage",
46
+ "pre-commit": "lint-staged"
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ import baseConfig from '@repo/prettier'
2
+
3
+ export default baseConfig
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Protocol version using SemVer
3
+ * Alpha phase - not yet published to npm
4
+ */
5
+ export const PROTOCOL_VERSION = '0.1.0-alpha'
6
+
7
+ /**
8
+ * Directory name for Autonomos configuration
9
+ */
10
+ export const AUTONOMOS_DIR = '.autonomos'
11
+
12
+ /**
13
+ * Manifest filename
14
+ */
15
+ export const MANIFEST_FILE = 'manifest.json'
16
+
17
+ /**
18
+ * Protocol filename
19
+ */
20
+ export const PROTOCOL_FILE = 'PROTOCOL.md'
21
+
22
+ /**
23
+ * Tasks filename
24
+ */
25
+ export const TASKS_FILE = 'TASKS.md'
26
+
27
+ /**
28
+ * Agent context filename (at project root)
29
+ */
30
+ export const AGENT_FILE = 'AGENT.md'
31
+
32
+ /**
33
+ * Worklogs directory name
34
+ */
35
+ export const WORKLOGS_DIR = 'worklogs'
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ // Constants
2
+ export * from './constants'
3
+ export * from './schemas/manifest'
4
+
5
+ // Types
6
+ export * from './types'
7
+
8
+ // Templates
9
+ export * from './templates/agent'
10
+ export * from './templates/manifest'
11
+ export * from './templates/protocol'
12
+ export * from './templates/tasks'
13
+ export * from './templates/worklog'
14
+
15
+ // Parsers
16
+ export * from './parsers/agent-parser'
17
+ export * from './parsers/task-parser'