@xelth/eck-snapshot 6.0.1 โ 6.0.3
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 +25 -43
- package/package.json +1 -1
- package/src/cli/cli.js +15 -18
- package/src/cli/commands/createSnapshot.js +112 -104
- package/src/cli/commands/generateProfileGuide.js +1 -1
- package/src/templates/multiAgent.md +13 -10
- package/src/templates/opencode/coder.template.md +13 -10
- package/src/templates/opencode/junior-architect.template.md +14 -11
- package/src/utils/aiHeader.js +27 -24
- package/src/utils/claudeMdGenerator.js +24 -12
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# ๐ธ eckSnapshot v6.0
|
|
2
2
|
|
|
3
|
-
A specialized, AI-native CLI tool designed to create and restore single-file text snapshots of Git repositories. Optimized for providing full project context to Large Language Models (LLMs) and serving as the coordination hub for
|
|
3
|
+
A specialized, AI-native CLI tool designed to create and restore single-file text snapshots of Git repositories. Optimized for providing full project context to Large Language Models (LLMs) and serving as the coordination hub for AI Coders.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## ๐ฏ The Battle-Tested Workflow (Author's Note)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
I personally use this tool daily with both **Claude Code** and **OpenCode**. My reliable, heavily-tested workflow is:
|
|
8
|
+
|
|
9
|
+
1. **Full Snapshots:** I take a full snapshot (`eck-snapshot snapshot`) and feed it to a powerful Web LLM (Senior Architect like Gemini 1.5 Pro or Grok 3).
|
|
10
|
+
2. **Context Profiles:** If the project is huge, I use context profiles (`--profile frontend`) to slice it into manageable pieces.
|
|
11
|
+
3. **Direct Execution:** I write code directly using the Senior Architect's guidance and execute tasks via local Coders (Claude/OpenCode).
|
|
12
|
+
4. **Incremental Updates:** After changes are made, I use delta updates (`eck-snapshot update`) to keep the Architect's context perfectly synced without resending the whole repo.
|
|
13
|
+
|
|
14
|
+
This core loop is highly polished, actively maintained, and works exceptionally well.
|
|
13
15
|
|
|
14
16
|
## ๐ Quick Start
|
|
15
17
|
|
|
@@ -20,52 +22,32 @@ npm install -g @xelth/eck-snapshot
|
|
|
20
22
|
|
|
21
23
|
### Basic Usage
|
|
22
24
|
```bash
|
|
23
|
-
# Create a standard full snapshot
|
|
25
|
+
# 1. Create a standard full snapshot (Core Workflow)
|
|
24
26
|
eck-snapshot snapshot
|
|
25
27
|
|
|
26
|
-
#
|
|
27
|
-
eck-snapshot snapshot --
|
|
28
|
+
# 2. Use profiles for large monorepos
|
|
29
|
+
eck-snapshot snapshot --profile backend
|
|
28
30
|
|
|
29
|
-
# Create an incremental update (only changed/deleted files)
|
|
31
|
+
# 3. Create an incremental update (only changed/deleted files)
|
|
30
32
|
eck-snapshot update
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
eckSnapshot v6 acts as the bridge between your primary AI IDE (Claude Code or OpenCode) and a cost-effective GLM-4.7 worker swarm.
|
|
36
|
-
|
|
37
|
-
1. **Get an API Key:** Register at [Z.AI](https://z.ai) and set `export ZAI_API_KEY="your-key"`.
|
|
38
|
-
2. **Setup MCP Servers:**
|
|
39
|
-
```bash
|
|
40
|
-
eck-snapshot setup-mcp --both
|
|
41
|
-
```
|
|
42
|
-
3. **Initialize Project Manifests:**
|
|
43
|
-
```bash
|
|
44
|
-
# Generates smart instructions (CLAUDE.md / AGENTS.md)
|
|
45
|
-
eck-snapshot snapshot --jas # For Claude Code (Sonnet 4.5)
|
|
46
|
-
eck-snapshot snapshot --jaz # For OpenCode (GLM-4.7)
|
|
47
|
-
```
|
|
35
|
+
## ๐ Core Features
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
* **๐ Smart Delta Updates:** Tracks incremental changes via Git anchors with sequential numbering. Accurately tracks and reports deleted files to prevent LLM hallucinations.
|
|
38
|
+
* **๐ก๏ธ Security (SecretScanner):** Automatically redacts API keys and credentials before sending context to LLMs. Features both Regex matching and **Shannon Entropy** analysis.
|
|
39
|
+
* **๐ Native MCP Integration:** Instantly spins up Model Context Protocol (MCP) servers (`eck-core` for context sync) for Claude Code and OpenCode.
|
|
40
|
+
* **๐ The `.eck/` Manifest:** Automatically maintains project context files (`CONTEXT.md`, `ROADMAP.md`, `TECH_DEBT.md`) to onboard AI agents instantly.
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
- `CONTEXT.md` - High-level architecture (Auto-generated)
|
|
53
|
-
- `ENVIRONMENT.md` - Runtime specifics (Auto-generated)
|
|
54
|
-
- `ROADMAP.md` & `TECH_DEBT.md` - Strategic planning
|
|
55
|
-
- `RUNTIME_STATE.md` - Live port/process status
|
|
42
|
+
---
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
## ๐งช Experimental / Advanced Features
|
|
58
45
|
|
|
59
|
-
|
|
46
|
+
*The following features are included in the tool, but I am not actively using them in my daily workflow right now. They are available for power users, but might have edge cases. If you use them and find issues, please open an issue on GitHub, or better yet, try fixing it yourself (you have the ultimate AI coding tool in your hands now!)*
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
eck-snapshot telemetry push
|
|
65
|
-
|
|
66
|
-
# Sync global token weights from the Telemetry Hub
|
|
67
|
-
eck-snapshot telemetry sync-weights
|
|
68
|
-
```
|
|
48
|
+
* **๐ง Multi-Agent Protocol (Royal Court):** Built-in support for delegating tasks from a Senior Architect to Junior Managers (`--jas`, `--jao`, `--jaz`), who orchestrate a swarm of specialized GLM-4.7 workers via MCP.
|
|
49
|
+
* **โ ๏ธ Skeleton Mode:** Uses `Tree-sitter` and `Babel` to strip function bodies (`--skeleton`), drastically reducing token count.
|
|
50
|
+
* **๐ Telemetry Hub:** Integrated with a Rust-based microservice for tracking agent execution metrics and auto-syncing token estimation weights.
|
|
69
51
|
|
|
70
52
|
## License
|
|
71
53
|
MIT ยฉ xelth-com
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xelth/eck-snapshot",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "A powerful CLI tool to create and restore single-file text snapshots of Git repositories. Optimized for AI context, LLM workflows, and multi-agent Swarm coordination.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/src/cli/cli.js
CHANGED
|
@@ -106,27 +106,21 @@ export function run() {
|
|
|
106
106
|
const pkg = createRequire(import.meta.url)('../../package.json');
|
|
107
107
|
const helpGuide = `eck-snapshot (v${pkg.version}) - AI-Native Repository Context Tool.
|
|
108
108
|
|
|
109
|
-
--- ๐ Core Workflow: Optimized for Web LLMs (Gemini/
|
|
109
|
+
--- ๐ Core Workflow: Optimized for Web LLMs (Claude/Gemini/Grok) ---
|
|
110
|
+
๐ก Note: ChatGPT is supported but can be slow. Use the suggested prompt at the end of the snapshot.
|
|
110
111
|
|
|
111
|
-
1. Initial Context (
|
|
112
|
-
Create a
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
$ eck-snapshot --skeleton
|
|
116
|
-
-> Generates: .eck/snapshots/<name>_sk.md (Upload this to AI)
|
|
112
|
+
1. Initial Context (Full Snapshot)
|
|
113
|
+
Create a complete map of your project to feed to the AI Architect.
|
|
114
|
+
$ eck-snapshot snapshot
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
(For very large projects, use profiles: $ eck-snapshot --profile backend)
|
|
117
|
+
|
|
118
|
+
2. Working & Updating
|
|
119
|
+
As you or your local coders (Claude/OpenCode) apply changes, the Web AI loses context.
|
|
120
|
+
Instead of re-sending the full repo, send only what changed.
|
|
123
121
|
|
|
124
|
-
3. Working & Updating
|
|
125
|
-
As you apply changes, the AI loses context. Instead of re-sending the full repo,
|
|
126
|
-
send only what changed since the last snapshot.
|
|
127
|
-
|
|
128
122
|
$ eck-snapshot update
|
|
129
|
-
-> Generates: .eck/snapshots/update_<timestamp>.md (Contains changed files
|
|
123
|
+
-> Generates: .eck/snapshots/update_<timestamp>.md (Contains changed/deleted files)
|
|
130
124
|
|
|
131
125
|
--- ๐ ๏ธ Managing Context Profiles ---
|
|
132
126
|
|
|
@@ -136,7 +130,7 @@ Option A: Auto-Detection (Best for start)
|
|
|
136
130
|
|
|
137
131
|
Option B: Manual Guide (Best for large repos)
|
|
138
132
|
If the project is too big for auto-detection, this generates a prompt text file
|
|
139
|
-
that you can paste into a powerful Web LLM (like Gemini
|
|
133
|
+
that you can paste into a powerful Web LLM (like Gemini, Claude, or Grok) to design profiles manually.
|
|
140
134
|
|
|
141
135
|
1. Run: $ eck-snapshot generate-profile-guide
|
|
142
136
|
2. Open: .eck/profile_generation_guide.md
|
|
@@ -155,6 +149,9 @@ Option C: Using Profiles
|
|
|
155
149
|
- ask-claude: Delegate tasks to Claude CLI agent.
|
|
156
150
|
- setup-gemini: Configure gemini-cli integration.
|
|
157
151
|
- setup-mcp: Setup/restore MCP servers (eck-core + glm-zai).
|
|
152
|
+
|
|
153
|
+
--- ๐งช Experimental Features ---
|
|
154
|
+
Run eck-snapshot snapshot --help to see experimental flags like --skeleton, --jas, --jaz.
|
|
158
155
|
`;
|
|
159
156
|
|
|
160
157
|
program
|
|
@@ -629,19 +629,19 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
629
629
|
...options // Command-line options have the final say
|
|
630
630
|
};
|
|
631
631
|
|
|
632
|
-
// Detect architect modes
|
|
633
|
-
const isJas = options.jas;
|
|
634
|
-
const isJao = options.jao;
|
|
635
|
-
const isJaz = options.jaz;
|
|
636
|
-
|
|
637
|
-
// If NOT in Junior Architect mode, hide JA-specific documentation to prevent context pollution
|
|
638
|
-
if (!options.withJa && !isJas && !isJao && !isJaz) {
|
|
639
|
-
if (!config.filesToIgnore) config.filesToIgnore = [];
|
|
640
|
-
config.filesToIgnore.push(
|
|
641
|
-
'COMMANDS_REFERENCE.md',
|
|
642
|
-
'codex_delegation_snapshot.md'
|
|
643
|
-
);
|
|
644
|
-
}
|
|
632
|
+
// Detect architect modes
|
|
633
|
+
const isJas = options.jas;
|
|
634
|
+
const isJao = options.jao;
|
|
635
|
+
const isJaz = options.jaz;
|
|
636
|
+
|
|
637
|
+
// If NOT in Junior Architect mode, hide JA-specific documentation to prevent context pollution
|
|
638
|
+
if (!options.withJa && !isJas && !isJao && !isJaz) {
|
|
639
|
+
if (!config.filesToIgnore) config.filesToIgnore = [];
|
|
640
|
+
config.filesToIgnore.push(
|
|
641
|
+
'COMMANDS_REFERENCE.md',
|
|
642
|
+
'codex_delegation_snapshot.md'
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
645
|
|
|
646
646
|
// Apply defaults for options that may not be provided via command line
|
|
647
647
|
if (!config.output) {
|
|
@@ -720,83 +720,83 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
720
720
|
// File body always includes full content
|
|
721
721
|
let fileBody = (directoryTree ? `\n## Directory Structure\n\n\`\`\`\n${directoryTree}\`\`\`\n\n` : '') + contentArray.join('');
|
|
722
722
|
|
|
723
|
-
// Helper to write snapshot file
|
|
724
|
-
const writeSnapshot = async (suffix, isAgentMode) => {
|
|
725
|
-
// CHANGE: Force agent to FALSE for the main snapshot header.
|
|
726
|
-
// The snapshot is read by the Human/Senior Arch, not the Agent itself.
|
|
727
|
-
// The Agent reads CLAUDE.md.
|
|
728
|
-
const opts = { ...options, agent: false, jas: isJas, jao: isJao, jaz: isJaz };
|
|
729
|
-
const header = await generateEnhancedAIHeader({ stats, repoName, mode: 'file', eckManifest, options: opts, repoPath: processedRepoPath }, isGitRepo);
|
|
730
|
-
|
|
731
|
-
// Compact filename format: eck{ShortName}{timestamp}_{hash}_{suffix}.md
|
|
732
|
-
// getShortRepoName ensures Capitalized Start/End (e.g. SnaOt)
|
|
733
|
-
const shortHash = gitHash ? gitHash.substring(0, 7) : '';
|
|
734
|
-
const shortRepoName = getShortRepoName(repoName);
|
|
735
|
-
|
|
736
|
-
let fname = `eck${shortRepoName}${timestamp}`;
|
|
737
|
-
if (shortHash) fname += `_${shortHash}`;
|
|
738
|
-
|
|
739
|
-
// Add mode suffix
|
|
740
|
-
if (options.skeleton) {
|
|
741
|
-
fname += '_sk';
|
|
742
|
-
} else if (suffix) {
|
|
743
|
-
fname += suffix;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
const fullContent = header + fileBody;
|
|
747
|
-
const sizeKB = Math.max(1, Math.round(Buffer.byteLength(fullContent, 'utf-8') / 1024));
|
|
748
|
-
fname += `_${sizeKB}kb.${fileExtension}`;
|
|
749
|
-
const fpath = path.join(outputPath, fname);
|
|
750
|
-
await fs.writeFile(fpath, fullContent);
|
|
751
|
-
console.log(`๐ Generated Snapshot: ${fname}`);
|
|
752
|
-
|
|
753
|
-
// --- FEATURE: Active Snapshot (.eck/lastsnapshot/) ---
|
|
754
|
-
// Only create .eck/lastsnapshot/ entries for the main snapshot
|
|
755
|
-
if (!isAgentMode) {
|
|
756
|
-
try {
|
|
757
|
-
const snapDir = path.join(originalCwd, '.eck', 'lastsnapshot');
|
|
758
|
-
await fs.mkdir(snapDir, { recursive: true });
|
|
759
|
-
|
|
760
|
-
// 1. Clean up OLD snapshots in this specific folder
|
|
761
|
-
// We keep AnswerToSA.md, but remove old snapshots and legacy answer.md
|
|
762
|
-
const existingFiles = await fs.readdir(snapDir);
|
|
763
|
-
for (const file of existingFiles) {
|
|
764
|
-
if ((file.startsWith('eck') && file.endsWith('.md')) || file === 'answer.md') {
|
|
765
|
-
await fs.unlink(path.join(snapDir, file));
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// 2. Save the NEW specific named file
|
|
770
|
-
await fs.writeFile(path.join(snapDir, fname), fullContent);
|
|
771
|
-
|
|
772
|
-
console.log(chalk.cyan(`๐ Active snapshot updated in .eck/lastsnapshot/: ${fname}`));
|
|
773
|
-
} catch (e) {
|
|
774
|
-
// Non-critical failure
|
|
775
|
-
console.warn(chalk.yellow(`โ ๏ธ Could not update .eck/lastsnapshot/: ${e.message}`));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
// --------------------------------------------
|
|
779
|
-
|
|
780
|
-
return fpath;
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
// Generate snapshot file for ALL modes
|
|
784
|
-
if (isJas) {
|
|
785
|
-
architectFilePath = await writeSnapshot('_jas', true);
|
|
786
|
-
} else if (isJao) {
|
|
787
|
-
architectFilePath = await writeSnapshot('_jao', true);
|
|
788
|
-
} else if (isJaz) {
|
|
789
|
-
architectFilePath = await writeSnapshot('_jaz', true);
|
|
790
|
-
} else {
|
|
791
|
-
// Standard snapshot behavior
|
|
792
|
-
architectFilePath = await writeSnapshot('', false);
|
|
793
|
-
|
|
794
|
-
// --- File 2: Junior Architect Snapshot (legacy --with-ja support) ---
|
|
795
|
-
if (options.withJa && fileExtension === 'md') {
|
|
796
|
-
console.log('๐๏ธ Generating Junior Architect (_ja) snapshot...');
|
|
797
|
-
jaFilePath = await writeSnapshot('_ja', true);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
723
|
+
// Helper to write snapshot file
|
|
724
|
+
const writeSnapshot = async (suffix, isAgentMode) => {
|
|
725
|
+
// CHANGE: Force agent to FALSE for the main snapshot header.
|
|
726
|
+
// The snapshot is read by the Human/Senior Arch, not the Agent itself.
|
|
727
|
+
// The Agent reads CLAUDE.md.
|
|
728
|
+
const opts = { ...options, agent: false, jas: isJas, jao: isJao, jaz: isJaz };
|
|
729
|
+
const header = await generateEnhancedAIHeader({ stats, repoName, mode: 'file', eckManifest, options: opts, repoPath: processedRepoPath }, isGitRepo);
|
|
730
|
+
|
|
731
|
+
// Compact filename format: eck{ShortName}{timestamp}_{hash}_{suffix}.md
|
|
732
|
+
// getShortRepoName ensures Capitalized Start/End (e.g. SnaOt)
|
|
733
|
+
const shortHash = gitHash ? gitHash.substring(0, 7) : '';
|
|
734
|
+
const shortRepoName = getShortRepoName(repoName);
|
|
735
|
+
|
|
736
|
+
let fname = `eck${shortRepoName}${timestamp}`;
|
|
737
|
+
if (shortHash) fname += `_${shortHash}`;
|
|
738
|
+
|
|
739
|
+
// Add mode suffix
|
|
740
|
+
if (options.skeleton) {
|
|
741
|
+
fname += '_sk';
|
|
742
|
+
} else if (suffix) {
|
|
743
|
+
fname += suffix;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const fullContent = header + fileBody;
|
|
747
|
+
const sizeKB = Math.max(1, Math.round(Buffer.byteLength(fullContent, 'utf-8') / 1024));
|
|
748
|
+
fname += `_${sizeKB}kb.${fileExtension}`;
|
|
749
|
+
const fpath = path.join(outputPath, fname);
|
|
750
|
+
await fs.writeFile(fpath, fullContent);
|
|
751
|
+
console.log(`๐ Generated Snapshot: ${fname}`);
|
|
752
|
+
|
|
753
|
+
// --- FEATURE: Active Snapshot (.eck/lastsnapshot/) ---
|
|
754
|
+
// Only create .eck/lastsnapshot/ entries for the main snapshot
|
|
755
|
+
if (!isAgentMode) {
|
|
756
|
+
try {
|
|
757
|
+
const snapDir = path.join(originalCwd, '.eck', 'lastsnapshot');
|
|
758
|
+
await fs.mkdir(snapDir, { recursive: true });
|
|
759
|
+
|
|
760
|
+
// 1. Clean up OLD snapshots in this specific folder
|
|
761
|
+
// We keep AnswerToSA.md, but remove old snapshots and legacy answer.md
|
|
762
|
+
const existingFiles = await fs.readdir(snapDir);
|
|
763
|
+
for (const file of existingFiles) {
|
|
764
|
+
if ((file.startsWith('eck') && file.endsWith('.md')) || file === 'answer.md') {
|
|
765
|
+
await fs.unlink(path.join(snapDir, file));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// 2. Save the NEW specific named file
|
|
770
|
+
await fs.writeFile(path.join(snapDir, fname), fullContent);
|
|
771
|
+
|
|
772
|
+
console.log(chalk.cyan(`๐ Active snapshot updated in .eck/lastsnapshot/: ${fname}`));
|
|
773
|
+
} catch (e) {
|
|
774
|
+
// Non-critical failure
|
|
775
|
+
console.warn(chalk.yellow(`โ ๏ธ Could not update .eck/lastsnapshot/: ${e.message}`));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
// --------------------------------------------
|
|
779
|
+
|
|
780
|
+
return fpath;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// Generate snapshot file for ALL modes
|
|
784
|
+
if (isJas) {
|
|
785
|
+
architectFilePath = await writeSnapshot('_jas', true);
|
|
786
|
+
} else if (isJao) {
|
|
787
|
+
architectFilePath = await writeSnapshot('_jao', true);
|
|
788
|
+
} else if (isJaz) {
|
|
789
|
+
architectFilePath = await writeSnapshot('_jaz', true);
|
|
790
|
+
} else {
|
|
791
|
+
// Standard snapshot behavior
|
|
792
|
+
architectFilePath = await writeSnapshot('', false);
|
|
793
|
+
|
|
794
|
+
// --- File 2: Junior Architect Snapshot (legacy --with-ja support) ---
|
|
795
|
+
if (options.withJa && fileExtension === 'md') {
|
|
796
|
+
console.log('๐๏ธ Generating Junior Architect (_ja) snapshot...');
|
|
797
|
+
jaFilePath = await writeSnapshot('_ja', true);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
800
|
|
|
801
801
|
// Save git anchor for future delta updates
|
|
802
802
|
await saveGitAnchor(processedRepoPath);
|
|
@@ -816,20 +816,20 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
816
816
|
console.log('๐ Scanning for confidential files...');
|
|
817
817
|
const confidentialFiles = await scanEckForConfidentialFiles(processedRepoPath, config);
|
|
818
818
|
|
|
819
|
-
let claudeMode = 'coder';
|
|
820
|
-
if (isJas) claudeMode = 'jas';
|
|
821
|
-
if (isJao) claudeMode = 'jao';
|
|
822
|
-
if (isJaz) claudeMode = 'jaz';
|
|
823
|
-
|
|
824
|
-
// Claude Code exclusively uses CLAUDE.md
|
|
825
|
-
if (isJas || isJao || (!isJaz && !options.withJa)) {
|
|
826
|
-
await updateClaudeMd(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// OpenCode exclusively uses AGENTS.md
|
|
830
|
-
if (isJaz || (!isJas && !isJao && !options.withJa)) {
|
|
831
|
-
await generateOpenCodeAgents(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
832
|
-
}
|
|
819
|
+
let claudeMode = 'coder';
|
|
820
|
+
if (isJas) claudeMode = 'jas';
|
|
821
|
+
if (isJao) claudeMode = 'jao';
|
|
822
|
+
if (isJaz) claudeMode = 'jaz';
|
|
823
|
+
|
|
824
|
+
// Claude Code exclusively uses CLAUDE.md
|
|
825
|
+
if (isJas || isJao || (!isJaz && !options.withJa)) {
|
|
826
|
+
await updateClaudeMd(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// OpenCode exclusively uses AGENTS.md
|
|
830
|
+
if (isJaz || (!isJas && !isJao && !options.withJa)) {
|
|
831
|
+
await generateOpenCodeAgents(processedRepoPath, claudeMode, directoryTree, confidentialFiles, { zh: options.zh });
|
|
832
|
+
}
|
|
833
833
|
|
|
834
834
|
// --- Combined Report ---
|
|
835
835
|
console.log('\nโ
Snapshot generation complete!');
|
|
@@ -924,6 +924,14 @@ export async function createRepoSnapshot(repoPath, options) {
|
|
|
924
924
|
console.log(' Replace [ACTUAL_TOKENS_HERE] with the real token count from your LLM');
|
|
925
925
|
}
|
|
926
926
|
|
|
927
|
+
// Output AI Prompt Suggestion for stubborn LLMs
|
|
928
|
+
console.log('\n๐ค AI PROMPT SUGGESTION (Crucial for ChatGPT, helpful for others):');
|
|
929
|
+
console.log('---------------------------------------------------');
|
|
930
|
+
console.log(chalk.yellow('๐ก Tip: Claude, Gemini, and Grok handle large files best. ChatGPT works but can be slow.'));
|
|
931
|
+
console.log('If your AI ignores the file instructions and acts as an external reviewer,');
|
|
932
|
+
console.log('copy and paste this exact prompt along with your snapshot file:\n');
|
|
933
|
+
console.log(chalk.cyan.bold('Read the SYSTEM DIRECTIVE at the very beginning of the attached file. Immediately assume the role of Senior Architect as instructed, then await my first task.\n'));
|
|
934
|
+
|
|
927
935
|
} finally {
|
|
928
936
|
process.chdir(originalCwd); // Final reset back to original CWD
|
|
929
937
|
}
|
|
@@ -133,7 +133,7 @@ export async function generateProfileGuide(repoPath = process.cwd(), options = {
|
|
|
133
133
|
// 3. Print clear instructions
|
|
134
134
|
console.log(chalk.cyan('\n๐ Next Steps (Workflow):'));
|
|
135
135
|
console.log(`1. Open: ${chalk.bold('.eck/profile_generation_guide.md')}`);
|
|
136
|
-
console.log('2. Copy the PROMPT + TREE content and paste it into an AI (Gemini
|
|
136
|
+
console.log('2. Copy the PROMPT + TREE content and paste it into an AI (Gemini, Claude, Grok).');
|
|
137
137
|
console.log('3. Copy the JSON response from the AI.');
|
|
138
138
|
console.log(`4. Paste the JSON into: ${chalk.bold('.eck/profiles.json')} ${profilesCreated ? '(I created this file for you)' : '(File exists)'}`);
|
|
139
139
|
console.log('\nโ
Once saved, run: ' + chalk.green('eck-snapshot --profile <profile_name>'));
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
# AI
|
|
1
|
+
# SYSTEM DIRECTIVE FOR THE ACTIVE AI AGENT
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**CRITICAL:** If you are the AI (LLM) reading this file in the current chat session, you must IMMEDIATELY assume the role defined below. Do not act as an external reviewer or generic assistant. This document is your active operating environment and contract.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 1. Your Role & Identity
|
|
6
|
+
|
|
7
|
+
You are the **Senior 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.
|
|
8
|
+
|
|
9
|
+
## 2. How to Read This Snapshot
|
|
10
|
+
|
|
11
|
+
This document is a self-contained, single-file snapshot of the **{{repoName}}** software repository, generated by the `eck-snapshot` tool on **{{timestamp}}**. Treat the file structure and code below as your absolute source of truth for the project state.
|
|
6
12
|
|
|
7
13
|
* **Source of Truth:** Treat this snapshot as the complete and authoritative source code.
|
|
8
14
|
* **Structure:** The file contains a **Directory Structure** tree, followed by the full content of each file, demarcated by `--- File: /path/to/file ---` headers.
|
|
@@ -13,15 +19,13 @@ This document is a self-contained, single-file snapshot of the **{{repoName}}**
|
|
|
13
19
|
|
|
14
20
|
---
|
|
15
21
|
|
|
16
|
-
##
|
|
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.
|
|
22
|
+
## 3. Your Core Operational Workflow
|
|
19
23
|
|
|
20
24
|
{{projectOverview}}
|
|
21
25
|
|
|
22
26
|
{{eckManifestSection}}
|
|
23
27
|
|
|
24
|
-
###
|
|
28
|
+
### MANIFEST MAINTENANCE PROTOCOL (CRITICAL)
|
|
25
29
|
|
|
26
30
|
The `.eck/` directory files are your "Source of Knowledge".
|
|
27
31
|
1. **Stub Detection:** If a file starts with `# [STUB: ...]`, it means the system failed to auto-generate meaningful content.
|
|
@@ -100,7 +104,7 @@ The Coder agent is intelligent and will understand what information they need ba
|
|
|
100
104
|
6. **Review & Report:** After the command is executed, analyze the results and report back to the user in their language.
|
|
101
105
|
7. **Iterate:** Continue the cycle based on user feedback.
|
|
102
106
|
|
|
103
|
-
###
|
|
107
|
+
### ANTI-TRUNCATION PROTOCOL (CRITICAL)
|
|
104
108
|
|
|
105
109
|
Web interfaces (like Gemini or ChatGPT) sometimes silently drop the content of large text files during upload, replacing the file's content with a tiny JSON metadata string (e.g., `{"fileName": "...", "contentFetchId": "..."}`).
|
|
106
110
|
|
|
@@ -108,7 +112,7 @@ Web interfaces (like Gemini or ChatGPT) sometimes silently drop the content of l
|
|
|
108
112
|
1. **Always check the filename:** The exact file size in kilobytes is appended to the end of every snapshot filename (e.g., `..._up7_1250kb.md`).
|
|
109
113
|
2. **Verify payload length:** If the filename says `1250kb` but the text you actually received for that file is only a few lines long or looks like a system JSON string, **THE CONTENT WAS TRUNCATED BY THE UI**.
|
|
110
114
|
3. **Alert the User:** DO NOT hallucinate the missing code. Immediately stop and tell the user:
|
|
111
|
-
> "
|
|
115
|
+
> "**System Error:** The web interface truncated the file `[FileName]`. I only received the metadata/JSON stub, not the actual `[Size]kb` of code. Please split the snapshot or paste the text directly."
|
|
112
116
|
|
|
113
117
|
{{hierarchicalWorkflow}}
|
|
114
118
|
|
|
@@ -125,4 +129,3 @@ Web interfaces (like Gemini or ChatGPT) sometimes silently drop the content of l
|
|
|
125
129
|
You can command multiple specialized agents. **YOU must choose the most appropriate agent** based on the task requirements and target environment:
|
|
126
130
|
|
|
127
131
|
{{agentDefinitions}}
|
|
128
|
-
|
|
@@ -6,17 +6,20 @@ You are an Expert Developer. The architecture is already decided. Your job is to
|
|
|
6
6
|
## DEFINITION OF DONE (CRITICAL)
|
|
7
7
|
When task is complete, you must report back and sync context.
|
|
8
8
|
|
|
9
|
-
**
|
|
10
|
-
|
|
11
|
-
- The tool will automatically write the report
|
|
12
|
-
- **DO NOT** manually write to
|
|
13
|
-
- **WARNING: USE ONLY ONCE.** Do not use
|
|
9
|
+
**PRIMARY METHOD: Use `eck_finish_task` MCP tool.**
|
|
10
|
+
Pass your detailed markdown report into the `status` argument.
|
|
11
|
+
- The tool will automatically write the report, commit, and generate a snapshot.
|
|
12
|
+
- **DO NOT** manually write to `AnswerToSA.md` with your file editing tools.
|
|
13
|
+
- **WARNING: USE ONLY ONCE.** Do not use for intermediate testing.
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
If
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
**FALLBACK METHOD (Only if MCP tool is missing):**
|
|
16
|
+
If `eck_finish_task` is NOT in your available tools, you MUST do the following:
|
|
17
|
+
0. **WARN THE USER:** State clearly in your response: "โ ๏ธ `eck-core` MCP server is not connected. Proceeding with manual fallback."
|
|
18
|
+
1. **READ:** Read `.eck/lastsnapshot/AnswerToSA.md` using your `Read` tool (REQUIRED before overwriting).
|
|
19
|
+
2. **WRITE:** Overwrite that file with your report.
|
|
20
|
+
3. **COMMIT (CRITICAL):** Run `git add .` and `git commit -m "chore: task report"` in the terminal.
|
|
21
|
+
4. **SNAPSHOT:** Run `eck-snapshot update` in the terminal.
|
|
22
|
+
*(Note: The snapshot compares against the git anchor. If you skip step 3, it will say "No changes detected").*
|
|
20
23
|
|
|
21
24
|
## PROJECT CONTEXT (.eck DIRECTORY)
|
|
22
25
|
The `.eck/` directory contains critical project documentation. **Before starting your task, you MUST:**
|
|
@@ -36,18 +36,21 @@ For bulk work where delegation saves YOUR expensive context window, YOU MUST del
|
|
|
36
36
|
## 4. DEFINITION OF DONE (CRITICAL)
|
|
37
37
|
When you have completed your coding task and verified it works, you must report back and sync context.
|
|
38
38
|
|
|
39
|
-
**
|
|
40
|
-
|
|
41
|
-
- The tool will automatically write the report
|
|
42
|
-
- **DO NOT** manually write to
|
|
43
|
-
- **WARNING: USE ONLY ONCE.** Do not use
|
|
39
|
+
**PRIMARY METHOD: Use `eck_finish_task` MCP tool.**
|
|
40
|
+
Pass your detailed markdown report into the `status` argument.
|
|
41
|
+
- The tool will automatically write the report, commit, and generate a snapshot.
|
|
42
|
+
- **DO NOT** manually write to `AnswerToSA.md` with your file editing tools.
|
|
43
|
+
- **WARNING: USE ONLY ONCE.** Do not use for intermediate testing.
|
|
44
44
|
|
|
45
|
-
**
|
|
46
|
-
If
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
**FALLBACK METHOD (Only if MCP tool is missing):**
|
|
46
|
+
If `eck_finish_task` is NOT in your available tools, you MUST do the following:
|
|
47
|
+
0. **WARN THE USER:** State clearly in your response: "โ ๏ธ `eck-core` MCP server is not connected. Proceeding with manual fallback."
|
|
48
|
+
1. **READ:** Read `.eck/lastsnapshot/AnswerToSA.md` using your `Read` tool (REQUIRED before overwriting).
|
|
49
|
+
2. **WRITE:** Overwrite that file with your report.
|
|
50
|
+
3. **COMMIT (CRITICAL):** Run `git add .` and `git commit -m "chore: task report"` in the terminal.
|
|
51
|
+
4. **SNAPSHOT:** Run `eck-snapshot update` in the terminal.
|
|
52
|
+
*(Note: The snapshot compares against the git anchor. If you skip step 3, it will say "No changes detected").*
|
|
53
|
+
5. If you are entirely blocked, use the `eck_fail_task` tool.
|
|
51
54
|
|
|
52
55
|
## 5. SWARM ERROR RECOVERY & THE RALPH LOOP
|
|
53
56
|
**Core Directive:** You are "deterministically persistent". Failures are expected, giving up is not.
|
package/src/utils/aiHeader.js
CHANGED
|
@@ -72,11 +72,11 @@ function getVisibleAgents(executionAgents, options) {
|
|
|
72
72
|
// These keys must match IDs in setup.json
|
|
73
73
|
const standardCoders = ['local_dev', 'production_server', 'android_wsl_dev'];
|
|
74
74
|
|
|
75
|
-
// 2. Determine Priority Agent (The Junior Architect)
|
|
76
|
-
let priorityAgentKey = null;
|
|
77
|
-
if (options.jas) priorityAgentKey = 'jas';
|
|
78
|
-
if (options.jao) priorityAgentKey = 'jao';
|
|
79
|
-
if (options.jaz) priorityAgentKey = 'jaz';
|
|
75
|
+
// 2. Determine Priority Agent (The Junior Architect)
|
|
76
|
+
let priorityAgentKey = null;
|
|
77
|
+
if (options.jas) priorityAgentKey = 'jas';
|
|
78
|
+
if (options.jao) priorityAgentKey = 'jao';
|
|
79
|
+
if (options.jaz) priorityAgentKey = 'jaz';
|
|
80
80
|
|
|
81
81
|
// 3. Build the list
|
|
82
82
|
// If a JA is selected, add them FIRST with a note
|
|
@@ -438,10 +438,10 @@ ${operationsSection}
|
|
|
438
438
|
// The `agent` prompt template is used ONLY in CLAUDE.md (via claudeMdGenerator.js)
|
|
439
439
|
// NOT in the snapshot itself.
|
|
440
440
|
|
|
441
|
-
const isJas = context.options && context.options.jas;
|
|
442
|
-
const isJao = context.options && context.options.jao;
|
|
443
|
-
const isJaz = context.options && context.options.jaz;
|
|
444
|
-
const isJaMode = isJas || isJao || isJaz;
|
|
441
|
+
const isJas = context.options && context.options.jas;
|
|
442
|
+
const isJao = context.options && context.options.jao;
|
|
443
|
+
const isJaz = context.options && context.options.jaz;
|
|
444
|
+
const isJaMode = isJas || isJao || isJaz;
|
|
445
445
|
|
|
446
446
|
// --- Determine Workflow Content based on JA Flag ---
|
|
447
447
|
let hierarchicalWorkflow = '';
|
|
@@ -449,15 +449,15 @@ ${operationsSection}
|
|
|
449
449
|
|
|
450
450
|
if (isJaMode) {
|
|
451
451
|
// Instructions strictly for the Senior Architect on how to use the JA
|
|
452
|
-
hierarchicalWorkflow = `### ๐ ROYAL COURT ARCHITECTURE (Active)
|
|
453
|
-
|
|
454
|
-
You are the **Senior Architect**. You have a **Junior Architect** available to handle implementation.
|
|
455
|
-
|
|
456
|
-
**PROTOCOL:**
|
|
457
|
-
1. **Prefer Delegation:** Unless the task is trivial (1-2 file edits), assign it to the **Junior Architect** (ID: \`jas\`, \`jao\`, or \`jaz\` - see agents list above).
|
|
458
|
-
2. **Direct Execution:** Only use \`local_dev\` or \`production_server\` directly if the Junior Architect fails or for simple "hotfixes".
|
|
459
|
-
3. **No Micro-Management:** Do not tell the Junior Architect *how* to use GLM Z.AI or internal tools. Just give them the strategic objective.
|
|
460
|
-
`;
|
|
452
|
+
hierarchicalWorkflow = `### ๐ ROYAL COURT ARCHITECTURE (Active)
|
|
453
|
+
|
|
454
|
+
You are the **Senior Architect**. You have a **Junior Architect** available to handle implementation.
|
|
455
|
+
|
|
456
|
+
**PROTOCOL:**
|
|
457
|
+
1. **Prefer Delegation:** Unless the task is trivial (1-2 file edits), assign it to the **Junior Architect** (ID: \`jas\`, \`jao\`, or \`jaz\` - see agents list above).
|
|
458
|
+
2. **Direct Execution:** Only use \`local_dev\` or \`production_server\` directly if the Junior Architect fails or for simple "hotfixes".
|
|
459
|
+
3. **No Micro-Management:** Do not tell the Junior Architect *how* to use GLM Z.AI or internal tools. Just give them the strategic objective.
|
|
460
|
+
`;
|
|
461
461
|
|
|
462
462
|
commandFormats = `### COMMAND FORMATS (Eck-Protocol v2)
|
|
463
463
|
|
|
@@ -516,11 +516,11 @@ Use \`apply_code_changes\` for simple, direct tasks where you provide all detail
|
|
|
516
516
|
"agent_environment": "Development environment with full GUI support and development tools",
|
|
517
517
|
"command_for_agent": "apply_code_changes",
|
|
518
518
|
"task_id": "unique-task-id",
|
|
519
|
-
"payload": {
|
|
520
|
-
"objective": "Brief, clear task description",
|
|
521
|
-
"context": "Why this change is needed - include relevant .eck manifest context",
|
|
522
|
-
"architect_confidence": "high (90%) - I am certain of this plan / low (30%) - Please investigate first",
|
|
523
|
-
"files_to_modify": [
|
|
519
|
+
"payload": {
|
|
520
|
+
"objective": "Brief, clear task description",
|
|
521
|
+
"context": "Why this change is needed - include relevant .eck manifest context",
|
|
522
|
+
"architect_confidence": "high (90%) - I am certain of this plan / low (30%) - Please investigate first",
|
|
523
|
+
"files_to_modify": [
|
|
524
524
|
{
|
|
525
525
|
"path": "exact/file/path.js",
|
|
526
526
|
"action": "specific action (add, modify, replace, delete)",
|
|
@@ -687,7 +687,10 @@ const x = 1;
|
|
|
687
687
|
|
|
688
688
|
} catch (error) {
|
|
689
689
|
console.warn('Warning: Could not load setup.json, using minimal header', error.message);
|
|
690
|
-
return `#
|
|
690
|
+
return `# SYSTEM DIRECTIVE FOR THE ACTIVE AI AGENT
|
|
691
|
+
**CRITICAL:** If you are the AI reading this, immediately assume the role of Solution Architect for this project. Do not act as an external reviewer.
|
|
692
|
+
|
|
693
|
+
# Snapshot for ${context.repoName || 'Project'}
|
|
691
694
|
|
|
692
695
|
Generated: ${new Date().toISOString()}
|
|
693
696
|
|
|
@@ -48,9 +48,18 @@ Your task is NOT complete until code works globally.
|
|
|
48
48
|
2. **Finish & Report:** Use the \`eck_finish_task\` MCP tool.
|
|
49
49
|
- Pass your full markdown report into the \`status\` argument.
|
|
50
50
|
- The tool will automatically write the report to \`.eck/lastsnapshot/AnswerToSA.md\`, commit, and generate a snapshot.
|
|
51
|
-
- **DO NOT** try to manually write to \`.eck/lastsnapshot/AnswerToSA.md\` with the \`Write\` tool
|
|
51
|
+
- **DO NOT** try to manually write to \`.eck/lastsnapshot/AnswerToSA.md\` with the \`Write\` tool.
|
|
52
52
|
- **WARNING:** USE ONLY ONCE PER TASK. Do not use this tool or \`eck-snapshot update\` for intermediate testing.
|
|
53
53
|
|
|
54
|
+
**FALLBACK METHOD (Only if MCP tool is missing):**
|
|
55
|
+
If \`eck_finish_task\` is NOT in your available tools, you MUST do the following:
|
|
56
|
+
0. **WARN THE USER:** State clearly in your response: "โ ๏ธ \`eck-core\` MCP server is not connected. Proceeding with manual fallback."
|
|
57
|
+
1. **READ:** Read \`.eck/lastsnapshot/AnswerToSA.md\` using your \`Read\` tool (REQUIRED before overwriting).
|
|
58
|
+
2. **WRITE:** Overwrite that file with your report.
|
|
59
|
+
3. **COMMIT (CRITICAL):** Run \`git add .\` and \`git commit -m "chore: task report"\` in the terminal.
|
|
60
|
+
4. **SNAPSHOT:** Run \`eck-snapshot update\` in the terminal.
|
|
61
|
+
*(Note: The snapshot compares against the git anchor. If you skip step 3, it will say "No changes detected").*
|
|
62
|
+
|
|
54
63
|
## 5. SWARM ERROR RECOVERY & ARCHITECT HYPOTHESES
|
|
55
64
|
1. **Runtime Check:** Always check the \`.eck/RUNTIME_STATE.md\` and running processes before coding.
|
|
56
65
|
2. **Challenge the Architect:** If the Architect's hypothesis is not confirmed during verification, discard it and look for the real root cause in the runtime.
|
|
@@ -72,17 +81,20 @@ You are an Expert Developer. The architecture is already decided. Your job is to
|
|
|
72
81
|
## DEFINITION OF DONE (CRITICAL)
|
|
73
82
|
When task is complete, you must report back and sync context.
|
|
74
83
|
|
|
75
|
-
**
|
|
76
|
-
|
|
77
|
-
- The tool will automatically write the report
|
|
78
|
-
- **DO NOT** manually write to \`AnswerToSA.md\` with your file editing tools
|
|
79
|
-
- **WARNING: USE ONLY ONCE.** Do not use
|
|
80
|
-
|
|
81
|
-
**
|
|
82
|
-
If
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
**PRIMARY METHOD: Use \`eck_finish_task\` MCP tool.**
|
|
85
|
+
Pass your detailed markdown report into the \`status\` argument.
|
|
86
|
+
- The tool will automatically write the report, commit, and generate a snapshot.
|
|
87
|
+
- **DO NOT** manually write to \`AnswerToSA.md\` with your file editing tools.
|
|
88
|
+
- **WARNING: USE ONLY ONCE.** Do not use for intermediate testing.
|
|
89
|
+
|
|
90
|
+
**FALLBACK METHOD (Only if MCP tool is missing):**
|
|
91
|
+
If \`eck_finish_task\` is NOT in your available tools, you MUST do the following:
|
|
92
|
+
0. **WARN THE USER:** State clearly in your response: "โ ๏ธ \`eck-core\` MCP server is not connected. Proceeding with manual fallback."
|
|
93
|
+
1. **READ:** Read \`.eck/lastsnapshot/AnswerToSA.md\` using your \`Read\` tool (REQUIRED before overwriting).
|
|
94
|
+
2. **WRITE:** Overwrite that file with your report.
|
|
95
|
+
3. **COMMIT (CRITICAL):** Run \`git add .\` and \`git commit -m "chore: task report"\` in the terminal.
|
|
96
|
+
4. **SNAPSHOT:** Run \`eck-snapshot update\` in the terminal.
|
|
97
|
+
*(Note: The snapshot compares against the git anchor. If you skip step 3, it will say "No changes detected").*
|
|
86
98
|
|
|
87
99
|
## PROJECT CONTEXT (.eck DIRECTORY)
|
|
88
100
|
The \`.eck/\` directory contains critical project documentation. **Before starting your task, you MUST:**
|