@esotech/contextuate 2.0.0 → 2.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/README.md +169 -1
- package/dist/commands/claude.d.ts +21 -0
- package/dist/commands/claude.js +213 -0
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.js +67 -6
- package/dist/commands/install.d.ts +28 -0
- package/dist/commands/install.js +116 -11
- package/dist/commands/monitor.d.ts +55 -0
- package/dist/commands/monitor.js +1007 -0
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/run.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +113 -1
- package/dist/monitor/daemon/circuit-breaker.d.ts +121 -0
- package/dist/monitor/daemon/circuit-breaker.js +552 -0
- package/dist/monitor/daemon/cli.d.ts +8 -0
- package/dist/monitor/daemon/cli.js +82 -0
- package/dist/monitor/daemon/index.d.ts +137 -0
- package/dist/monitor/daemon/index.js +695 -0
- package/dist/monitor/daemon/notifier.d.ts +25 -0
- package/dist/monitor/daemon/notifier.js +98 -0
- package/dist/monitor/daemon/processor.d.ts +89 -0
- package/dist/monitor/daemon/processor.js +455 -0
- package/dist/monitor/daemon/state.d.ts +80 -0
- package/dist/monitor/daemon/state.js +162 -0
- package/dist/monitor/daemon/watcher.d.ts +47 -0
- package/dist/monitor/daemon/watcher.js +171 -0
- package/dist/monitor/daemon/wrapper-manager.d.ts +106 -0
- package/dist/monitor/daemon/wrapper-manager.js +374 -0
- package/dist/monitor/hooks/emit-event.js +652 -0
- package/dist/monitor/persistence/file-store.d.ts +88 -0
- package/dist/monitor/persistence/file-store.js +335 -0
- package/dist/monitor/persistence/index.d.ts +7 -0
- package/dist/monitor/persistence/index.js +10 -0
- package/dist/monitor/server/adapters/redis.d.ts +38 -0
- package/dist/monitor/server/adapters/redis.js +213 -0
- package/dist/monitor/server/adapters/unix-socket.d.ts +33 -0
- package/dist/monitor/server/adapters/unix-socket.js +182 -0
- package/dist/monitor/server/broker.d.ts +135 -0
- package/dist/monitor/server/broker.js +475 -0
- package/dist/monitor/server/cli.d.ts +8 -0
- package/dist/monitor/server/cli.js +98 -0
- package/dist/monitor/server/fastify.d.ts +16 -0
- package/dist/monitor/server/fastify.js +184 -0
- package/dist/monitor/server/index.d.ts +36 -0
- package/dist/monitor/server/index.js +153 -0
- package/dist/monitor/server/websocket.d.ts +80 -0
- package/dist/monitor/server/websocket.js +453 -0
- package/dist/monitor/ui/assets/index-4IssW9On.js +59 -0
- package/dist/monitor/ui/assets/index-vo9hLe5R.css +32 -0
- package/dist/monitor/ui/favicon.png +0 -0
- package/dist/monitor/ui/index.html +14 -0
- package/dist/monitor/ui/logo.png +0 -0
- package/dist/monitor/ui/logo.svg +1 -0
- package/dist/runtime/driver.d.ts +16 -0
- package/dist/runtime/tools.d.ts +10 -0
- package/dist/templates/README.md +33 -7
- package/dist/templates/agents/aegis.md +4 -0
- package/dist/templates/agents/archon.md +13 -22
- package/dist/templates/agents/atlas.md +4 -0
- package/dist/templates/agents/canvas.md +4 -0
- package/dist/templates/agents/chronicle.md +4 -0
- package/dist/templates/agents/chronos.md +4 -0
- package/dist/templates/agents/cipher.md +4 -0
- package/dist/templates/agents/crucible.md +4 -0
- package/dist/templates/agents/echo.md +4 -0
- package/dist/templates/agents/forge.md +4 -0
- package/dist/templates/agents/ledger.md +4 -0
- package/dist/templates/agents/meridian.md +4 -0
- package/dist/templates/agents/nexus.md +4 -0
- package/dist/templates/agents/pythia.md +217 -0
- package/dist/templates/agents/scribe.md +4 -0
- package/dist/templates/agents/sentinel.md +4 -0
- package/dist/templates/agents/{oracle.md → thoth.md} +11 -7
- package/dist/templates/agents/unity.md +4 -0
- package/dist/templates/agents/vox.md +4 -0
- package/dist/templates/agents/weaver.md +4 -0
- package/dist/templates/framework-agents/documentation-expert.md +3 -3
- package/dist/templates/framework-agents/tools-expert.md +8 -8
- package/dist/templates/skills/consult.md +138 -0
- package/dist/templates/skills/orchestrate.md +173 -0
- package/dist/templates/skills/pythia.md +37 -0
- package/dist/templates/standards/agent-roles.md +68 -21
- package/dist/templates/standards/coding-standards.md +9 -26
- package/dist/templates/templates/context.md +17 -2
- package/dist/templates/templates/contextuate.md +21 -28
- package/dist/templates/templates/standards/go.md +167 -0
- package/dist/templates/templates/standards/java.md +167 -0
- package/dist/templates/templates/standards/javascript.md +292 -0
- package/dist/templates/templates/standards/php.md +181 -0
- package/dist/templates/templates/standards/python.md +175 -0
- package/dist/templates/tools/agent-creator.md +252 -0
- package/dist/templates/tools/agent-creator.tool.md +2 -2
- package/dist/templates/tools/quickref.md +216 -0
- package/dist/templates/tools/spawn.md +31 -0
- package/dist/templates/tools/standards-detector.md +301 -0
- package/dist/templates/version.json +1 -1
- package/dist/types/monitor.d.ts +660 -0
- package/dist/types/monitor.js +75 -0
- package/dist/utils/git.d.ts +9 -0
- package/dist/utils/tokens.d.ts +10 -0
- package/package.json +18 -5
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# /orchestrate - Orchestrator Mode Skill
|
|
2
|
+
|
|
3
|
+
Activate the ARCHON agent for coordinated multi-agent task execution.
|
|
4
|
+
|
|
5
|
+
## Agent Invocation
|
|
6
|
+
|
|
7
|
+
**IMPORTANT:** Before proceeding, read and adopt the ARCHON agent persona:
|
|
8
|
+
|
|
9
|
+
**Agent Definition:** [agents/archon.md](../agents/archon.md)
|
|
10
|
+
|
|
11
|
+
Read the agent file above, then follow its guidelines for task analysis, delegation, and synthesis.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/orchestrate [task description]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Behavior
|
|
20
|
+
|
|
21
|
+
When this skill is invoked, read the ARCHON agent definition and adopt its persona to:
|
|
22
|
+
|
|
23
|
+
1. **Analyze the task** to identify required domains and complexity
|
|
24
|
+
2. **Delegate to specialist agents** rather than implementing directly
|
|
25
|
+
3. **Coordinate handoffs** between agents for dependent tasks
|
|
26
|
+
4. **Synthesize results** into a cohesive solution
|
|
27
|
+
|
|
28
|
+
## Pre-Orchestration
|
|
29
|
+
|
|
30
|
+
For complex or unfamiliar work, use `/consult` BEFORE `/orchestrate`:
|
|
31
|
+
```
|
|
32
|
+
/consult [research/plan topic] → produces specification
|
|
33
|
+
/orchestrate [implement spec] → delegates to specialists
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Available Specialist Agents
|
|
37
|
+
|
|
38
|
+
> **Agent Roster:** [agent-roles.md](../.contextuate/standards/agent-roles.md)
|
|
39
|
+
|
|
40
|
+
Read the agent roster for the complete list of specialist agents with their domains and when to use each one.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Multi-domain feature
|
|
45
|
+
```
|
|
46
|
+
/orchestrate Add a new API endpoint with database query, validation, and tests
|
|
47
|
+
```
|
|
48
|
+
Result: Delegates to thoth (query), nexus (API), sentinel (validation), crucible (tests)
|
|
49
|
+
|
|
50
|
+
### Code review workflow
|
|
51
|
+
```
|
|
52
|
+
/orchestrate Review the authentication module for security issues and suggest improvements
|
|
53
|
+
```
|
|
54
|
+
Result: Delegates to atlas (find files), sentinel (security analysis), aegis (code review)
|
|
55
|
+
|
|
56
|
+
### Documentation task
|
|
57
|
+
```
|
|
58
|
+
/orchestrate Document the monitor feature architecture and create API reference
|
|
59
|
+
```
|
|
60
|
+
Result: Delegates to chronicle (architecture doc), scribe (API reference)
|
|
61
|
+
|
|
62
|
+
## Orchestration Rules
|
|
63
|
+
|
|
64
|
+
1. **Never implement directly** - Always delegate to specialist agents
|
|
65
|
+
2. **Provide context** - Give agents specific file paths and patterns to follow
|
|
66
|
+
3. **Track complex tasks** - Use ledger for multi-step work
|
|
67
|
+
4. **Synthesize results** - Combine agent outputs into cohesive solution
|
|
68
|
+
5. **Keep context clean** - Delegate to subagents to preserve main context window
|
|
69
|
+
|
|
70
|
+
## Parallel Execution
|
|
71
|
+
|
|
72
|
+
**CRITICAL: Always spawn independent agents in parallel.**
|
|
73
|
+
|
|
74
|
+
When multiple agents can work independently (no dependencies between their outputs), you MUST launch them in a single message with multiple Task tool calls:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Good: Single message with parallel Task calls for independent work
|
|
78
|
+
├── Task: atlas (find auth files)
|
|
79
|
+
├── Task: thoth (analyze schema)
|
|
80
|
+
└── Task: sentinel (security review)
|
|
81
|
+
|
|
82
|
+
Bad: Sequential Task calls when work is independent
|
|
83
|
+
├── Message 1: Task: atlas...
|
|
84
|
+
├── Message 2: Task: thoth...
|
|
85
|
+
└── Message 3: Task: sentinel...
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Parallel execution rules:**
|
|
89
|
+
- Identify independent tasks that don't depend on each other's output
|
|
90
|
+
- Launch all independent tasks in a single response
|
|
91
|
+
- Only serialize tasks that have true dependencies
|
|
92
|
+
- Use background execution (`run_in_background: true`) for long-running tasks when appropriate
|
|
93
|
+
|
|
94
|
+
## File Contention & Conflict Avoidance
|
|
95
|
+
|
|
96
|
+
When multiple agents may modify the same files, use the **Intent-First Locking Protocol**.
|
|
97
|
+
|
|
98
|
+
> **Full Protocol:** [agent-workflow.md](../.contextuate/standards/agent-workflow.md#conflict-avoidance--file-locking)
|
|
99
|
+
|
|
100
|
+
### Quick Reference
|
|
101
|
+
|
|
102
|
+
**Step 1: Intent Declaration** - Before editing, agents declare intent:
|
|
103
|
+
```yaml
|
|
104
|
+
Status: PLANNING
|
|
105
|
+
Intent:
|
|
106
|
+
- Modify: src/path/to/file.js
|
|
107
|
+
- Create: src/path/to/new-file.js
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 2: Archon Validation** - Check against Active Lock Table:
|
|
111
|
+
- **Clear**: Lock the files, approve execution
|
|
112
|
+
- **Conflict**: Queue the agent until files are released
|
|
113
|
+
|
|
114
|
+
**Step 3: Resolution Options:**
|
|
115
|
+
| Scenario | Resolution |
|
|
116
|
+
|----------|------------|
|
|
117
|
+
| Files are free | Lock and proceed |
|
|
118
|
+
| Files locked by another agent | Queue and wait |
|
|
119
|
+
| Highly parallel work | Use Git Worktree isolation |
|
|
120
|
+
|
|
121
|
+
### Git Worktree Alternative
|
|
122
|
+
For highly parallel tasks where locking is too restrictive:
|
|
123
|
+
1. Create disposable Git worktree (branch) per agent
|
|
124
|
+
2. Agent works entirely within worktree
|
|
125
|
+
3. Agent commits and signals ready
|
|
126
|
+
4. **Unity** merges branch into main
|
|
127
|
+
|
|
128
|
+
## Agent Preference Order
|
|
129
|
+
|
|
130
|
+
**CRITICAL: Prefer specialist agents over general-purpose agents.**
|
|
131
|
+
|
|
132
|
+
When deciding which agent to use, follow this preference hierarchy:
|
|
133
|
+
|
|
134
|
+
1. **Custom Specialist Agents** (STRONGLY PREFERRED)
|
|
135
|
+
- aegis, atlas, canvas, chronicle, chronos, cipher, crucible, echo, forge, ledger, meridian, nexus, thoth, scribe, sentinel, unity, vox, weaver
|
|
136
|
+
- These have domain-specific expertise and context
|
|
137
|
+
|
|
138
|
+
2. **Built-in Specialized Agents** (Use only if no specialist fits)
|
|
139
|
+
- Plan, Explore, claude-code-guide
|
|
140
|
+
|
|
141
|
+
3. **General-Purpose Agents** (AVOID unless absolutely necessary)
|
|
142
|
+
- general-purpose - Only use for truly generic tasks that don't fit any specialist
|
|
143
|
+
|
|
144
|
+
**Examples:**
|
|
145
|
+
| Task | Wrong Choice | Right Choice |
|
|
146
|
+
|------|-------------|--------------|
|
|
147
|
+
| Find files related to auth | general-purpose | **atlas** |
|
|
148
|
+
| Write API documentation | general-purpose | **scribe** |
|
|
149
|
+
| Review code quality | Explore | **aegis** |
|
|
150
|
+
| Create database queries | general-purpose | **thoth** |
|
|
151
|
+
| Build new component | general-purpose | **forge** (scaffold) + **canvas** (UI) |
|
|
152
|
+
|
|
153
|
+
**Always ask: "Which specialist agent has domain expertise for this task?"**
|
|
154
|
+
|
|
155
|
+
## Decision Tree
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
Is this a simple, single-domain task?
|
|
159
|
+
├── YES → Delegate to single specialist
|
|
160
|
+
└── NO → Break down and coordinate multiple specialists
|
|
161
|
+
|
|
162
|
+
Does it require exploration first?
|
|
163
|
+
├── YES → Start with atlas for navigation
|
|
164
|
+
└── NO → Proceed to implementation agents
|
|
165
|
+
|
|
166
|
+
Is this multi-step?
|
|
167
|
+
├── YES → Engage ledger for tracking
|
|
168
|
+
└── NO → Direct delegation
|
|
169
|
+
|
|
170
|
+
Should we review the result?
|
|
171
|
+
├── YES → aegis for quality, crucible for tests
|
|
172
|
+
└── NO → Deliver directly
|
|
173
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# /pythia - Strategic Planning Oracle
|
|
2
|
+
|
|
3
|
+
Alias for `/consult`. Activates the PYTHIA agent for strategic planning and research.
|
|
4
|
+
|
|
5
|
+
## Agent Invocation
|
|
6
|
+
|
|
7
|
+
**IMPORTANT:** Before proceeding, read and adopt the PYTHIA agent persona:
|
|
8
|
+
|
|
9
|
+
**Agent Definition:** [agents/pythia.md](../agents/pythia.md)
|
|
10
|
+
|
|
11
|
+
Read the agent file above, then follow its guidelines for research, synthesis, and specification creation.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/pythia [topic or question]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
See [/consult](./consult.md) for full documentation and behavior details.
|
|
20
|
+
|
|
21
|
+
## Quick Reference
|
|
22
|
+
|
|
23
|
+
| Command | Purpose |
|
|
24
|
+
|---------|---------|
|
|
25
|
+
| `/pythia [topic]` | Research and plan before implementation |
|
|
26
|
+
| `/consult [topic]` | Same as `/pythia` |
|
|
27
|
+
| `/orchestrate [task]` | Execute implementation with specialist agents |
|
|
28
|
+
|
|
29
|
+
## Example Flow
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
/pythia How should we implement real-time notifications?
|
|
33
|
+
|
|
|
34
|
+
[PYTHIA produces specification]
|
|
35
|
+
|
|
|
36
|
+
/orchestrate Implement the notification system per spec
|
|
37
|
+
```
|
|
@@ -1,34 +1,81 @@
|
|
|
1
1
|
# Agent Roles (Team Roster)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Purpose:** Authoritative registry of all specialist agents. Reference this when deciding which agent to delegate to.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
All agents have dedicated definition files in `docs/ai/agents/` containing their full responsibilities and context.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Project Manager & Technical Lead. Parses user requests and manages the creation of tasks.
|
|
7
|
+
---
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
Cloud Architect. Handles Docker, Kubernetes, Secrets, and CI/CD pipelines.
|
|
9
|
+
## Specialist Agents
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
| Agent | Model | Domain | When to Delegate |
|
|
12
|
+
|-------|-------|--------|------------------|
|
|
13
|
+
| [**PYTHIA**](../../agents/pythia.md) | Opus | Planning/Research | Pre-implementation research, ideation, specification (use for complex/unfamiliar work requiring deep planning) |
|
|
14
|
+
| [**ARCHON**](../../agents/archon.md) | Opus | Orchestration | Complex multi-agent tasks requiring coordination (sub-orchestration) |
|
|
15
|
+
| [**AEGIS**](../../agents/aegis.md) | Sonnet | Quality/Review | Code review, best practices, quality assurance |
|
|
16
|
+
| [**ATLAS**](../../agents/atlas.md) | Sonnet | Navigation | Codebase exploration, file search, pattern discovery |
|
|
17
|
+
| [**CANVAS**](../../agents/canvas.md) | Sonnet | Frontend/UX | UI components, state management, theming, design systems |
|
|
18
|
+
| [**CHRONICLE**](../../agents/chronicle.md) | Sonnet | Documentation | Comments, markdown, changelogs |
|
|
19
|
+
| [**CHRONOS**](../../agents/chronos.md) | Sonnet | Data/State | Database administration, caching, state management, performance |
|
|
20
|
+
| [**CIPHER**](../../agents/cipher.md) | Sonnet | Data Transformation | Data utilities, formatting, transformations |
|
|
21
|
+
| [**CRUCIBLE**](../../agents/crucible.md) | Sonnet | Testing | Test writing, execution, coverage |
|
|
22
|
+
| [**ECHO**](../../agents/echo.md) | Sonnet | Frontend JS | JavaScript, UI interactions, client-side |
|
|
23
|
+
| [**FORGE**](../../agents/forge.md) | Sonnet | Infrastructure | Scaffolding, deployment, DevOps, tooling |
|
|
24
|
+
| [**LEDGER**](../../agents/ledger.md) | Sonnet | Task Management | Multi-step tasks, session continuity, progress tracking |
|
|
25
|
+
| [**MERIDIAN**](../../agents/meridian.md) | Sonnet | Schema/Migrations | Database schema changes, migrations |
|
|
26
|
+
| [**NEXUS**](../../agents/nexus.md) | Sonnet | Backend/Services | Service classes, external APIs, business logic |
|
|
27
|
+
| [**THOTH**](../../agents/thoth.md) | Opus | Database/Queries | Complex database queries, schema design, data operations |
|
|
28
|
+
| [**SCRIBE**](../../agents/scribe.md) | Sonnet | Documentation | API docs, technical writing, user guides |
|
|
29
|
+
| [**SENTINEL**](../../agents/sentinel.md) | Opus | Security | Validation, permissions, sanitization, security analysis |
|
|
30
|
+
| [**UNITY**](../../agents/unity.md) | Sonnet | Version Control | Git merges, conflict resolution, release management |
|
|
31
|
+
| [**VOX**](../../agents/vox.md) | Sonnet | Media/Communications | WebRTC, streaming, audio/video processing |
|
|
32
|
+
| [**WEAVER**](../../agents/weaver.md) | Sonnet | Controllers/Views | Page actions, view rendering, permissions |
|
|
15
33
|
|
|
16
|
-
|
|
17
|
-
Communications Specialist. Handles WebRTC, SIP, and audio/video processing.
|
|
34
|
+
---
|
|
18
35
|
|
|
19
|
-
|
|
20
|
-
Billing Engineer. Manages invoicing, payments, and financial reporting.
|
|
36
|
+
## Quick Reference by Task Type
|
|
21
37
|
|
|
22
|
-
###
|
|
23
|
-
|
|
38
|
+
### Planning & Research
|
|
39
|
+
- **PYTHIA** - Use BEFORE implementation for complex/unfamiliar work
|
|
24
40
|
|
|
25
|
-
###
|
|
26
|
-
|
|
41
|
+
### Code Implementation
|
|
42
|
+
- **NEXUS** - Backend services, APIs, business logic
|
|
43
|
+
- **ECHO** - Frontend JavaScript, client-side
|
|
44
|
+
- **CANVAS** - UI components, design systems
|
|
45
|
+
- **WEAVER** - Controllers, views, page actions
|
|
46
|
+
- **CIPHER** - Data transformations, utilities
|
|
27
47
|
|
|
28
|
-
|
|
48
|
+
### Data & Database
|
|
49
|
+
- **THOTH** - Complex queries, schema design
|
|
50
|
+
- **CHRONOS** - Database admin, caching, performance
|
|
51
|
+
- **MERIDIAN** - Schema migrations
|
|
29
52
|
|
|
30
|
-
###
|
|
31
|
-
|
|
53
|
+
### Quality & Security
|
|
54
|
+
- **AEGIS** - Code review, best practices
|
|
55
|
+
- **CRUCIBLE** - Testing, coverage
|
|
56
|
+
- **SENTINEL** - Security, validation, permissions
|
|
32
57
|
|
|
33
|
-
###
|
|
34
|
-
|
|
58
|
+
### Infrastructure & Ops
|
|
59
|
+
- **FORGE** - Scaffolding, DevOps, deployment
|
|
60
|
+
- **UNITY** - Git, version control, releases
|
|
61
|
+
|
|
62
|
+
### Documentation & Communication
|
|
63
|
+
- **CHRONICLE** - Comments, changelogs
|
|
64
|
+
- **SCRIBE** - API docs, technical writing
|
|
65
|
+
- **VOX** - Media, WebRTC, streaming
|
|
66
|
+
|
|
67
|
+
### Coordination
|
|
68
|
+
- **ARCHON** - Multi-agent orchestration
|
|
69
|
+
- **LEDGER** - Task tracking, progress management
|
|
70
|
+
- **ATLAS** - Codebase navigation, exploration
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Delegation Guidelines
|
|
75
|
+
|
|
76
|
+
1. **Check this roster** before delegating to ensure you pick the right specialist
|
|
77
|
+
2. **Provide context** - Include relevant files, patterns, and constraints
|
|
78
|
+
3. **Be specific** - Clear objectives get better results
|
|
79
|
+
4. **Consider dependencies** - Some tasks need sequential agents (e.g., THOTH before NEXUS for data-heavy APIs)
|
|
80
|
+
|
|
81
|
+
For full orchestration protocols, see [ARCHON](../../agents/archon.md).
|
|
@@ -8,27 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
When looking up coding standards for a specific language, follow this order:
|
|
10
10
|
|
|
11
|
-
1. **
|
|
12
|
-
|
|
11
|
+
1. **Project Standards (First Priority)**
|
|
12
|
+
Look for `docs/ai/standards/{language}.standards.md` in the project
|
|
13
13
|
- Example: `docs/ai/standards/php.standards.md`
|
|
14
|
-
- These are project-specific customizations
|
|
14
|
+
- These are project-specific customizations created by the user
|
|
15
15
|
|
|
16
|
-
2. **
|
|
17
|
-
Check `docs/ai/.context/templates/standards/{language}.standards.md`
|
|
18
|
-
- Example: `docs/ai/.context/templates/standards/php.standards.md`
|
|
19
|
-
- These are framework-provided defaults
|
|
20
|
-
|
|
21
|
-
3. **General Principles (Always Apply)**
|
|
16
|
+
2. **General Principles (Always Apply)**
|
|
22
17
|
The general principles below always apply regardless of language.
|
|
23
18
|
|
|
24
|
-
###
|
|
25
|
-
|
|
26
|
-
| Language | Template Location |
|
|
27
|
-
|----------|-------------------|
|
|
28
|
-
| PHP | `templates/standards/php.standards.md` |
|
|
29
|
-
| JavaScript/TypeScript | `templates/standards/javascript.standards.md` |
|
|
19
|
+
### Creating Language-Specific Standards
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
Use the [Standards Detector](../tools/standards-detector.md) to analyze your codebase and generate project-specific standards automatically.
|
|
32
22
|
|
|
33
23
|
---
|
|
34
24
|
|
|
@@ -149,18 +139,11 @@ ORDER BY column_name;
|
|
|
149
139
|
To customize standards for your project:
|
|
150
140
|
|
|
151
141
|
1. **Run Standards Detector** (recommended)
|
|
152
|
-
Have AI analyze your codebase using the [Standards Detector](../tools/standards-detector.
|
|
142
|
+
Have AI analyze your codebase using the [Standards Detector](../tools/standards-detector.md) tool.
|
|
153
143
|
This creates files in `docs/ai/standards/` based on your existing code.
|
|
154
144
|
|
|
155
|
-
2. **
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
cp docs/ai/.context/templates/standards/php.standards.md docs/ai/standards/
|
|
159
|
-
```
|
|
160
|
-
Then customize the placeholders.
|
|
161
|
-
|
|
162
|
-
3. **Create from Scratch**
|
|
163
|
-
Create `docs/ai/standards/{language}.standards.md` with your own format.
|
|
145
|
+
2. **Create from Scratch**
|
|
146
|
+
Create `docs/ai/standards/{language}.standards.md` with your own format following the patterns in this document.
|
|
164
147
|
|
|
165
148
|
### Common Customizations
|
|
166
149
|
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
# Project Context
|
|
2
2
|
|
|
3
|
-
> **Purpose:**
|
|
4
|
-
> **Directive:**
|
|
3
|
+
> **Purpose:** User-defined project context for AI assistants. This file contains project-specific identity, tech stack, and custom configurations.
|
|
4
|
+
> **Directive:** This file is linked from the framework entry point (`docs/ai/.contextuate/contextuate.md`). Edit this file freely to customize your project context.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## File Ownership
|
|
9
|
+
|
|
10
|
+
| Path | Owner | Editable? |
|
|
11
|
+
|------|-------|-----------|
|
|
12
|
+
| `docs/ai/.contextuate/` | Framework (Contextuate) | No - overwritten on updates |
|
|
13
|
+
| `docs/ai/context.md` | User (You) | Yes - customize freely |
|
|
14
|
+
| `docs/ai/agents/` | User | Yes - your custom agents |
|
|
15
|
+
| `docs/ai/standards/` | User | Yes - your custom standards |
|
|
16
|
+
| `docs/ai/quickrefs/` | User | Yes - your generated quickrefs |
|
|
17
|
+
| `docs/ai/tasks/` | User | Yes - your multi-session tasks |
|
|
18
|
+
|
|
19
|
+
The `.contextuate/` folder contains immutable framework definitions that bootstrap AI context loading. The framework entry point (`contextuate.md`) links to this file for project-specific details.
|
|
5
20
|
|
|
6
21
|
---
|
|
7
22
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
<!--
|
|
4
4
|
CONTEXTUATE MANAGED FILE - DO NOT MODIFY
|
|
5
|
-
This file is generated by the
|
|
5
|
+
This file is generated by the Contextuate Framework and will be overwritten during updates.
|
|
6
6
|
Customize your project context in: docs/ai/context.md
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
|
-
> **Purpose:** Master entry point for AI assistants. This file bootstraps the
|
|
9
|
+
> **Purpose:** Master entry point for AI assistants. This file bootstraps the Contextuate Framework.
|
|
10
10
|
> **Directive:** Read this file first, then follow instructions to load project context.
|
|
11
11
|
|
|
12
12
|
---
|
|
@@ -29,7 +29,7 @@ This folder (`docs/ai/.contextuate/`) contains the immutable framework definitio
|
|
|
29
29
|
2. **Select**: Identify the specific agent, tool, or standard relevant to your current task.
|
|
30
30
|
3. **Load**: Read only that specific file.
|
|
31
31
|
|
|
32
|
-
For example, if you need to create a new agent, read `docs/ai/.contextuate/tools/agent-creator.
|
|
32
|
+
For example, if you need to create a new agent, read `docs/ai/.contextuate/tools/agent-creator.md`. You do not need to read the entire standards library unless you are writing code that specifically requires it.
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
@@ -40,9 +40,9 @@ For example, if you need to create a new agent, read `docs/ai/.contextuate/tools
|
|
|
40
40
|
### Agent Registry
|
|
41
41
|
| Task Domain | Agent | Context File |
|
|
42
42
|
| -------------- | ------------ | ---------------------------------------------------------------------------------------- |
|
|
43
|
-
| General Coding | Base Agent | [
|
|
44
|
-
| Documentation | Docs Expert | [
|
|
45
|
-
| Tools Expert | Tools Expert | [
|
|
43
|
+
| General Coding | Base Agent | [agents/base.md](agents/base.md) |
|
|
44
|
+
| Documentation | Docs Expert | [agents/documentation-expert.md](agents/documentation-expert.md) |
|
|
45
|
+
| Tools Expert | Tools Expert | [agents/tools-expert.md](agents/tools-expert.md) |
|
|
46
46
|
|
|
47
47
|
### Custom Agents
|
|
48
48
|
Custom agents are stored in `docs/ai/agents/`. Create new agents using the Agent Creator tool.
|
|
@@ -54,29 +54,25 @@ Custom agents are stored in `docs/ai/agents/`. Create new agents using the Agent
|
|
|
54
54
|
### Framework Tools
|
|
55
55
|
| Tool | Purpose | Instruction Guide |
|
|
56
56
|
| ---------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
57
|
-
| **Standards Detector** | Analyze code to find patterns | [
|
|
58
|
-
| **Quickref Generator** | Condense docs for AI usage | [
|
|
59
|
-
| **Agent Creator** | Generate new agent personas | [
|
|
57
|
+
| **Standards Detector** | Analyze code to find patterns | [tools/standards-detector.md](tools/standards-detector.md) |
|
|
58
|
+
| **Quickref Generator** | Condense docs for AI usage | [tools/quickref.md](tools/quickref.md) |
|
|
59
|
+
| **Agent Creator** | Generate new agent personas | [tools/agent-creator.md](tools/agent-creator.md) |
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
63
|
## 4. Standards & Conventions
|
|
64
64
|
|
|
65
|
-
###
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
65
|
+
### Framework Standards
|
|
66
|
+
| Standard | Purpose | File |
|
|
67
|
+
|----------|---------|------|
|
|
68
|
+
| **Coding Standards** | General coding principles | [standards/coding-standards.md](standards/coding-standards.md) |
|
|
69
|
+
| **Behavioral Guidelines** | AI interaction rules | [standards/behavioral-guidelines.md](standards/behavioral-guidelines.md) |
|
|
70
|
+
| **Task Workflow** | Multi-session task structure | [standards/task-workflow.md](standards/task-workflow.md) |
|
|
71
|
+
| **Agent Workflow** | Multi-agent coordination | [standards/agent-workflow.md](standards/agent-workflow.md) |
|
|
72
|
+
| **Agent Roles** | Specialist agent roster | [standards/agent-roles.md](standards/agent-roles.md) |
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### Behavioral Guidelines
|
|
77
|
-
**[Behavioral Guidelines](.contextuate/standards/behavioral-guidelines.md)**
|
|
78
|
-
- Verified Truth: Do not speculate.
|
|
79
|
-
- Minimal Intervention: Only change what is requested.
|
|
74
|
+
### Project-Specific Standards
|
|
75
|
+
Create language-specific standards in `docs/ai/standards/` using the [Standards Detector](tools/standards-detector.md) tool.
|
|
80
76
|
|
|
81
77
|
---
|
|
82
78
|
|
|
@@ -94,16 +90,13 @@ Custom standards can be added in `docs/ai/standards/`.
|
|
|
94
90
|
| **Custom Commands** | `docs/ai/commands/` |
|
|
95
91
|
|
|
96
92
|
### Multi-Session Tasks
|
|
97
|
-
For complex tasks that span multiple sessions
|
|
98
|
-
1. Read **[Task Workflow](.contextuate/standards/task-workflow.md)**.
|
|
99
|
-
2. Create a folder in `docs/ai/tasks/{task-name}/`.
|
|
100
|
-
3. Maintain a `00-project-scope.md` and log files.
|
|
93
|
+
For complex tasks that span multiple sessions, follow the Task Workflow standard (see section 4).
|
|
101
94
|
|
|
102
95
|
---
|
|
103
96
|
|
|
104
97
|
## 6. Framework Information
|
|
105
98
|
|
|
106
|
-
**
|
|
99
|
+
**Contextuate Framework** is a standardized AI context framework.
|
|
107
100
|
|
|
108
101
|
- **Documentation:** https://contextuate.md
|
|
109
102
|
- **Version:** Check `.contextuate/version.json`
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Go Coding Standards
|
|
2
|
+
|
|
3
|
+
> **Language:** Go
|
|
4
|
+
> **Generated:** {DATE}
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Formatting
|
|
9
|
+
|
|
10
|
+
### Tooling
|
|
11
|
+
- **Required:** `gofmt` (or `goimports`) must be applied to all files.
|
|
12
|
+
|
|
13
|
+
### Indentation
|
|
14
|
+
- **Style:** Tabs (Standard Go behavior)
|
|
15
|
+
|
|
16
|
+
### Line Length
|
|
17
|
+
- **Guideline:** No strict limit, but prefer readability (80-120 chars).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Naming Conventions
|
|
22
|
+
|
|
23
|
+
### General Rule
|
|
24
|
+
- Use `MixedCaps` or `mixedCaps` (CamelCase).
|
|
25
|
+
- Keep names short and concise.
|
|
26
|
+
|
|
27
|
+
### Packages
|
|
28
|
+
- **Style:** lowercase, single word
|
|
29
|
+
- **Avoid:** snake_case, camelCase in package names
|
|
30
|
+
- **Example:** `package user`, not `package user_service`
|
|
31
|
+
|
|
32
|
+
### Interfaces
|
|
33
|
+
- **Style:** Method name + "er" (if single method)
|
|
34
|
+
- **Example:** `Reader`, `Writer`, `Formatter`
|
|
35
|
+
|
|
36
|
+
### Structs/Interfaces
|
|
37
|
+
- **Exported:** PascalCase (`User`)
|
|
38
|
+
- **Unexported:** camelCase (`userHelper`)
|
|
39
|
+
|
|
40
|
+
### Functions/Methods
|
|
41
|
+
- **Exported:** PascalCase (`GetUser`)
|
|
42
|
+
- **Unexported:** camelCase (`parseData`)
|
|
43
|
+
|
|
44
|
+
### Constants
|
|
45
|
+
- **Style:** PascalCase (for exported) or camelCase
|
|
46
|
+
- **Avoid:** UPPER_SNAKE_CASE (unlike other languages)
|
|
47
|
+
- **Example:** `MaxRetries`, not `MAX_RETRIES`
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Structure
|
|
52
|
+
|
|
53
|
+
### File Organization
|
|
54
|
+
```go
|
|
55
|
+
package main
|
|
56
|
+
|
|
57
|
+
// 1. Imports (grouped: stdlib, third-party, local)
|
|
58
|
+
import (
|
|
59
|
+
"fmt"
|
|
60
|
+
"os"
|
|
61
|
+
|
|
62
|
+
"github.com/pkg/errors"
|
|
63
|
+
|
|
64
|
+
"myproject/internal/user"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
// 2. Constants
|
|
68
|
+
const DefaultTimeout = 30
|
|
69
|
+
|
|
70
|
+
// 3. Types (Structs/Interfaces)
|
|
71
|
+
type Service interface {
|
|
72
|
+
Do() error
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 4. Factory Functions
|
|
76
|
+
func NewService() Service {
|
|
77
|
+
return &serviceImpl{}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 5. Methods
|
|
81
|
+
func (s *serviceImpl) Do() error {
|
|
82
|
+
return nil
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Error Handling
|
|
89
|
+
|
|
90
|
+
### Pattern
|
|
91
|
+
- **Style:** Check errors immediately. Avoid nesting.
|
|
92
|
+
|
|
93
|
+
```go
|
|
94
|
+
// GOOD
|
|
95
|
+
f, err := os.Open("file.txt")
|
|
96
|
+
if err != nil {
|
|
97
|
+
return err
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// BAD
|
|
101
|
+
if f, err := os.Open("file.txt"); err == nil {
|
|
102
|
+
// ...
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Wrapping
|
|
107
|
+
- **Guideline:** Wrap errors with context when passing up the stack.
|
|
108
|
+
- **Example:** `fmt.Errorf("failed to open config: %w", err)`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Documentation
|
|
113
|
+
|
|
114
|
+
### Comments
|
|
115
|
+
- **Exported identifiers:** MUST have a doc comment starting with the name.
|
|
116
|
+
- **Format:** Complete sentences.
|
|
117
|
+
|
|
118
|
+
```go
|
|
119
|
+
// User represents a system user.
|
|
120
|
+
type User struct { ... }
|
|
121
|
+
|
|
122
|
+
// Fetch retrieves the user by ID.
|
|
123
|
+
func (u *User) Fetch(id int) error { ... }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Common Patterns
|
|
129
|
+
|
|
130
|
+
### Options Pattern
|
|
131
|
+
```go
|
|
132
|
+
// Preferred for complex constructors
|
|
133
|
+
type Option func(*Server)
|
|
134
|
+
|
|
135
|
+
func WithPort(port int) Option {
|
|
136
|
+
return func(s *Server) { s.port = port }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
func NewServer(opts ...Option) *Server { ... }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Context
|
|
143
|
+
- **Guideline:** Pass `context.Context` as the first argument to functions performing I/O.
|
|
144
|
+
|
|
145
|
+
```go
|
|
146
|
+
func (s *Service) GetData(ctx context.Context, id string) error { ... }
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Anti-Patterns
|
|
152
|
+
|
|
153
|
+
```go
|
|
154
|
+
// BAD: Panic in libraries
|
|
155
|
+
func Parse() {
|
|
156
|
+
if err != nil {
|
|
157
|
+
panic(err) // Return error instead
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// BAD: Global state
|
|
162
|
+
var db *sql.DB // Use dependency injection
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
*This file should be customized for your project. Replace placeholders with actual values.*
|