@autonomos/core 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +277 -7
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +30 -11
- package/dist/index.mjs.map +1 -0
- package/dist/workflows/protocol-crystallize.md +48 -0
- package/dist/workflows/protocol-session.md +50 -0
- package/dist/workflows/protocol-task.md +37 -0
- package/package.json +29 -10
- package/.turbo/turbo-build.log +0 -15
- package/eslint.config.ts +0 -18
- package/lint-staged.config.mjs +0 -4
- package/prettier.config.mjs +0 -3
- package/src/constants.ts +0 -35
- package/src/index.ts +0 -17
- package/src/parsers/agent-parser.test.ts +0 -61
- package/src/parsers/agent-parser.ts +0 -80
- package/src/parsers/task-parser.test.ts +0 -60
- package/src/parsers/task-parser.ts +0 -40
- package/src/schemas/manifest.ts +0 -13
- package/src/templates/agent.ts +0 -43
- package/src/templates/manifest.test.ts +0 -26
- package/src/templates/manifest.ts +0 -30
- package/src/templates/protocol.ts +0 -157
- package/src/templates/tasks.ts +0 -18
- package/src/templates/worklog.test.ts +0 -37
- package/src/templates/worklog.ts +0 -55
- package/src/types.ts +0 -51
- package/tsconfig.json +0 -36
- package/tsdown.config.ts +0 -10
- package/vitest.config.ts +0 -9
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { PROTOCOL_VERSION } from '../constants'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The immutable Protocol kernel template
|
|
5
|
-
* This is the core specification that defines how AI agents interact with the project
|
|
6
|
-
*/
|
|
7
|
-
export const PROTOCOL_TEMPLATE = `# AI AGENT PROTOCOL (v${PROTOCOL_VERSION})
|
|
8
|
-
|
|
9
|
-
> **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.
|
|
10
|
-
|
|
11
|
-
## 0. ⚡ QUICK REFERENCE
|
|
12
|
-
| Action | File / Command |
|
|
13
|
-
|--------|----------------|
|
|
14
|
-
| **Get Context** | Read \`AGENT.md\` (Root + Local) |
|
|
15
|
-
| **Pick Task** | Check \`.autonomos/TASKS.md\` (Highest Priority) |
|
|
16
|
-
| **Track Progress** | Update \`.autonomos/TASKS.md\` to \`[/]\` |
|
|
17
|
-
| **Log Session** | Create \`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID].md\` |
|
|
18
|
-
| **Finalize Task** | Update \`.autonomos/TASKS.md\` to \`[x]\` + Link Worklog |
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 1. BOOTSTRAPPING & INITIALIZATION
|
|
23
|
-
**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.
|
|
24
|
-
|
|
25
|
-
### Check for existence:
|
|
26
|
-
1. \`.autonomos/TASKS.md\` (task registry)
|
|
27
|
-
2. \`.autonomos/worklogs/\` (directory)
|
|
28
|
-
3. \`AGENT.md\` (at project root)
|
|
29
|
-
|
|
30
|
-
**IF MISSING**, create them using the **TEMPLATES** defined in Section 2.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 2. STRICT FILE STRUCTURES & TEMPLATES
|
|
35
|
-
You must adhere to these schemas. Do not invent new formats.
|
|
36
|
-
|
|
37
|
-
### A. The Task Registry (\`.autonomos/TASKS.md\`)
|
|
38
|
-
**Role:** The single source of truth for project state.
|
|
39
|
-
**Location:** \`.autonomos/TASKS.md\`
|
|
40
|
-
**Structure:**
|
|
41
|
-
* Must use the specific Header and Legend.
|
|
42
|
-
* Tasks must follow the format: \`- [Status] **[ID]** Title of task \`Priority\` \`Complexity\`\`
|
|
43
|
-
* Valid Priorities: \`🔴 Critical\`, \`🟠 High\`, \`🔵 Medium\`, \`⚪ Low\`
|
|
44
|
-
* Valid Complexities: \`S\`, \`M\`, \`L\`, \`XL\`
|
|
45
|
-
* Valid Statuses: \` [ ] \` (Todo), \`[/]\` (In Progress), \` [x] \` (Done), \` [!] \` (Blocked)
|
|
46
|
-
|
|
47
|
-
**TEMPLATE FOR NEW TASKS.md:**
|
|
48
|
-
\`\`\`markdown
|
|
49
|
-
# PROJECT TASKS & ROADMAP
|
|
50
|
-
|
|
51
|
-
> **LEGEND**
|
|
52
|
-
> **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]
|
|
53
|
-
> **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)
|
|
54
|
-
> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked
|
|
55
|
-
|
|
56
|
-
## 🚀 Active Sprint
|
|
57
|
-
- [ ] **[INIT-01]** Verify project structure and context \`Priority: 🔴\` \`Complexity: S\`
|
|
58
|
-
|
|
59
|
-
## 🔮 Backlog
|
|
60
|
-
*(Empty initially)*
|
|
61
|
-
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
### B. The Worklog (\`.autonomos/worklogs/\`)
|
|
65
|
-
**Role:** Detailed history of complex tasks to save context tokens for future sessions.
|
|
66
|
-
**Location:** \`.autonomos/worklogs/YYYY-MM-DD-[TASK_ID]-[slug].md\`
|
|
67
|
-
**Trigger:** Create a log when a task is finished, blocked, or if the session ends mid-task.
|
|
68
|
-
|
|
69
|
-
**TEMPLATE FOR WORKLOG:**
|
|
70
|
-
\`\`\`markdown
|
|
71
|
-
# WORKLOG: [TASK ID] [Task Name]
|
|
72
|
-
**Date:** YYYY-MM-DD
|
|
73
|
-
**Agent Status:** [Complete / Partial / Blocked]
|
|
74
|
-
|
|
75
|
-
## 📝 Description
|
|
76
|
-
Brief summary of what was attempted/achieved.
|
|
77
|
-
|
|
78
|
-
## 🛠 Technical Details
|
|
79
|
-
- **Files Modified:** List of files.
|
|
80
|
-
- **Key Decisions:** Why did you choose this library/pattern?
|
|
81
|
-
- **Challenges:** Any errors encountered and how they were solved.
|
|
82
|
-
|
|
83
|
-
## ⏭ Next Steps / Context for Successor
|
|
84
|
-
Clear instructions for the next agent picking this up.
|
|
85
|
-
\`\`\`
|
|
86
|
-
|
|
87
|
-
### C. The Context Anchor (\`AGENT.md\`)
|
|
88
|
-
**Role:** Fractal knowledge base. Contains facts, stack details, and user preferences.
|
|
89
|
-
**Location:** Root (\`/AGENT.md\`) and any subdirectory requiring specific context (e.g., \`/packages/core/AGENT.md\`).
|
|
90
|
-
|
|
91
|
-
**TEMPLATE FOR AGENT.md:**
|
|
92
|
-
\`\`\`markdown
|
|
93
|
-
---
|
|
94
|
-
name: "[Name of directory or project]"
|
|
95
|
-
type: "[project / package / module / script]"
|
|
96
|
-
status: "[active / maintenance / poc]"
|
|
97
|
-
---
|
|
98
|
-
# AGENT CONTEXT: [Directory Name or Root]
|
|
99
|
-
|
|
100
|
-
## 🧠 Context & Objectives
|
|
101
|
-
What does this specific folder/module do?
|
|
102
|
-
|
|
103
|
-
## ⚙️ Workflow & Preferences
|
|
104
|
-
- **Commits:** [e.g. Conventional Commits]
|
|
105
|
-
- **Language:** [English (default)]
|
|
106
|
-
|
|
107
|
-
## 🏗 Stack & Architecture
|
|
108
|
-
- **Tech:** [Frameworks, Libs specific to this module]
|
|
109
|
-
- **Patterns:** [Architecture patterns used]
|
|
110
|
-
|
|
111
|
-
## 📁 Key Directories
|
|
112
|
-
| Path | Description |
|
|
113
|
-
|------|-------------|
|
|
114
|
-
| \`src/\` | Source code |
|
|
115
|
-
| \`scripts/\` | Build or utility scripts |
|
|
116
|
-
|
|
117
|
-
## ⚠️ Known Constraints
|
|
118
|
-
*List any technical debts, missing features, or external limitations.*
|
|
119
|
-
\`\`\`
|
|
120
|
-
|
|
121
|
-
## 3. CORE WORKFLOW (The Loop)
|
|
122
|
-
|
|
123
|
-
### Phase 1: Context Loading (Read-Only)
|
|
124
|
-
1. **Read Root AGENT.md:** Absorb global preferences (Commit style, package manager, strict rules).
|
|
125
|
-
2. **Read .autonomos/TASKS.md:** Identify the highest priority task (🔴 or 🟠) that is not [x] or [!].
|
|
126
|
-
3. **Read Target AGENT.md:** If the task is in a subdirectory, check for a local \`AGENT.md\`.
|
|
127
|
-
* *Note:* If the local \`AGENT.md\` contradicts the root, the local one wins for that specific scope.
|
|
128
|
-
|
|
129
|
-
### Phase 2: Execution
|
|
130
|
-
1. **Mark the task as [/] (In Progress)** in \`.autonomos/TASKS.md\`.
|
|
131
|
-
2. **Perform the task.**
|
|
132
|
-
3. **Constraint Check:** Constantly refer to "Workflow & Preferences" in \`AGENT.md\`.
|
|
133
|
-
|
|
134
|
-
### Phase 3: Crystallization (Write-Only)
|
|
135
|
-
Before ending the session, you **MUST**:
|
|
136
|
-
|
|
137
|
-
1. **Update AGENT.md:**
|
|
138
|
-
* Did you learn a new command? Add it to ⚙️ Workflow.
|
|
139
|
-
* Did you create a new complex module (>5 files)? Create a new \`AGENT.md\` inside it using the template above.
|
|
140
|
-
|
|
141
|
-
2. **Create Worklog:**
|
|
142
|
-
* Write a file in \`.autonomos/worklogs/\` summarizing your work.
|
|
143
|
-
|
|
144
|
-
3. **Update TASKS.md:**
|
|
145
|
-
* Mark task as [x] (Done) or [!] (Blocked).
|
|
146
|
-
* Add a link to your worklog: \`- [x] **[ID]** Title... *See: .autonomos/worklogs/...*\`
|
|
147
|
-
|
|
148
|
-
## 4. METADATA RULES
|
|
149
|
-
* **Language:** Documentation (\`AGENT.md\`, \`TASKS.md\`) must be written in **English** unless specified otherwise in User Preferences.
|
|
150
|
-
* **Tone:** Technical, concise, "Fact-based". No fluff.
|
|
151
|
-
* **Anonymity:** You are a continuous entity. Refer to previous work as "we" or "the project", not "the previous AI".
|
|
152
|
-
`
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @deprecated Use PROTOCOL_TEMPLATE instead
|
|
156
|
-
*/
|
|
157
|
-
export const PROTOCOL_TEMPLATE_V2026_1 = PROTOCOL_TEMPLATE
|
package/src/templates/tasks.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Template for TASKS.md - The task registry
|
|
3
|
-
*/
|
|
4
|
-
export const TASKS_TEMPLATE = `# PROJECT TASKS & ROADMAP
|
|
5
|
-
|
|
6
|
-
> **LEGEND**
|
|
7
|
-
> **Priority:** [🔴 Critical] [🟠 High] [🔵 Medium] [⚪ Low]
|
|
8
|
-
> **Complexity:** [S] Small (1h), [M] Medium (4h), [L] Large (1-2 days), [XL] Huge (Planning req.)
|
|
9
|
-
> **Status:** [ ] Todo, [/] In Progress, [x] Done, [!] Blocked
|
|
10
|
-
|
|
11
|
-
## 🚀 Active Sprint
|
|
12
|
-
|
|
13
|
-
- [ ] **[INIT-01]** Review project context and structure \`Priority: 🔵\` \`Complexity: S\`
|
|
14
|
-
|
|
15
|
-
## 🔮 Backlog
|
|
16
|
-
|
|
17
|
-
*(Add future tasks here)*
|
|
18
|
-
`
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import { generateWorklogContent } from './worklog'
|
|
3
|
-
|
|
4
|
-
describe('Worklog Template', () => {
|
|
5
|
-
it('should generate a valid worklog content', () => {
|
|
6
|
-
const content = generateWorklogContent({
|
|
7
|
-
taskId: 'TASK-01',
|
|
8
|
-
taskName: 'Fixing Bug',
|
|
9
|
-
status: 'Complete',
|
|
10
|
-
description: 'Fixed the line splitting issue.',
|
|
11
|
-
filesModified: ['src/parsers/task-parser.ts'],
|
|
12
|
-
decisions: ['Used regex for splitting'],
|
|
13
|
-
challenges: ['Template literal escaping'],
|
|
14
|
-
nextSteps: ['Add more tests'],
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
expect(content).toContain('# WORKLOG: [TASK-01] Fixing Bug')
|
|
18
|
-
expect(content).toContain('**Agent Status:** [Complete]')
|
|
19
|
-
expect(content).toContain('- src/parsers/task-parser.ts')
|
|
20
|
-
expect(content).toContain('- Used regex for splitting')
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('should use current date if not provided', () => {
|
|
24
|
-
const content = generateWorklogContent({
|
|
25
|
-
taskId: 'T',
|
|
26
|
-
taskName: 'N',
|
|
27
|
-
status: 'Partial',
|
|
28
|
-
description: 'D',
|
|
29
|
-
filesModified: [],
|
|
30
|
-
decisions: [],
|
|
31
|
-
challenges: [],
|
|
32
|
-
nextSteps: [],
|
|
33
|
-
})
|
|
34
|
-
const today = new Date().toISOString().split('T')[0]
|
|
35
|
-
expect(content).toContain(`**Date:** ${today}`)
|
|
36
|
-
})
|
|
37
|
-
})
|
package/src/templates/worklog.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { TaskStatus } from '../types'
|
|
2
|
-
|
|
3
|
-
interface WorklogOptions {
|
|
4
|
-
taskId: string
|
|
5
|
-
taskName: string
|
|
6
|
-
date?: string
|
|
7
|
-
status: 'Complete' | 'Partial' | 'Blocked'
|
|
8
|
-
description: string
|
|
9
|
-
filesModified: string[]
|
|
10
|
-
decisions: string[]
|
|
11
|
-
challenges: string[]
|
|
12
|
-
nextSteps: string[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generate a Worklog markdown content
|
|
17
|
-
*/
|
|
18
|
-
export function generateWorklogContent(options: WorklogOptions): string {
|
|
19
|
-
const date = options.date ?? new Date().toISOString().split('T')[0]
|
|
20
|
-
|
|
21
|
-
return `# WORKLOG: [${options.taskId}] ${options.taskName}
|
|
22
|
-
**Date:** ${date}
|
|
23
|
-
**Agent Status:** [${options.status}]
|
|
24
|
-
|
|
25
|
-
## 📝 Description
|
|
26
|
-
${options.description}
|
|
27
|
-
|
|
28
|
-
## 🛠 Technical Details
|
|
29
|
-
- **Files Modified:**
|
|
30
|
-
${options.filesModified.map(f => ` - ${f}`).join('\n')}
|
|
31
|
-
- **Key Decisions:**
|
|
32
|
-
${options.decisions.map(d => ` - ${d}`).join('\n')}
|
|
33
|
-
- **Challenges:**
|
|
34
|
-
${options.challenges.map(c => ` - ${c}`).join('\n')}
|
|
35
|
-
|
|
36
|
-
## ⏭ Next Steps / Context for Successor
|
|
37
|
-
${options.nextSteps.map(s => `- ${s}`).join('\n')}
|
|
38
|
-
`
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Common status mapping for worklogs
|
|
43
|
-
*/
|
|
44
|
-
export function mapTaskStatusToWorklogStatus(
|
|
45
|
-
status: TaskStatus
|
|
46
|
-
): 'Complete' | 'Partial' | 'Blocked' {
|
|
47
|
-
switch (status) {
|
|
48
|
-
case 'DONE':
|
|
49
|
-
return 'Complete'
|
|
50
|
-
case 'BLOCKED':
|
|
51
|
-
return 'Blocked'
|
|
52
|
-
default:
|
|
53
|
-
return 'Partial'
|
|
54
|
-
}
|
|
55
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Priority levels for tasks
|
|
3
|
-
*/
|
|
4
|
-
export type Priority = '🔴 Critical' | '🟠 High' | '🔵 Medium' | '⚪ Low'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Complexity estimates for tasks
|
|
8
|
-
*/
|
|
9
|
-
export type Complexity = 'S' | 'M' | 'L' | 'XL'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Task status markers
|
|
13
|
-
*/
|
|
14
|
-
export type TaskStatus = 'TODO' | 'IN_PROGRESS' | 'DONE' | 'BLOCKED'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Task entity parsed from TASKS.md
|
|
18
|
-
*/
|
|
19
|
-
export interface Task {
|
|
20
|
-
id: string
|
|
21
|
-
title: string
|
|
22
|
-
priority: Priority
|
|
23
|
-
complexity: Complexity
|
|
24
|
-
status: TaskStatus
|
|
25
|
-
worklogPath?: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Agent configuration parsed from AGENT.md
|
|
30
|
-
*/
|
|
31
|
-
export interface AgentConfig {
|
|
32
|
-
name: string
|
|
33
|
-
description?: string
|
|
34
|
-
stack: string[]
|
|
35
|
-
preferences?: Record<string, any>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface AgentSection {
|
|
39
|
-
title: string
|
|
40
|
-
content: string
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface AgentContext {
|
|
44
|
-
title: string
|
|
45
|
-
description?: string
|
|
46
|
-
sections: AgentSection[]
|
|
47
|
-
metadata?: Record<string, any>
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const PRIORITIES: Priority[] = ['🔴 Critical', '🟠 High', '🔵 Medium', '⚪ Low']
|
|
51
|
-
export const COMPLEXITIES: Complexity[] = ['S', 'M', 'L', 'XL']
|
package/tsconfig.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@repo/tsconfig/base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "esnext",
|
|
5
|
-
"lib": ["es2022"],
|
|
6
|
-
"moduleDetection": "force",
|
|
7
|
-
"module": "esnext",
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"types": ["node", "vitest"],
|
|
11
|
-
"strict": true,
|
|
12
|
-
"noUnusedLocals": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"verbatimModuleSyntax": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"baseUrl": ".",
|
|
19
|
-
"outDir": "./dist",
|
|
20
|
-
"rootDir": ".",
|
|
21
|
-
"paths": {
|
|
22
|
-
"@/*": ["src/*"],
|
|
23
|
-
"@tests/*": ["tests/*"]
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"include": [
|
|
27
|
-
"./src/**/*",
|
|
28
|
-
"./src/**/*.json",
|
|
29
|
-
"tsdown.config.ts",
|
|
30
|
-
"vitest.config.ts",
|
|
31
|
-
"tests/**/*",
|
|
32
|
-
"lint-staged.config.mjs",
|
|
33
|
-
"prettier.config.mjs"
|
|
34
|
-
],
|
|
35
|
-
"exclude": ["dist", "build", "node_modules", ".vscode", ".turbo", "coverage"]
|
|
36
|
-
}
|
package/tsdown.config.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { base } from '@repo/tsdown'
|
|
2
|
-
import type { UserConfigFn } from 'tsdown/config'
|
|
3
|
-
import { defineConfig } from 'tsdown/config'
|
|
4
|
-
|
|
5
|
-
const configFn: UserConfigFn = defineConfig(async options => ({
|
|
6
|
-
...(await base(options, { ci: true })),
|
|
7
|
-
entry: ['./src/index.ts', './src/*/index.ts'],
|
|
8
|
-
}))
|
|
9
|
-
|
|
10
|
-
export default configFn
|