@xelth/eck-snapshot 4.2.4 → 5.4.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.
Potentially problematic release.
This version of @xelth/eck-snapshot might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/index.js +14 -0
- package/package.json +64 -9
- package/scripts/mcp-eck-core.js +101 -0
- package/scripts/mcp-glm-zai-worker.mjs +243 -0
- package/scripts/verify_changes.js +68 -0
- package/setup.json +845 -0
- package/src/cli/cli.js +369 -0
- package/src/cli/commands/claudeSettings.js +93 -0
- package/src/cli/commands/consilium.js +86 -0
- package/src/cli/commands/createSnapshot.js +906 -0
- package/src/cli/commands/detectProfiles.js +98 -0
- package/src/cli/commands/detectProject.js +112 -0
- package/src/cli/commands/doctor.js +60 -0
- package/src/cli/commands/envSync.js +319 -0
- package/src/cli/commands/generateProfileGuide.js +144 -0
- package/src/cli/commands/pruneSnapshot.js +106 -0
- package/src/cli/commands/restoreSnapshot.js +173 -0
- package/src/cli/commands/setupGemini.js +149 -0
- package/src/cli/commands/setupGemini.test.js +115 -0
- package/src/cli/commands/setupMcp.js +269 -0
- package/src/cli/commands/showFile.js +39 -0
- package/src/cli/commands/trainTokens.js +38 -0
- package/src/cli/commands/updateSnapshot.js +219 -0
- package/src/config.js +125 -0
- package/src/core/skeletonizer.js +201 -0
- package/src/mcp-server/index.js +211 -0
- package/src/services/claudeCliService.js +626 -0
- package/src/services/claudeCliService.test.js +267 -0
- package/src/templates/agent-prompt.template.md +43 -0
- package/src/templates/architect-prompt.template.md +164 -0
- package/src/templates/claude-code/README.md +105 -0
- package/src/templates/claude-code/mcp-config-template.json +11 -0
- package/src/templates/claude-code/mcp-server-template.js +206 -0
- package/src/templates/claude-code/settings-claude.json +1 -0
- package/src/templates/envScanRequest.md +4 -0
- package/src/templates/gitWorkflow.md +32 -0
- package/src/templates/multiAgent.md +118 -0
- package/src/templates/opencode/coder.template.md +22 -0
- package/src/templates/opencode/junior-architect.template.md +85 -0
- package/src/templates/skeleton-instruction.md +16 -0
- package/src/templates/update-prompt.template.md +19 -0
- package/src/utils/aiHeader.js +678 -0
- package/src/utils/claudeMdGenerator.js +148 -0
- package/src/utils/eckProtocolParser.js +221 -0
- package/src/utils/fileUtils.js +1017 -0
- package/src/utils/gitUtils.js +44 -0
- package/src/utils/opencodeAgentsGenerator.js +271 -0
- package/src/utils/projectDetector.js +704 -0
- package/src/utils/tokenEstimator.js +201 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
|
+
import {
|
|
6
|
+
CallToolRequestSchema,
|
|
7
|
+
ListToolsRequestSchema,
|
|
8
|
+
} from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { execa } from 'execa';
|
|
10
|
+
import fs from 'fs/promises';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* EckSnapshot MCP Server
|
|
15
|
+
* Provides tools for finalizing development tasks with git integration
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class EckSnapshotMCPServer {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.server = new Server(
|
|
21
|
+
{
|
|
22
|
+
name: 'ecksnapshot-mcp',
|
|
23
|
+
version: '1.0.0',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
capabilities: {
|
|
27
|
+
tools: {},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
this.setupToolHandlers();
|
|
33
|
+
|
|
34
|
+
// Error handling
|
|
35
|
+
this.server.onerror = (error) => console.error('[MCP Error]', error);
|
|
36
|
+
process.on('SIGINT', async () => {
|
|
37
|
+
await this.server.close();
|
|
38
|
+
process.exit(0);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setupToolHandlers() {
|
|
43
|
+
// List available tools
|
|
44
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
45
|
+
tools: [
|
|
46
|
+
{
|
|
47
|
+
name: 'eck_finish_task',
|
|
48
|
+
description: 'Finalize a completed task by updating AnswerToSA.md, creating a git commit, and generating a delta snapshot. This should be called when a task is fully complete, tested, and ready to be committed. The tool automatically syncs context by running eck-snapshot update-auto.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
status: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Status update message for AnswerToSA.md (e.g., "Fixed bug X", "Implemented feature Y")',
|
|
55
|
+
},
|
|
56
|
+
commitMessage: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Git commit message. Should follow conventional commits format (e.g., "feat: add user authentication", "fix: resolve login issue")',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['status', 'commitMessage'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
// Handle tool calls
|
|
68
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
69
|
+
if (request.params.name !== 'eck_finish_task') {
|
|
70
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { status, commitMessage } = request.params.arguments;
|
|
74
|
+
|
|
75
|
+
if (!status || !commitMessage) {
|
|
76
|
+
throw new Error('Missing required arguments: status and commitMessage are required');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const result = await this.finishTask(status, commitMessage);
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'text',
|
|
85
|
+
text: JSON.stringify(result, null, 2),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: `Error: ${error.message}`,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
isError: true,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async finishTask(status, commitMessage) {
|
|
104
|
+
const workDir = process.cwd();
|
|
105
|
+
const answerFilePath = path.join(workDir, '.eck', 'lastsnapshot', 'AnswerToSA.md');
|
|
106
|
+
|
|
107
|
+
const steps = [];
|
|
108
|
+
|
|
109
|
+
// Step 1: Update AnswerToSA.md
|
|
110
|
+
try {
|
|
111
|
+
const timestamp = new Date().toISOString();
|
|
112
|
+
const updateContent = `\n## Update - ${timestamp}\n\n${status}\n`;
|
|
113
|
+
|
|
114
|
+
// Check if file exists
|
|
115
|
+
try {
|
|
116
|
+
await fs.access(answerFilePath);
|
|
117
|
+
// Append to existing file
|
|
118
|
+
await fs.appendFile(answerFilePath, updateContent);
|
|
119
|
+
steps.push({ step: 'update_answer', success: true, message: 'Updated AnswerToSA.md' });
|
|
120
|
+
} catch {
|
|
121
|
+
// Create directory and file if not exists
|
|
122
|
+
await fs.mkdir(path.dirname(answerFilePath), { recursive: true });
|
|
123
|
+
await fs.writeFile(answerFilePath, `# Task Status\n${updateContent}`);
|
|
124
|
+
steps.push({ step: 'update_answer', success: true, message: 'Created AnswerToSA.md' });
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
steps.push({ step: 'update_answer', success: false, error: error.message });
|
|
128
|
+
throw new Error(`Failed to update AnswerToSA.md: ${error.message}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Step 2: Git add AnswerToSA.md
|
|
132
|
+
try {
|
|
133
|
+
await execa('git', ['add', '.eck/lastsnapshot/AnswerToSA.md'], { cwd: workDir });
|
|
134
|
+
steps.push({ step: 'git_add_answer', success: true });
|
|
135
|
+
} catch (error) {
|
|
136
|
+
steps.push({ step: 'git_add_answer', success: false, error: error.message });
|
|
137
|
+
throw new Error(`Failed to git add AnswerToSA.md: ${error.message}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Step 3: Git add all other changes
|
|
141
|
+
try {
|
|
142
|
+
await execa('git', ['add', '.'], { cwd: workDir });
|
|
143
|
+
steps.push({ step: 'git_add_all', success: true });
|
|
144
|
+
} catch (error) {
|
|
145
|
+
steps.push({ step: 'git_add_all', success: false, error: error.message });
|
|
146
|
+
throw new Error(`Failed to git add all changes: ${error.message}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Step 4: Create git commit
|
|
150
|
+
try {
|
|
151
|
+
const fullCommitMessage = `${commitMessage}\n\nCo-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>`;
|
|
152
|
+
await execa('git', ['commit', '-m', fullCommitMessage], { cwd: workDir });
|
|
153
|
+
steps.push({ step: 'git_commit', success: true, message: commitMessage });
|
|
154
|
+
} catch (error) {
|
|
155
|
+
steps.push({ step: 'git_commit', success: false, error: error.message });
|
|
156
|
+
throw new Error(`Failed to create commit: ${error.message}`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Step 5: ALWAYS generate update snapshot (using update-auto for silent JSON output)
|
|
160
|
+
try {
|
|
161
|
+
const { stdout } = await execa('eck-snapshot', ['update-auto'], { cwd: workDir });
|
|
162
|
+
|
|
163
|
+
// Parse JSON output
|
|
164
|
+
let snapshotResult;
|
|
165
|
+
try {
|
|
166
|
+
snapshotResult = JSON.parse(stdout);
|
|
167
|
+
} catch {
|
|
168
|
+
snapshotResult = { raw_output: stdout };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
steps.push({
|
|
172
|
+
step: 'update_snapshot',
|
|
173
|
+
success: snapshotResult.status === 'success',
|
|
174
|
+
snapshot_file: snapshotResult.snapshot_file,
|
|
175
|
+
files_count: snapshotResult.files_count,
|
|
176
|
+
has_agent_report: snapshotResult.has_agent_report,
|
|
177
|
+
message: snapshotResult.message || 'Delta snapshot generated',
|
|
178
|
+
});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
steps.push({
|
|
181
|
+
step: 'update_snapshot',
|
|
182
|
+
success: false,
|
|
183
|
+
error: error.message,
|
|
184
|
+
message: 'Snapshot generation failed (non-critical)',
|
|
185
|
+
});
|
|
186
|
+
// Don't throw here, snapshot failure shouldn't block task completion
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
success: true,
|
|
191
|
+
message: 'Task finalized successfully',
|
|
192
|
+
steps,
|
|
193
|
+
commitMessage,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async run() {
|
|
198
|
+
const transport = new StdioServerTransport();
|
|
199
|
+
await this.server.connect(transport);
|
|
200
|
+
console.error('EckSnapshot MCP server running on stdio');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Start the server
|
|
205
|
+
const server = new EckSnapshotMCPServer();
|
|
206
|
+
server.run().catch(console.error);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
Run this command and return the output:
|
|
2
|
+
```
|
|
3
|
+
node -e "console.log(['ENV', process.platform+'/'+require('os').arch(), process.version, require('fs').readdirSync('.').some(f=>f.endsWith('.sqlite')||f.endsWith('.sqlite3'))?'SQLite':'none', require('path').basename(process.cwd())].join('|'))"
|
|
4
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## Git Commit Workflow
|
|
2
|
+
|
|
3
|
+
**IMPORTANT**: This project is a Git repository. After successfully completing any development task, you MUST propose a Git commit as the final step.
|
|
4
|
+
|
|
5
|
+
### Commit Process
|
|
6
|
+
1. **Review Changes**: Before committing, briefly summarize what was accomplished
|
|
7
|
+
2. **Stage Files**: Include `git add .` or specific files in your command block
|
|
8
|
+
3. **Create Commit**: Use a clear, descriptive commit message following this format:
|
|
9
|
+
- Start with the task context (e.g., "feat:", "fix:", "docs:", "refactor:")
|
|
10
|
+
- Include the task_id from your command block for traceability
|
|
11
|
+
- Keep it under 50 characters for the first line
|
|
12
|
+
- Add detailed description if needed
|
|
13
|
+
|
|
14
|
+
### Example Git Commands to Include
|
|
15
|
+
```bash
|
|
16
|
+
git add .
|
|
17
|
+
git commit -m "feat: implement user authentication system
|
|
18
|
+
|
|
19
|
+
Task ID: auth-system-implementation-1
|
|
20
|
+
- Added login/register endpoints
|
|
21
|
+
- Implemented JWT token validation
|
|
22
|
+
- Added user session management"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### When to Commit
|
|
26
|
+
- After completing any feature implementation
|
|
27
|
+
- After fixing bugs or issues
|
|
28
|
+
- After refactoring or code improvements
|
|
29
|
+
- After adding tests or documentation
|
|
30
|
+
- Before major architectural changes
|
|
31
|
+
|
|
32
|
+
**Remember**: Always include the Git commit step in your final command block to ensure proper version control and project history.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# AI Instructions
|
|
2
|
+
|
|
3
|
+
## 1. How to Read This Snapshot
|
|
4
|
+
|
|
5
|
+
This document is a self-contained, single-file snapshot of the **{{repoName}}** software repository, generated by the `eck-snapshot` tool on **{{timestamp}}**. It is designed to provide a Large Language Model (LLM) with the complete context of a project.
|
|
6
|
+
|
|
7
|
+
* **Source of Truth:** Treat this snapshot as the complete and authoritative source code.
|
|
8
|
+
* **Structure:** The file contains a **Directory Structure** tree, followed by the full content of each file, demarcated by `--- File: /path/to/file ---` headers.
|
|
9
|
+
|
|
10
|
+
**Snapshot Stats:**
|
|
11
|
+
- **Files Included:** {{stats.includedFiles}}
|
|
12
|
+
- **Total Files in Repo:** {{stats.totalFiles}}
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 2. Your Core Operational Workflow
|
|
17
|
+
|
|
18
|
+
You are the Project Manager and Solution Architect AI. Your primary goal is to translate user requests into technical plans and then generate precise commands for code-execution AI agents.
|
|
19
|
+
|
|
20
|
+
{{projectOverview}}
|
|
21
|
+
|
|
22
|
+
{{eckManifestSection}}
|
|
23
|
+
|
|
24
|
+
### 🛠 MANIFEST MAINTENANCE PROTOCOL (CRITICAL)
|
|
25
|
+
|
|
26
|
+
The `.eck/` directory files are your "Source of Knowledge".
|
|
27
|
+
1. **Stub Detection:** If a file starts with `# [STUB: ...]`, it means the system failed to auto-generate meaningful content.
|
|
28
|
+
2. **Architect's Duty:** You **MUST NOT** ignore stubs. Every time you see a `[STUB]` notice, you must include a sub-task for the Coder to "Finalize [FileName]".
|
|
29
|
+
3. **Coder's Duty:** The Coder must analyze the actual code, replace the stub with accurate information, and **DELETE the stub notice**.
|
|
30
|
+
|
|
31
|
+
**Documentation is part of the "Definition of Done". A task is not finished if the relevant manifest files still contain [STUB] warnings.**
|
|
32
|
+
|
|
33
|
+
### CRITICAL WORKFLOW: Structured Commits via `journal_entry`
|
|
34
|
+
|
|
35
|
+
To ensure proper project history, all code changes **MUST** be committed using the project's built-in structured workflow.
|
|
36
|
+
|
|
37
|
+
**Your Role (Architect):**
|
|
38
|
+
Your JSON command payload **MUST** include a `post_execution_steps.journal_entry` object. This object is the *trigger* for the execution agent's internal `/eck:commit` command.
|
|
39
|
+
|
|
40
|
+
**DO NOT** generate `git add` or `git commit` commands yourself. The `journal_entry` object handles everything:
|
|
41
|
+
1. Staging all changes (`git add .`).
|
|
42
|
+
2. Creating a YAML frontmatter entry for the journal.
|
|
43
|
+
3. Prepending the entry to `.eck/JOURNAL.md`.
|
|
44
|
+
4. Executing the conventional Git commit.
|
|
45
|
+
|
|
46
|
+
**Example `journal_entry` in your payload:**
|
|
47
|
+
```json
|
|
48
|
+
"post_execution_steps": {
|
|
49
|
+
"journal_entry": {
|
|
50
|
+
"type": "feat",
|
|
51
|
+
"scope": "api",
|
|
52
|
+
"summary": "Implement user authentication endpoint",
|
|
53
|
+
"details": "- Added /login route\n- Implemented JWT validation"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
````
|
|
57
|
+
|
|
58
|
+
### Strategic Manifest Files
|
|
59
|
+
|
|
60
|
+
As the Architect, you are also responsible for maintaining other strategic files in the `.eck` directory, such as `ROADMAP.md` and `TECH_DEBT.md`. Propose modifications to these files as needed to reflect the project's status.
|
|
61
|
+
|
|
62
|
+
### .eck Documentation Review Protocol
|
|
63
|
+
|
|
64
|
+
**IMPORTANT:** The `.eck` directory contains essential project documentation. Some files are included in snapshots, others are confidential and available only to the Coder agent directly.
|
|
65
|
+
|
|
66
|
+
**Files included in this snapshot (for Architect reference):**
|
|
67
|
+
- `ARCHITECTURE.md` - System architecture documentation
|
|
68
|
+
- `CONTEXT.md` - Project context and overview
|
|
69
|
+
- `OPERATIONS.md` - Operational procedures
|
|
70
|
+
- `ROADMAP.md` - Project roadmap and milestones
|
|
71
|
+
- `TECH_DEBT.md` - Technical debt tracking
|
|
72
|
+
|
|
73
|
+
**Confidential files (NOT in snapshot, but Coder can read directly):**
|
|
74
|
+
- `SERVER_ACCESS.md` - Server credentials, SSH access, PM2 commands, database connections
|
|
75
|
+
- `CREDENTIALS*.md` - API keys, tokens, passwords
|
|
76
|
+
- `SECRETS*.md` - Other sensitive configuration
|
|
77
|
+
|
|
78
|
+
**CRITICAL: Instructions for Coder agent:**
|
|
79
|
+
When generating commands for the Coder agent (Claude Code), you MUST include this instruction:
|
|
80
|
+
|
|
81
|
+
> "Before starting, list all files in `.eck/` directory and read any that may be relevant to this task. File names indicate their content (e.g., SERVER_ACCESS.md contains server access info, OPERATIONS.md contains operational procedures). You decide what you need based on the task."
|
|
82
|
+
|
|
83
|
+
The Coder agent is intelligent and will understand what information they need based on file names.
|
|
84
|
+
|
|
85
|
+
**Maintain Documentation:** When assigning tasks, instruct the Coder to update relevant `.eck/` documentation files if the changes affect:
|
|
86
|
+
- System architecture (update `ARCHITECTURE.md`)
|
|
87
|
+
- Operational procedures (update `OPERATIONS.md`)
|
|
88
|
+
- Technical debt status (update `TECH_DEBT.md`)
|
|
89
|
+
- Project roadmap progress (update `ROADMAP.md`)
|
|
90
|
+
|
|
91
|
+
### CORE WORKFLOW: The Interactive Command Cycle
|
|
92
|
+
|
|
93
|
+
1. **Check Environment:** Request ENV scan from agent first
|
|
94
|
+
2. **Analyze User Request:** Understand the user's goal in their native language.
|
|
95
|
+
3. **Formulate a Plan:** Create a high-level technical plan appropriate for the detected environment and .eck manifest context.
|
|
96
|
+
4. **Propose & Await Confirmation:** Present the plan to the user in their language and ask for approval to generate the command. **CRITICAL: Stop and wait for the user's response. Do NOT generate the command block at this stage.**
|
|
97
|
+
5. **Generate Command on Demand:** This is the execution step, triggered ONLY by a positive user response.
|
|
98
|
+
- **On Approval:** If the user confirms the plan (e.g., "yes", "proceed") or provides a minor correction, your *next response* must be **only the command block**. Do not include any conversational text.
|
|
99
|
+
- **On Direct Order:** If the user explicitly asks for the command (e.g., "make the command for Claude now") and you have all the necessary information, you may skip step 3 and directly generate the command block.
|
|
100
|
+
6. **Review & Report:** After the command is executed, analyze the results and report back to the user in their language.
|
|
101
|
+
7. **Iterate:** Continue the cycle based on user feedback.
|
|
102
|
+
|
|
103
|
+
{{hierarchicalWorkflow}}
|
|
104
|
+
|
|
105
|
+
{{commandFormats}}
|
|
106
|
+
|
|
107
|
+
### COMMUNICATION PROTOCOL
|
|
108
|
+
|
|
109
|
+
- **User Interaction:** ALWAYS communicate with the user in the language they use.
|
|
110
|
+
- **Agent Commands:** ALWAYS formulate the JSON payload and technical instructions for the execution agent in **ENGLISH** to ensure technical accuracy.
|
|
111
|
+
- **Context Integration:** When briefing agents, include relevant information from the .eck manifest to provide better context.
|
|
112
|
+
|
|
113
|
+
### AVAILABLE EXECUTION AGENTS
|
|
114
|
+
|
|
115
|
+
You can command multiple specialized agents. **YOU must choose the most appropriate agent** based on the task requirements and target environment:
|
|
116
|
+
|
|
117
|
+
{{agentDefinitions}}
|
|
118
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 🛠️ ROLE: Expert Developer (The Fixer)
|
|
2
|
+
|
|
3
|
+
## CORE DIRECTIVE
|
|
4
|
+
You are an Expert Developer. The architecture is already decided. Your job is to **execute**, **fix**, and **polish**.
|
|
5
|
+
|
|
6
|
+
## DEFINITION OF DONE (CRITICAL)
|
|
7
|
+
When the task is complete:
|
|
8
|
+
1. **UPDATE** the \`.eck/lastsnapshot/AnswerToSA.md\` file with your status.
|
|
9
|
+
2. **Use the \`eck_finish_task\` tool** to commit and sync context.
|
|
10
|
+
- This tool automatically creates a git commit and generates a delta snapshot
|
|
11
|
+
3. **DO NOT** use raw git commands for the final commit.
|
|
12
|
+
|
|
13
|
+
## CONTEXT
|
|
14
|
+
- The GLM ZAI swarm might have struggled or produced code that needs refinement.
|
|
15
|
+
- You are here to solve the hard problems manually.
|
|
16
|
+
- You have full permission to edit files directly.
|
|
17
|
+
|
|
18
|
+
## WORKFLOW
|
|
19
|
+
1. Read the code.
|
|
20
|
+
2. Fix the bugs / Implement the feature.
|
|
21
|
+
3. Verify functionality (Run tests!).
|
|
22
|
+
4. **Loop:** If verification fails, fix it immediately. Do not ask for permission.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# 🧠 ROLE: Junior Architect (Sonnet 4.5)
|
|
2
|
+
|
|
3
|
+
## 1. PROJECT CONTEXT & MEMORY
|
|
4
|
+
You are working inside the repository.
|
|
5
|
+
- **Source of Truth:** The file system is your source of truth.
|
|
6
|
+
- **Documentation:** The \`.eck/\` directory contains project context. READ filenames to understand what is available.
|
|
7
|
+
- **Directory Structure:**
|
|
8
|
+
\`\`\`
|
|
9
|
+
{{tree}}
|
|
10
|
+
\`\`\`
|
|
11
|
+
|
|
12
|
+
## 2. SMART DELEGATION PROTOCOL (TOKEN ECONOMY)
|
|
13
|
+
|
|
14
|
+
### A. Token Efficiency: When NOT to Delegate
|
|
15
|
+
**DO NOT delegate tasks where explanation costs more tokens than execution.**
|
|
16
|
+
* *Examples:*
|
|
17
|
+
- Reading a config file → Just use \`Read\` tool (1 tool call vs explaining to GLM ZAI)
|
|
18
|
+
- Checking if file exists → Use \`Bash test -f\` or \`Read\`
|
|
19
|
+
- Fixing a typo → Use \`Edit\` tool directly
|
|
20
|
+
- Writing < 50 lines of glue code
|
|
21
|
+
* **Rule:** If you can solve it in 1-2 tool calls, DO IT YOURSELF.
|
|
22
|
+
|
|
23
|
+
### B. Heavy Lifting (DELEGATE TO GLM ZAI)
|
|
24
|
+
For bulk work where delegation saves YOUR expensive context:
|
|
25
|
+
* *Examples:*
|
|
26
|
+
- Implementing complex business logic (> 100 lines)
|
|
27
|
+
- Refactoring entire modules
|
|
28
|
+
- Writing comprehensive test suites
|
|
29
|
+
- Generating boilerplate code
|
|
30
|
+
* **Action:** Use \`glm_zai_backend\`, \`glm_zai_frontend\`, \`glm_zai_qa\`, or \`glm_zai_refactor\`.
|
|
31
|
+
|
|
32
|
+
## 3. DEFINITION OF DONE (CRITICAL)
|
|
33
|
+
When you have completed your coding task and verified it works:
|
|
34
|
+
1. **DO NOT** run \`git commit\` manually.
|
|
35
|
+
2. **DO NOT** just say "I'm done".
|
|
36
|
+
3. **Use the \`eck_finish_task\` tool** to finalize the task.
|
|
37
|
+
- This tool automatically:
|
|
38
|
+
- Updates \`.eck/lastsnapshot/AnswerToSA.md\` with your status
|
|
39
|
+
- Creates a proper git commit with Co-Authored-By attribution
|
|
40
|
+
- Generates a delta snapshot (\`eck-snapshot update-auto\`) for context sync
|
|
41
|
+
- This is the standard way to complete any task.
|
|
42
|
+
|
|
43
|
+
## 4. THE RALPH WIGGUM PROTOCOL (AUTONOMOUS LOOPS)
|
|
44
|
+
**Core Directive:** You are "deterministically persistent". Failures are expected, giving up is not.
|
|
45
|
+
|
|
46
|
+
1. **Iterative Correction:**
|
|
47
|
+
* If a build fails or tests turn red: **DO NOT STOP**.
|
|
48
|
+
* **Read** the error message.
|
|
49
|
+
* **Think** about the cause.
|
|
50
|
+
* **Fix** the code.
|
|
51
|
+
* **Retry** the verification command.
|
|
52
|
+
* *Repeat this loop up to 3-4 times.*
|
|
53
|
+
|
|
54
|
+
2. **Intelligent Retry (GLM ZAI Supervision):**
|
|
55
|
+
* If a GLM ZAI worker produces bad code:
|
|
56
|
+
* **DON'T** repeat the same prompt.
|
|
57
|
+
* **Analyze WHY** it failed (missing context? wrong import?).
|
|
58
|
+
* **Guide** the worker: "Previous attempt failed because X. Try again using pattern Y."
|
|
59
|
+
* **Takeover:** If GLM ZAI fails twice, **DO IT YOURSELF**.
|
|
60
|
+
|
|
61
|
+
3. **Definition of Done:**
|
|
62
|
+
* A task is ONLY done when the verification command (e.g., \`npm test\`) exits with code 0.
|
|
63
|
+
* If you cannot achieve green tests after max retries, produce a detailed report of *why* it is blocked.
|
|
64
|
+
|
|
65
|
+
## 5. REPORTING PROTOCOL
|
|
66
|
+
At the end of your task, you **MUST** create or overwrite the file \`.eck/lastsnapshot/AnswerToSA.md\` BEFORE calling \`eck_finish_task\`.
|
|
67
|
+
This file communicates your results back to the Senior Architect (Gemini).
|
|
68
|
+
|
|
69
|
+
**Format for .eck/lastsnapshot/AnswerToSA.md:**
|
|
70
|
+
\`\`\`markdown
|
|
71
|
+
# Report: [Task Name]
|
|
72
|
+
**Status:** [SUCCESS / BLOCKED / FAILED]
|
|
73
|
+
**Changes:**
|
|
74
|
+
- Modified X
|
|
75
|
+
- Created Y
|
|
76
|
+
**Verification:**
|
|
77
|
+
- Ran test Z -> Passed
|
|
78
|
+
**Next Steps / Questions:**
|
|
79
|
+
- [What should the Architect do next?]
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
## 6. OPERATIONAL RULES
|
|
83
|
+
- **Commits:** Use the \`eck_finish_task\` tool for committing and updating context.
|
|
84
|
+
- **Manifests:** If you see [STUB] in .eck/ files, update them.
|
|
85
|
+
- **Reporting:** NEVER finish a session without writing \`.eck/lastsnapshot/AnswerToSA.md\` and calling \`eck_finish_task\`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
### ☠️ SKELETON MODE ACTIVE
|
|
3
|
+
|
|
4
|
+
**NOTICE:** Function bodies have been stripped to save context.
|
|
5
|
+
|
|
6
|
+
**LEGEND:**
|
|
7
|
+
- `/* ... */` or `...` 👉 **Implementation Hidden**
|
|
8
|
+
|
|
9
|
+
**PROTOCOL:**
|
|
10
|
+
If you need to see the code inside these blocks to perform your task, you **MUST** request it.
|
|
11
|
+
|
|
12
|
+
**Command to request code:**
|
|
13
|
+
```bash
|
|
14
|
+
eck-snapshot show path/to/file1.js path/to/file2.js
|
|
15
|
+
```
|
|
16
|
+
**(Batch multiple files in one command!)**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ⚠️ INCREMENTAL UPDATE SNAPSHOT
|
|
2
|
+
|
|
3
|
+
**Base Commit:** `{{anchor}}`
|
|
4
|
+
**Update Timestamp:** `{{timestamp}}`
|
|
5
|
+
|
|
6
|
+
## 🛑 INSTRUCTIONS FOR AI
|
|
7
|
+
|
|
8
|
+
1. **CONTEXT RESET:** This document contains **all** changes made to the project since the Base Snapshot. **DISCARD** any previous "Update" snapshots from your context/memory. They are obsolete.
|
|
9
|
+
2. **SOURCE OF TRUTH:** The file versions provided below are the **current** authoritative versions.
|
|
10
|
+
3. **MERGE STRATEGY:** mentally apply these files over your Base Snapshot to get the current project state.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📝 Changed Files
|
|
15
|
+
|
|
16
|
+
{{fileList}}
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|