compact-agent 1.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 +394 -0
- package/bin/anycode.js +2 -0
- package/bin/crowcoder.js +19 -0
- package/bin/ecc-hooks.cjs +138 -0
- package/dist/agents.d.ts +17 -0
- package/dist/agents.js +1603 -0
- package/dist/agents.js.map +1 -0
- package/dist/api.d.ts +16 -0
- package/dist/api.js +115 -0
- package/dist/api.js.map +1 -0
- package/dist/autonomous-loops.d.ts +108 -0
- package/dist/autonomous-loops.js +526 -0
- package/dist/autonomous-loops.js.map +1 -0
- package/dist/codemaps.d.ts +53 -0
- package/dist/codemaps.js +325 -0
- package/dist/codemaps.js.map +1 -0
- package/dist/compaction.d.ts +30 -0
- package/dist/compaction.js +125 -0
- package/dist/compaction.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/content-engine.d.ts +97 -0
- package/dist/content-engine.js +721 -0
- package/dist/content-engine.js.map +1 -0
- package/dist/cost-tracker.d.ts +49 -0
- package/dist/cost-tracker.js +150 -0
- package/dist/cost-tracker.js.map +1 -0
- package/dist/counter-button.d.ts +35 -0
- package/dist/counter-button.js +48 -0
- package/dist/counter-button.js.map +1 -0
- package/dist/counter.d.ts +21 -0
- package/dist/counter.js +31 -0
- package/dist/counter.js.map +1 -0
- package/dist/coverage.d.ts +23 -0
- package/dist/coverage.js +215 -0
- package/dist/coverage.js.map +1 -0
- package/dist/docs-sync.d.ts +23 -0
- package/dist/docs-sync.js +266 -0
- package/dist/docs-sync.js.map +1 -0
- package/dist/ecc.d.ts +41 -0
- package/dist/ecc.js +644 -0
- package/dist/ecc.js.map +1 -0
- package/dist/evaluation.d.ts +24 -0
- package/dist/evaluation.js +412 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/export.d.ts +22 -0
- package/dist/export.js +109 -0
- package/dist/export.js.map +1 -0
- package/dist/git-workflow.d.ts +22 -0
- package/dist/git-workflow.js +197 -0
- package/dist/git-workflow.js.map +1 -0
- package/dist/hook-controls.d.ts +34 -0
- package/dist/hook-controls.js +90 -0
- package/dist/hook-controls.js.map +1 -0
- package/dist/hooks.d.ts +30 -0
- package/dist/hooks.js +130 -0
- package/dist/hooks.js.map +1 -0
- package/dist/html-parser.d.ts +18 -0
- package/dist/html-parser.js +101 -0
- package/dist/html-parser.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1230 -0
- package/dist/index.js.map +1 -0
- package/dist/learning.d.ts +35 -0
- package/dist/learning.js +238 -0
- package/dist/learning.js.map +1 -0
- package/dist/login.d.ts +37 -0
- package/dist/login.js +191 -0
- package/dist/login.js.map +1 -0
- package/dist/memory.d.ts +39 -0
- package/dist/memory.js +183 -0
- package/dist/memory.js.map +1 -0
- package/dist/model-router.d.ts +23 -0
- package/dist/model-router.js +145 -0
- package/dist/model-router.js.map +1 -0
- package/dist/modes.d.ts +17 -0
- package/dist/modes.js +217 -0
- package/dist/modes.js.map +1 -0
- package/dist/orchestration.d.ts +37 -0
- package/dist/orchestration.js +139 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/package-detect.d.ts +36 -0
- package/dist/package-detect.js +529 -0
- package/dist/package-detect.js.map +1 -0
- package/dist/permissions.d.ts +25 -0
- package/dist/permissions.js +50 -0
- package/dist/permissions.js.map +1 -0
- package/dist/pm2-manager.d.ts +40 -0
- package/dist/pm2-manager.js +127 -0
- package/dist/pm2-manager.js.map +1 -0
- package/dist/query.d.ts +15 -0
- package/dist/query.js +278 -0
- package/dist/query.js.map +1 -0
- package/dist/refactor.d.ts +22 -0
- package/dist/refactor.js +226 -0
- package/dist/refactor.js.map +1 -0
- package/dist/retry.d.ts +20 -0
- package/dist/retry.js +88 -0
- package/dist/retry.js.map +1 -0
- package/dist/rules.d.ts +34 -0
- package/dist/rules.js +942 -0
- package/dist/rules.js.map +1 -0
- package/dist/schema.d.ts +23 -0
- package/dist/schema.js +12 -0
- package/dist/schema.js.map +1 -0
- package/dist/search-first.d.ts +17 -0
- package/dist/search-first.js +301 -0
- package/dist/search-first.js.map +1 -0
- package/dist/security.d.ts +10 -0
- package/dist/security.js +145 -0
- package/dist/security.js.map +1 -0
- package/dist/sessions.d.ts +21 -0
- package/dist/sessions.js +112 -0
- package/dist/sessions.js.map +1 -0
- package/dist/skill-create.d.ts +38 -0
- package/dist/skill-create.js +389 -0
- package/dist/skill-create.js.map +1 -0
- package/dist/skills.d.ts +34 -0
- package/dist/skills.js +161 -0
- package/dist/skills.js.map +1 -0
- package/dist/strategic-compaction.d.ts +24 -0
- package/dist/strategic-compaction.js +144 -0
- package/dist/strategic-compaction.js.map +1 -0
- package/dist/system-prompt.d.ts +3 -0
- package/dist/system-prompt.js +101 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/theme.d.ts +60 -0
- package/dist/theme.js +220 -0
- package/dist/theme.js.map +1 -0
- package/dist/tools/bash.d.ts +2 -0
- package/dist/tools/bash.js +49 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.js +76 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +2 -0
- package/dist/tools/glob.js +54 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +2 -0
- package/dist/tools/grep.js +64 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-dir.d.ts +2 -0
- package/dist/tools/list-dir.js +51 -0
- package/dist/tools/list-dir.js.map +1 -0
- package/dist/tools/read.d.ts +2 -0
- package/dist/tools/read.js +56 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/types.d.ts +45 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +2 -0
- package/dist/tools/web-fetch.js +41 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +27 -0
- package/dist/tools/web-search.js +139 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.js +36 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.js +57 -0
- package/dist/types.js.map +1 -0
- package/dist/users.d.ts +51 -0
- package/dist/users.js +193 -0
- package/dist/users.js.map +1 -0
- package/dist/verification.d.ts +73 -0
- package/dist/verification.js +269 -0
- package/dist/verification.js.map +1 -0
- package/dist/walkthrough.d.ts +10 -0
- package/dist/walkthrough.js +121 -0
- package/dist/walkthrough.js.map +1 -0
- package/package.json +58 -0
- package/resources/ecc/agents/architect.json +16 -0
- package/resources/ecc/agents/architect.md +212 -0
- package/resources/ecc/agents/build-error-resolver.json +17 -0
- package/resources/ecc/agents/build-error-resolver.md +116 -0
- package/resources/ecc/agents/chief-of-staff.json +17 -0
- package/resources/ecc/agents/chief-of-staff.md +153 -0
- package/resources/ecc/agents/code-reviewer.json +16 -0
- package/resources/ecc/agents/code-reviewer.md +238 -0
- package/resources/ecc/agents/database-reviewer.json +16 -0
- package/resources/ecc/agents/database-reviewer.md +92 -0
- package/resources/ecc/agents/doc-updater.json +16 -0
- package/resources/ecc/agents/doc-updater.md +108 -0
- package/resources/ecc/agents/e2e-runner.json +17 -0
- package/resources/ecc/agents/e2e-runner.md +109 -0
- package/resources/ecc/agents/go-build-resolver.json +17 -0
- package/resources/ecc/agents/go-build-resolver.md +96 -0
- package/resources/ecc/agents/go-reviewer.json +16 -0
- package/resources/ecc/agents/go-reviewer.md +77 -0
- package/resources/ecc/agents/harness-optimizer.json +15 -0
- package/resources/ecc/agents/harness-optimizer.md +34 -0
- package/resources/ecc/agents/loop-operator.json +16 -0
- package/resources/ecc/agents/loop-operator.md +36 -0
- package/resources/ecc/agents/planner.json +15 -0
- package/resources/ecc/agents/planner.md +212 -0
- package/resources/ecc/agents/python-reviewer.json +16 -0
- package/resources/ecc/agents/python-reviewer.md +99 -0
- package/resources/ecc/agents/refactor-cleaner.json +17 -0
- package/resources/ecc/agents/refactor-cleaner.md +87 -0
- package/resources/ecc/agents/security-reviewer.json +16 -0
- package/resources/ecc/agents/security-reviewer.md +109 -0
- package/resources/ecc/agents/tdd-guide.json +17 -0
- package/resources/ecc/agents/tdd-guide.md +93 -0
- package/resources/ecc/commands/add-language-rules.md +39 -0
- package/resources/ecc/commands/database-migration.md +36 -0
- package/resources/ecc/commands/feature-development.md +38 -0
- package/resources/ecc/prompts/build-fix.prompt.md +47 -0
- package/resources/ecc/prompts/code-review.prompt.md +56 -0
- package/resources/ecc/prompts/plan.prompt.md +52 -0
- package/resources/ecc/prompts/refactor.prompt.md +50 -0
- package/resources/ecc/prompts/security-review.prompt.md +70 -0
- package/resources/ecc/prompts/tdd.prompt.md +47 -0
- package/resources/ecc/rules/common-agents.md +53 -0
- package/resources/ecc/rules/common-coding-style.md +52 -0
- package/resources/ecc/rules/common-development-workflow.md +33 -0
- package/resources/ecc/rules/common-git-workflow.md +28 -0
- package/resources/ecc/rules/common-hooks.md +34 -0
- package/resources/ecc/rules/common-patterns.md +35 -0
- package/resources/ecc/rules/common-performance.md +59 -0
- package/resources/ecc/rules/common-security.md +33 -0
- package/resources/ecc/rules/common-testing.md +33 -0
- package/resources/ecc/rules/golang-coding-style.md +31 -0
- package/resources/ecc/rules/golang-hooks.md +16 -0
- package/resources/ecc/rules/golang-patterns.md +44 -0
- package/resources/ecc/rules/golang-security.md +33 -0
- package/resources/ecc/rules/golang-testing.md +30 -0
- package/resources/ecc/rules/kotlin-coding-style.md +39 -0
- package/resources/ecc/rules/kotlin-hooks.md +16 -0
- package/resources/ecc/rules/kotlin-patterns.md +50 -0
- package/resources/ecc/rules/kotlin-security.md +58 -0
- package/resources/ecc/rules/kotlin-testing.md +38 -0
- package/resources/ecc/rules/php-coding-style.md +25 -0
- package/resources/ecc/rules/php-hooks.md +21 -0
- package/resources/ecc/rules/php-patterns.md +23 -0
- package/resources/ecc/rules/php-security.md +24 -0
- package/resources/ecc/rules/php-testing.md +26 -0
- package/resources/ecc/rules/python-coding-style.md +42 -0
- package/resources/ecc/rules/python-hooks.md +19 -0
- package/resources/ecc/rules/python-patterns.md +39 -0
- package/resources/ecc/rules/python-security.md +30 -0
- package/resources/ecc/rules/python-testing.md +38 -0
- package/resources/ecc/rules/swift-coding-style.md +47 -0
- package/resources/ecc/rules/swift-hooks.md +20 -0
- package/resources/ecc/rules/swift-patterns.md +66 -0
- package/resources/ecc/rules/swift-security.md +33 -0
- package/resources/ecc/rules/swift-testing.md +45 -0
- package/resources/ecc/rules/typescript-coding-style.md +63 -0
- package/resources/ecc/rules/typescript-hooks.md +20 -0
- package/resources/ecc/rules/typescript-patterns.md +50 -0
- package/resources/ecc/rules/typescript-security.md +26 -0
- package/resources/ecc/rules/typescript-testing.md +16 -0
- package/resources/ecc/skills/agent-introspection-debugging/SKILL.md +152 -0
- package/resources/ecc/skills/agent-introspection-debugging/agents/openai.yaml +7 -0
- package/resources/ecc/skills/agent-sort/SKILL.md +214 -0
- package/resources/ecc/skills/agent-sort/agents/openai.yaml +7 -0
- package/resources/ecc/skills/api-design/SKILL.md +522 -0
- package/resources/ecc/skills/api-design/agents/openai.yaml +7 -0
- package/resources/ecc/skills/article-writing/SKILL.md +78 -0
- package/resources/ecc/skills/article-writing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/backend-patterns/SKILL.md +597 -0
- package/resources/ecc/skills/backend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/SKILL.md +96 -0
- package/resources/ecc/skills/brand-voice/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/references/voice-profile-schema.md +55 -0
- package/resources/ecc/skills/bun-runtime/SKILL.md +83 -0
- package/resources/ecc/skills/bun-runtime/agents/openai.yaml +7 -0
- package/resources/ecc/skills/coding-standards/SKILL.md +548 -0
- package/resources/ecc/skills/coding-standards/agents/openai.yaml +7 -0
- package/resources/ecc/skills/content-engine/SKILL.md +130 -0
- package/resources/ecc/skills/content-engine/agents/openai.yaml +7 -0
- package/resources/ecc/skills/crosspost/SKILL.md +110 -0
- package/resources/ecc/skills/crosspost/agents/openai.yaml +7 -0
- package/resources/ecc/skills/deep-research/SKILL.md +154 -0
- package/resources/ecc/skills/deep-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/dmux-workflows/SKILL.md +143 -0
- package/resources/ecc/skills/dmux-workflows/agents/openai.yaml +7 -0
- package/resources/ecc/skills/documentation-lookup/SKILL.md +89 -0
- package/resources/ecc/skills/documentation-lookup/agents/openai.yaml +7 -0
- package/resources/ecc/skills/e2e-testing/SKILL.md +325 -0
- package/resources/ecc/skills/e2e-testing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/eval-harness/SKILL.md +235 -0
- package/resources/ecc/skills/eval-harness/agents/openai.yaml +7 -0
- package/resources/ecc/skills/everything-claude-code/SKILL.md +442 -0
- package/resources/ecc/skills/everything-claude-code/agents/openai.yaml +7 -0
- package/resources/ecc/skills/exa-search/SKILL.md +169 -0
- package/resources/ecc/skills/exa-search/agents/openai.yaml +7 -0
- package/resources/ecc/skills/fal-ai-media/SKILL.md +276 -0
- package/resources/ecc/skills/fal-ai-media/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-patterns/SKILL.md +647 -0
- package/resources/ecc/skills/frontend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-slides/SKILL.md +183 -0
- package/resources/ecc/skills/frontend-slides/STYLE_PRESETS.md +330 -0
- package/resources/ecc/skills/frontend-slides/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-materials/SKILL.md +95 -0
- package/resources/ecc/skills/investor-materials/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-outreach/SKILL.md +90 -0
- package/resources/ecc/skills/investor-outreach/agents/openai.yaml +7 -0
- package/resources/ecc/skills/market-research/SKILL.md +74 -0
- package/resources/ecc/skills/market-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mcp-server-patterns/SKILL.md +66 -0
- package/resources/ecc/skills/mcp-server-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mle-workflow/SKILL.md +346 -0
- package/resources/ecc/skills/mle-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/nextjs-turbopack/SKILL.md +43 -0
- package/resources/ecc/skills/nextjs-turbopack/agents/openai.yaml +7 -0
- package/resources/ecc/skills/product-capability/SKILL.md +140 -0
- package/resources/ecc/skills/product-capability/agents/openai.yaml +7 -0
- package/resources/ecc/skills/security-review/SKILL.md +494 -0
- package/resources/ecc/skills/security-review/agents/openai.yaml +7 -0
- package/resources/ecc/skills/strategic-compact/SKILL.md +102 -0
- package/resources/ecc/skills/strategic-compact/agents/openai.yaml +7 -0
- package/resources/ecc/skills/tdd-workflow/SKILL.md +409 -0
- package/resources/ecc/skills/tdd-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/verification-loop/SKILL.md +125 -0
- package/resources/ecc/skills/verification-loop/agents/openai.yaml +7 -0
- package/resources/ecc/skills/video-editing/SKILL.md +307 -0
- package/resources/ecc/skills/video-editing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/x-api/SKILL.md +229 -0
- package/resources/ecc/skills/x-api/agents/openai.yaml +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,M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AAE,CAAC,CAAC,CAAC;IAChC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/memory.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Message } from './types.js';
|
|
2
|
+
export interface MemoryEntry {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
category: 'project' | 'preference' | 'context' | 'decision';
|
|
6
|
+
sessionId: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
accessCount: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Save or update a memory entry.
|
|
12
|
+
*/
|
|
13
|
+
export declare function saveMemory(key: string, value: string, category: MemoryEntry['category'], sessionId: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Load a memory entry by key.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadMemory(key: string): MemoryEntry | null;
|
|
18
|
+
/**
|
|
19
|
+
* Search memories by keyword across all entries.
|
|
20
|
+
*/
|
|
21
|
+
export declare function searchMemory(query: string): MemoryEntry[];
|
|
22
|
+
/**
|
|
23
|
+
* Get all memories for a specific project (by cwd path).
|
|
24
|
+
*/
|
|
25
|
+
export declare function getProjectMemory(cwd: string): MemoryEntry[];
|
|
26
|
+
/**
|
|
27
|
+
* Called at session start — returns a context string to inject into system prompt.
|
|
28
|
+
* Loads relevant memories for the given project.
|
|
29
|
+
*/
|
|
30
|
+
export declare function onSessionStart(sessionId: string, cwd: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Called at session end — auto-extract key decisions and context from conversation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function onSessionEnd(sessionId: string, messages: Message[], cwd: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Remove memories older than maxAge days.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pruneOldMemories(maxAge: number): number;
|
|
39
|
+
export declare function printMemoryStatus(): void;
|
package/dist/memory.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced memory persistence — session-aware memory that persists key context across sessions.
|
|
3
|
+
* Data stored in ~/.crowcoder/memory/
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync, writeFileSync, readdirSync, mkdirSync, existsSync, unlinkSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { getConfigDir } from './config.js';
|
|
9
|
+
const MEMORY_DIR = join(getConfigDir(), 'memory');
|
|
10
|
+
function ensureDir() {
|
|
11
|
+
mkdirSync(MEMORY_DIR, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
function memoryPath(key) {
|
|
14
|
+
// Sanitize key for filesystem
|
|
15
|
+
const sanitized = key.replace(/[/\\:*?"<>|]/g, '_');
|
|
16
|
+
return join(MEMORY_DIR, `${sanitized}.json`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Save or update a memory entry.
|
|
20
|
+
*/
|
|
21
|
+
export function saveMemory(key, value, category, sessionId) {
|
|
22
|
+
ensureDir();
|
|
23
|
+
const entry = {
|
|
24
|
+
key,
|
|
25
|
+
value,
|
|
26
|
+
category,
|
|
27
|
+
sessionId,
|
|
28
|
+
createdAt: new Date().toISOString(),
|
|
29
|
+
accessCount: 0,
|
|
30
|
+
};
|
|
31
|
+
writeFileSync(memoryPath(key), JSON.stringify(entry, null, 2), 'utf-8');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Load a memory entry by key.
|
|
35
|
+
*/
|
|
36
|
+
export function loadMemory(key) {
|
|
37
|
+
const p = memoryPath(key);
|
|
38
|
+
if (!existsSync(p))
|
|
39
|
+
return null;
|
|
40
|
+
try {
|
|
41
|
+
const entry = JSON.parse(readFileSync(p, 'utf-8'));
|
|
42
|
+
entry.accessCount++;
|
|
43
|
+
writeFileSync(p, JSON.stringify(entry, null, 2), 'utf-8');
|
|
44
|
+
return entry;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Search memories by keyword across all entries.
|
|
52
|
+
*/
|
|
53
|
+
export function searchMemory(query) {
|
|
54
|
+
ensureDir();
|
|
55
|
+
const files = readdirSync(MEMORY_DIR).filter((f) => f.endsWith('.json'));
|
|
56
|
+
const results = [];
|
|
57
|
+
const queryLower = query.toLowerCase();
|
|
58
|
+
for (const file of files) {
|
|
59
|
+
try {
|
|
60
|
+
const entry = JSON.parse(readFileSync(join(MEMORY_DIR, file), 'utf-8'));
|
|
61
|
+
const text = `${entry.key} ${entry.value} ${entry.category}`.toLowerCase();
|
|
62
|
+
if (text.includes(queryLower)) {
|
|
63
|
+
results.push(entry);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { /* skip */ }
|
|
67
|
+
}
|
|
68
|
+
return results.sort((a, b) => b.accessCount - a.accessCount);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get all memories for a specific project (by cwd path).
|
|
72
|
+
*/
|
|
73
|
+
export function getProjectMemory(cwd) {
|
|
74
|
+
ensureDir();
|
|
75
|
+
const files = readdirSync(MEMORY_DIR).filter((f) => f.endsWith('.json'));
|
|
76
|
+
const results = [];
|
|
77
|
+
for (const file of files) {
|
|
78
|
+
try {
|
|
79
|
+
const entry = JSON.parse(readFileSync(join(MEMORY_DIR, file), 'utf-8'));
|
|
80
|
+
// Match project memories by key pattern (e.g., "project:/path/to/project")
|
|
81
|
+
if (entry.key.startsWith(`project:${cwd}`) || entry.category === 'project') {
|
|
82
|
+
results.push(entry);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch { /* skip */ }
|
|
86
|
+
}
|
|
87
|
+
return results.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Called at session start — returns a context string to inject into system prompt.
|
|
91
|
+
* Loads relevant memories for the given project.
|
|
92
|
+
*/
|
|
93
|
+
export function onSessionStart(sessionId, cwd) {
|
|
94
|
+
const projectMemories = getProjectMemory(cwd);
|
|
95
|
+
if (projectMemories.length === 0)
|
|
96
|
+
return '';
|
|
97
|
+
const lines = [
|
|
98
|
+
'## Relevant Project Context from Previous Sessions:',
|
|
99
|
+
];
|
|
100
|
+
for (const mem of projectMemories.slice(0, 10)) {
|
|
101
|
+
lines.push(`- [${mem.category}] ${mem.key}: ${mem.value}`);
|
|
102
|
+
}
|
|
103
|
+
return lines.join('\n');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Called at session end — auto-extract key decisions and context from conversation.
|
|
107
|
+
*/
|
|
108
|
+
export function onSessionEnd(sessionId, messages, cwd) {
|
|
109
|
+
// Extract key decision points and context
|
|
110
|
+
for (let i = 0; i < messages.length; i++) {
|
|
111
|
+
const msg = messages[i];
|
|
112
|
+
// Look for user messages that indicate decisions
|
|
113
|
+
if (msg.role === 'user' && typeof msg.content === 'string') {
|
|
114
|
+
const text = msg.content.toLowerCase();
|
|
115
|
+
// Decision keywords
|
|
116
|
+
if (text.includes('decided') || text.includes('decided to') || text.includes('we will')) {
|
|
117
|
+
const key = `decision:${sessionId}:${i}`;
|
|
118
|
+
saveMemory(key, msg.content.slice(0, 500), 'decision', sessionId);
|
|
119
|
+
}
|
|
120
|
+
// Project context
|
|
121
|
+
if (text.includes('project') || text.includes('codebase') || text.includes('architecture')) {
|
|
122
|
+
const key = `project:${cwd}:context:${i}`;
|
|
123
|
+
saveMemory(key, msg.content.slice(0, 500), 'project', sessionId);
|
|
124
|
+
}
|
|
125
|
+
// User preferences
|
|
126
|
+
if (text.includes('prefer') || text.includes('prefer ') || text.includes('always')) {
|
|
127
|
+
const key = `preference:${sessionId}:${i}`;
|
|
128
|
+
saveMemory(key, msg.content.slice(0, 500), 'preference', sessionId);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Remove memories older than maxAge days.
|
|
135
|
+
*/
|
|
136
|
+
export function pruneOldMemories(maxAge) {
|
|
137
|
+
ensureDir();
|
|
138
|
+
const files = readdirSync(MEMORY_DIR).filter((f) => f.endsWith('.json'));
|
|
139
|
+
const now = new Date();
|
|
140
|
+
let pruned = 0;
|
|
141
|
+
for (const file of files) {
|
|
142
|
+
const p = join(MEMORY_DIR, file);
|
|
143
|
+
try {
|
|
144
|
+
const entry = JSON.parse(readFileSync(p, 'utf-8'));
|
|
145
|
+
const age = (now.getTime() - new Date(entry.createdAt).getTime()) / (1000 * 60 * 60 * 24);
|
|
146
|
+
if (age > maxAge) {
|
|
147
|
+
unlinkSync(p);
|
|
148
|
+
pruned++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch { /* skip */ }
|
|
152
|
+
}
|
|
153
|
+
return pruned;
|
|
154
|
+
}
|
|
155
|
+
export function printMemoryStatus() {
|
|
156
|
+
ensureDir();
|
|
157
|
+
const files = readdirSync(MEMORY_DIR).filter((f) => f.endsWith('.json'));
|
|
158
|
+
const entries = [];
|
|
159
|
+
for (const file of files) {
|
|
160
|
+
try {
|
|
161
|
+
entries.push(JSON.parse(readFileSync(join(MEMORY_DIR, file), 'utf-8')));
|
|
162
|
+
}
|
|
163
|
+
catch { /* skip */ }
|
|
164
|
+
}
|
|
165
|
+
console.log(chalk.cyan(`\n Memory: ${entries.length} entries`));
|
|
166
|
+
const byCat = new Map();
|
|
167
|
+
for (const e of entries) {
|
|
168
|
+
byCat.set(e.category, (byCat.get(e.category) || 0) + 1);
|
|
169
|
+
}
|
|
170
|
+
for (const [cat, count] of Array.from(byCat.entries()).sort((a, b) => b[1] - a[1])) {
|
|
171
|
+
console.log(chalk.dim(` ${cat}: ${count}`));
|
|
172
|
+
}
|
|
173
|
+
if (entries.length > 0) {
|
|
174
|
+
console.log(chalk.dim(`\n Most accessed:`));
|
|
175
|
+
const byAccess = entries.sort((a, b) => b.accessCount - a.accessCount);
|
|
176
|
+
for (const entry of byAccess.slice(0, 5)) {
|
|
177
|
+
const valuePreview = entry.value.slice(0, 50).replace(/\n/g, ' ');
|
|
178
|
+
console.log(chalk.dim(` [${entry.accessCount}x] ${entry.key}: ${valuePreview}...`));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
console.log();
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;AAWlD,SAAS,SAAS;IAChB,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,8BAA8B;IAC9B,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,GAAW,EACX,KAAa,EACb,QAAiC,EACjC,SAAiB;IAEjB,SAAS,EAAE,CAAC;IAEZ,MAAM,KAAK,GAAgB;QACzB,GAAG;QACH,KAAK;QACL,QAAQ;QACR,SAAS;QACT,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,WAAW,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KAAK,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,WAAW,MAAM,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CrowcoderConfig } from './types.js';
|
|
2
|
+
export interface ModelOption {
|
|
3
|
+
id: string;
|
|
4
|
+
tier: 'fast' | 'balanced' | 'powerful';
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export type TaskComplexity = 'simple' | 'medium' | 'complex';
|
|
8
|
+
/**
|
|
9
|
+
* Classify task complexity from the user's message.
|
|
10
|
+
*/
|
|
11
|
+
export declare function classifyComplexity(message: string): TaskComplexity;
|
|
12
|
+
/**
|
|
13
|
+
* Suggest the best model for a given complexity and provider.
|
|
14
|
+
*/
|
|
15
|
+
export declare function routeModel(config: CrowcoderConfig, complexity: TaskComplexity): {
|
|
16
|
+
model: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function printModelOptions(config: CrowcoderConfig): void;
|
|
20
|
+
/**
|
|
21
|
+
* Switch to a model by name or tier.
|
|
22
|
+
*/
|
|
23
|
+
export declare function switchModel(config: CrowcoderConfig, nameOrTier: string): string | null;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model router — cost-aware model selection.
|
|
3
|
+
* Routes to cheaper models for simple tasks, expensive for complex ones.
|
|
4
|
+
*/
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { getModelCost } from './cost-tracker.js';
|
|
7
|
+
// Provider-specific model tiers
|
|
8
|
+
const MODEL_TIERS = {
|
|
9
|
+
openrouter: [
|
|
10
|
+
{ id: 'anthropic/claude-haiku-4', tier: 'fast', description: 'Claude Haiku — fast, cheap' },
|
|
11
|
+
{ id: 'anthropic/claude-sonnet-4', tier: 'balanced', description: 'Claude Sonnet — balanced' },
|
|
12
|
+
{ id: 'anthropic/claude-opus-4', tier: 'powerful', description: 'Claude Opus — most capable' },
|
|
13
|
+
{ id: 'openai/gpt-4o-mini', tier: 'fast', description: 'GPT-4o Mini — fast, cheap' },
|
|
14
|
+
{ id: 'openai/gpt-4o', tier: 'balanced', description: 'GPT-4o — balanced' },
|
|
15
|
+
{ id: 'google/gemini-2.5-flash', tier: 'fast', description: 'Gemini Flash — fast, cheap' },
|
|
16
|
+
{ id: 'google/gemini-2.5-pro', tier: 'powerful', description: 'Gemini Pro — powerful' },
|
|
17
|
+
{ id: 'deepseek/deepseek-chat', tier: 'fast', description: 'DeepSeek V3 — very cheap' },
|
|
18
|
+
{ id: 'meta-llama/llama-4-maverick', tier: 'balanced', description: 'Llama 4 Maverick — open' },
|
|
19
|
+
],
|
|
20
|
+
openai: [
|
|
21
|
+
{ id: 'gpt-4o-mini', tier: 'fast', description: 'GPT-4o Mini' },
|
|
22
|
+
{ id: 'gpt-4o', tier: 'balanced', description: 'GPT-4o' },
|
|
23
|
+
{ id: 'o3-mini', tier: 'powerful', description: 'o3-mini (reasoning)' },
|
|
24
|
+
],
|
|
25
|
+
glm: [
|
|
26
|
+
{ id: 'glm-4-flash', tier: 'fast', description: 'GLM-4 Flash' },
|
|
27
|
+
{ id: 'glm-4-plus', tier: 'balanced', description: 'GLM-4 Plus' },
|
|
28
|
+
{ id: 'glm-4-long', tier: 'powerful', description: 'GLM-4 Long (128k context)' },
|
|
29
|
+
],
|
|
30
|
+
deepseek: [
|
|
31
|
+
{ id: 'deepseek-chat', tier: 'fast', description: 'DeepSeek Chat — fast' },
|
|
32
|
+
{ id: 'deepseek-reasoner', tier: 'powerful', description: 'DeepSeek Reasoner — R1' },
|
|
33
|
+
],
|
|
34
|
+
ollama: [
|
|
35
|
+
{ id: 'qwen2.5-coder:latest', tier: 'fast', description: 'Qwen 2.5 Coder (local)' },
|
|
36
|
+
{ id: 'deepseek-coder-v2:latest', tier: 'balanced', description: 'DeepSeek Coder v2 (local)' },
|
|
37
|
+
{ id: 'llama3.3:latest', tier: 'powerful', description: 'Llama 3.3 (local)' },
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Classify task complexity from the user's message.
|
|
42
|
+
*/
|
|
43
|
+
export function classifyComplexity(message) {
|
|
44
|
+
const lower = message.toLowerCase();
|
|
45
|
+
// Simple: short messages, single operations, questions
|
|
46
|
+
const simpleSignals = [
|
|
47
|
+
/^(what|how|why|where|when|who|which|list|show|print|explain)\b/,
|
|
48
|
+
/^(read|cat|ls|find|search|grep|look)\b/,
|
|
49
|
+
/\?([\s]*$)/,
|
|
50
|
+
/^(yes|no|ok|sure|thanks|y|n)\b/i,
|
|
51
|
+
];
|
|
52
|
+
if (message.length < 100 && simpleSignals.some((r) => r.test(lower))) {
|
|
53
|
+
return 'simple';
|
|
54
|
+
}
|
|
55
|
+
// Complex: multi-step, architecture, large changes
|
|
56
|
+
const complexSignals = [
|
|
57
|
+
/\b(refactor|rewrite|architect|redesign|migrate|implement|build|create .+ system)\b/,
|
|
58
|
+
/\b(entire|whole|all files|full|complete|comprehensive)\b/,
|
|
59
|
+
/\b(performance|security audit|review all|test all)\b/,
|
|
60
|
+
/and\b.*\band\b.*\band\b/, // multiple "and"s = multi-part request
|
|
61
|
+
];
|
|
62
|
+
if (complexSignals.some((r) => r.test(lower))) {
|
|
63
|
+
return 'complex';
|
|
64
|
+
}
|
|
65
|
+
return 'medium';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Map provider display names to tier keys
|
|
69
|
+
*/
|
|
70
|
+
function getProviderKey(displayName) {
|
|
71
|
+
const map = {
|
|
72
|
+
'openrouter': 'openrouter',
|
|
73
|
+
'glm (zhipuai)': 'glm',
|
|
74
|
+
'glm': 'glm',
|
|
75
|
+
'ollama (local)': 'ollama',
|
|
76
|
+
'ollama': 'ollama',
|
|
77
|
+
'lm studio': 'lmstudio',
|
|
78
|
+
'lmstudio': 'lmstudio',
|
|
79
|
+
'openai': 'openai',
|
|
80
|
+
'deepseek': 'deepseek',
|
|
81
|
+
'custom': 'custom',
|
|
82
|
+
};
|
|
83
|
+
const key = displayName.toLowerCase();
|
|
84
|
+
return map[key] || key.replace(/[^a-z]/g, '');
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Suggest the best model for a given complexity and provider.
|
|
88
|
+
*/
|
|
89
|
+
export function routeModel(config, complexity) {
|
|
90
|
+
const provider = getProviderKey(config.provider);
|
|
91
|
+
const tiers = MODEL_TIERS[provider];
|
|
92
|
+
if (!tiers) {
|
|
93
|
+
return { model: config.model, reason: 'No routing available for this provider' };
|
|
94
|
+
}
|
|
95
|
+
const tierMap = {
|
|
96
|
+
simple: 'fast',
|
|
97
|
+
medium: 'balanced',
|
|
98
|
+
complex: 'powerful',
|
|
99
|
+
};
|
|
100
|
+
const targetTier = tierMap[complexity];
|
|
101
|
+
const match = tiers.find((m) => m.tier === targetTier);
|
|
102
|
+
if (!match) {
|
|
103
|
+
return { model: config.model, reason: 'No matching model tier' };
|
|
104
|
+
}
|
|
105
|
+
const cost = getModelCost(match.id);
|
|
106
|
+
return {
|
|
107
|
+
model: match.id,
|
|
108
|
+
reason: `${complexity} task → ${match.description} ($${cost.input}/$${cost.output} per 1M tokens)`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export function printModelOptions(config) {
|
|
112
|
+
const provider = getProviderKey(config.provider);
|
|
113
|
+
const tiers = MODEL_TIERS[provider] || [];
|
|
114
|
+
console.log(chalk.cyan(`\n Models for ${config.provider}:`));
|
|
115
|
+
const current = config.model;
|
|
116
|
+
for (const m of tiers) {
|
|
117
|
+
const marker = m.id === current ? chalk.green(' ◀ current') : '';
|
|
118
|
+
const cost = getModelCost(m.id);
|
|
119
|
+
console.log(chalk.white(` ${m.tier.padEnd(10)}`) +
|
|
120
|
+
chalk.dim(`${m.id.padEnd(35)} $${cost.input}/$${cost.output} per 1M`) +
|
|
121
|
+
marker);
|
|
122
|
+
}
|
|
123
|
+
console.log();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Switch to a model by name or tier.
|
|
127
|
+
*/
|
|
128
|
+
export function switchModel(config, nameOrTier) {
|
|
129
|
+
const provider = getProviderKey(config.provider);
|
|
130
|
+
const tiers = MODEL_TIERS[provider] || [];
|
|
131
|
+
// Try exact match first
|
|
132
|
+
const exact = tiers.find((m) => m.id === nameOrTier);
|
|
133
|
+
if (exact)
|
|
134
|
+
return exact.id;
|
|
135
|
+
// Try tier match
|
|
136
|
+
const tier = tiers.find((m) => m.tier === nameOrTier);
|
|
137
|
+
if (tier)
|
|
138
|
+
return tier.id;
|
|
139
|
+
// Try partial match
|
|
140
|
+
const partial = tiers.find((m) => m.id.includes(nameOrTier) || m.description.toLowerCase().includes(nameOrTier.toLowerCase()));
|
|
141
|
+
if (partial)
|
|
142
|
+
return partial.id;
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=model-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-router.js","sourceRoot":"","sources":["../src/model-router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQjD,gCAAgC;AAChC,MAAM,WAAW,GAAkC;IACjD,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,4BAA4B,EAAE;QAC3F,EAAE,EAAE,EAAE,2BAA2B,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC9F,EAAE,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,4BAA4B,EAAE;QAC9F,EAAE,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE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EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC;IACrD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC;IAE3B,iBAAiB;IACjB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IACtD,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,EAAE,CAAC;IAEzB,oBAAoB;IACpB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC/H,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IAE/B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/modes.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic modes — dev/review/TDD/research/plan mode switching.
|
|
3
|
+
* Each mode injects specialized system prompt additions and behavior.
|
|
4
|
+
*/
|
|
5
|
+
export type Mode = 'dev' | 'review' | 'tdd' | 'research' | 'plan' | 'debug' | 'architect' | 'hermes';
|
|
6
|
+
export interface ModeConfig {
|
|
7
|
+
name: Mode;
|
|
8
|
+
label: string;
|
|
9
|
+
description: string;
|
|
10
|
+
systemPromptAddition: string;
|
|
11
|
+
suggestedTools: string[];
|
|
12
|
+
temperature?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const MODES: Record<Mode, ModeConfig>;
|
|
15
|
+
export declare function getMode(name: string): ModeConfig | undefined;
|
|
16
|
+
export declare function getModePromptAddition(mode: Mode): string;
|
|
17
|
+
export declare function listModes(): ModeConfig[];
|
package/dist/modes.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic modes — dev/review/TDD/research/plan mode switching.
|
|
3
|
+
* Each mode injects specialized system prompt additions and behavior.
|
|
4
|
+
*/
|
|
5
|
+
export const MODES = {
|
|
6
|
+
dev: {
|
|
7
|
+
name: 'dev',
|
|
8
|
+
label: 'Development',
|
|
9
|
+
description: 'General coding — write features, fix bugs, refactor',
|
|
10
|
+
systemPromptAddition: `
|
|
11
|
+
# Mode: Development
|
|
12
|
+
You are in development mode. Focus on:
|
|
13
|
+
- Writing clean, correct, secure code
|
|
14
|
+
- Following existing patterns in the codebase
|
|
15
|
+
- Making minimal changes to achieve the goal
|
|
16
|
+
- Testing your changes work before considering them done
|
|
17
|
+
- Reading files before editing them`,
|
|
18
|
+
suggestedTools: ['bash', 'read_file', 'edit_file', 'write_file', 'grep', 'glob'],
|
|
19
|
+
},
|
|
20
|
+
review: {
|
|
21
|
+
name: 'review',
|
|
22
|
+
label: 'Code Review',
|
|
23
|
+
description: 'Review code for quality, security, and correctness',
|
|
24
|
+
systemPromptAddition: `
|
|
25
|
+
# Mode: Code Review
|
|
26
|
+
You are in code review mode. For every piece of code you examine:
|
|
27
|
+
1. **Correctness**: Does it do what it claims? Edge cases? Off-by-one errors?
|
|
28
|
+
2. **Security**: SQL injection, XSS, command injection, path traversal, secrets in code?
|
|
29
|
+
3. **Performance**: N+1 queries, unbounded loops, memory leaks, missing indexes?
|
|
30
|
+
4. **Maintainability**: Clear naming, reasonable complexity, no dead code?
|
|
31
|
+
5. **Testing**: Are tests adequate? What's untested?
|
|
32
|
+
|
|
33
|
+
Rate each file: PASS / WARN / FAIL with specific line-level feedback.
|
|
34
|
+
Output a structured review with severity levels: critical / high / medium / low / nit.`,
|
|
35
|
+
suggestedTools: ['read_file', 'grep', 'glob', 'bash'],
|
|
36
|
+
},
|
|
37
|
+
tdd: {
|
|
38
|
+
name: 'tdd',
|
|
39
|
+
label: 'Test-Driven Development',
|
|
40
|
+
description: 'Write tests first, then make them pass',
|
|
41
|
+
systemPromptAddition: `
|
|
42
|
+
# Mode: Test-Driven Development
|
|
43
|
+
Follow the strict TDD cycle:
|
|
44
|
+
1. **RED**: Write a failing test that defines the desired behavior
|
|
45
|
+
2. **GREEN**: Write the minimal code to make the test pass
|
|
46
|
+
3. **REFACTOR**: Clean up without changing behavior, ensure tests still pass
|
|
47
|
+
|
|
48
|
+
Rules:
|
|
49
|
+
- NEVER write implementation before a failing test
|
|
50
|
+
- Each test should test ONE behavior
|
|
51
|
+
- Run tests after every change
|
|
52
|
+
- Keep the feedback loop tight: write test → run → fail → implement → run → pass → refactor`,
|
|
53
|
+
suggestedTools: ['bash', 'write_file', 'edit_file', 'read_file'],
|
|
54
|
+
temperature: 0.2,
|
|
55
|
+
},
|
|
56
|
+
research: {
|
|
57
|
+
name: 'research',
|
|
58
|
+
label: 'Research',
|
|
59
|
+
description: 'Explore codebases, read docs, understand systems',
|
|
60
|
+
systemPromptAddition: `
|
|
61
|
+
# Mode: Research
|
|
62
|
+
You are in research/exploration mode. Focus on:
|
|
63
|
+
- Reading and understanding code thoroughly before suggesting changes
|
|
64
|
+
- Tracing execution paths and data flow
|
|
65
|
+
- Mapping dependencies and architecture
|
|
66
|
+
- Summarizing findings clearly
|
|
67
|
+
- DO NOT modify files unless explicitly asked — read only
|
|
68
|
+
- Use grep and glob extensively to find relevant code
|
|
69
|
+
- Build a mental map and share it with the user`,
|
|
70
|
+
suggestedTools: ['read_file', 'grep', 'glob', 'list_dir', 'web_fetch'],
|
|
71
|
+
temperature: 0.4,
|
|
72
|
+
},
|
|
73
|
+
plan: {
|
|
74
|
+
name: 'plan',
|
|
75
|
+
label: 'Planning',
|
|
76
|
+
description: 'Design implementation plans before coding',
|
|
77
|
+
systemPromptAddition: `
|
|
78
|
+
# Mode: Planning
|
|
79
|
+
You are in planning mode. Help the user design before building:
|
|
80
|
+
1. **Understand**: Read relevant code, understand the current state
|
|
81
|
+
2. **Options**: Present 2-3 implementation approaches with trade-offs
|
|
82
|
+
3. **Plan**: Write a step-by-step implementation plan
|
|
83
|
+
4. **Files**: List every file that needs to change and what changes
|
|
84
|
+
5. **Risks**: Identify risks, edge cases, and migration concerns
|
|
85
|
+
|
|
86
|
+
DO NOT write code in this mode. Only produce plans.
|
|
87
|
+
Format plans as numbered steps with file paths and descriptions.`,
|
|
88
|
+
suggestedTools: ['read_file', 'grep', 'glob', 'list_dir'],
|
|
89
|
+
temperature: 0.5,
|
|
90
|
+
},
|
|
91
|
+
debug: {
|
|
92
|
+
name: 'debug',
|
|
93
|
+
label: 'Debug',
|
|
94
|
+
description: 'Systematic debugging of issues',
|
|
95
|
+
systemPromptAddition: `
|
|
96
|
+
# Mode: Debug
|
|
97
|
+
You are in debugging mode. Follow a systematic approach:
|
|
98
|
+
1. **Reproduce**: Understand and reproduce the bug
|
|
99
|
+
2. **Hypothesize**: Form hypotheses about root cause
|
|
100
|
+
3. **Test**: Check each hypothesis with targeted reads/searches
|
|
101
|
+
4. **Isolate**: Narrow down to the exact line/function
|
|
102
|
+
5. **Fix**: Apply minimal fix
|
|
103
|
+
6. **Verify**: Confirm the fix works and doesn't break other things
|
|
104
|
+
|
|
105
|
+
Use logs, error messages, and stack traces. Check git blame for recent changes.
|
|
106
|
+
Never guess — always verify with evidence.`,
|
|
107
|
+
suggestedTools: ['bash', 'read_file', 'grep', 'glob', 'edit_file'],
|
|
108
|
+
temperature: 0.2,
|
|
109
|
+
},
|
|
110
|
+
architect: {
|
|
111
|
+
name: 'architect',
|
|
112
|
+
label: 'Architect',
|
|
113
|
+
description: 'System design and architecture decisions',
|
|
114
|
+
systemPromptAddition: `
|
|
115
|
+
# Mode: Architect
|
|
116
|
+
You are in architecture mode. Help with system-level decisions:
|
|
117
|
+
- Component boundaries and interfaces
|
|
118
|
+
- Data flow and state management
|
|
119
|
+
- Technology choices and trade-offs
|
|
120
|
+
- Scalability and performance considerations
|
|
121
|
+
- Security architecture
|
|
122
|
+
- API design (REST, GraphQL, gRPC)
|
|
123
|
+
- Database schema design
|
|
124
|
+
- Infrastructure and deployment
|
|
125
|
+
|
|
126
|
+
Think at the system level. Draw diagrams using ASCII art or Mermaid syntax.
|
|
127
|
+
Consider both current needs and reasonable future growth.`,
|
|
128
|
+
suggestedTools: ['read_file', 'grep', 'glob', 'list_dir', 'web_fetch'],
|
|
129
|
+
temperature: 0.5,
|
|
130
|
+
},
|
|
131
|
+
hermes: {
|
|
132
|
+
name: 'hermes',
|
|
133
|
+
label: 'Hermes (Growing Agent)',
|
|
134
|
+
description: 'Self-improving loop — search prior work, learn skills from experience, model the user, parallelize, persist knowledge. Inspired by nousresearch/hermes-agent.',
|
|
135
|
+
systemPromptAddition: `
|
|
136
|
+
# Mode: Hermes — The Agent That Grows With You
|
|
137
|
+
|
|
138
|
+
You operate as a continuously-learning agent. The current session is one link in
|
|
139
|
+
a chain — your effectiveness depends on what you remember from prior chains and
|
|
140
|
+
what you bank for the next one. Inspired by nousresearch/hermes-agent.
|
|
141
|
+
|
|
142
|
+
## Core loop — every turn, in order
|
|
143
|
+
|
|
144
|
+
1. **Recall first.** Before answering anything non-trivial, check what already
|
|
145
|
+
exists: search prior session memory (\`/memory\`), look up matching instincts
|
|
146
|
+
(\`/instincts\`), and scan the skill library (\`/skills\`) for relevant patterns.
|
|
147
|
+
Do not propose work that duplicates a learned skill — invoke the skill.
|
|
148
|
+
|
|
149
|
+
2. **Model the user.** Track who you're working with: their stack, vocabulary,
|
|
150
|
+
constraints, recurring goals, and the things they've corrected you on. When
|
|
151
|
+
you notice a stable preference ("user always rejects emoji in code", "user
|
|
152
|
+
prefers integration tests over mocks"), surface it briefly and persist it as
|
|
153
|
+
feedback via \`/learn\`.
|
|
154
|
+
|
|
155
|
+
3. **Act in parallel when independent.** If a task decomposes into independent
|
|
156
|
+
subtasks (multi-file edits, multi-service investigations, parallel research
|
|
157
|
+
questions), use \`/orchestrate\` or the multi-agent prompts (\`/multi-plan\`,
|
|
158
|
+
\`/multi-execute\`, \`/multi-backend\`, \`/multi-frontend\`) instead of doing
|
|
159
|
+
them sequentially.
|
|
160
|
+
|
|
161
|
+
4. **Distill skills from experience.** After any non-trivial completed task,
|
|
162
|
+
ask yourself: *"Will I want to do this again?"* If yes, extract the pattern
|
|
163
|
+
via \`/learn\` (raw instinct) or \`/skill-create\` (reusable skill from git
|
|
164
|
+
history). High-confidence instincts evolve into skills via \`/evolve\`.
|
|
165
|
+
|
|
166
|
+
5. **Nudge to persist.** At the end of substantive work, propose what's worth
|
|
167
|
+
keeping: a new skill, an updated rule, a checkpoint (\`/checkpoint\`), a
|
|
168
|
+
scheduled follow-up. Don't just finish — bank the lesson.
|
|
169
|
+
|
|
170
|
+
6. **Schedule the unattended.** If a task has a natural follow-up that doesn't
|
|
171
|
+
need to happen right now (a verification window, a watchdog, a periodic
|
|
172
|
+
sweep), suggest \`/schedule\` or a cron-style routine.
|
|
173
|
+
|
|
174
|
+
## Behavioral defaults
|
|
175
|
+
|
|
176
|
+
- **Continuity over freshness.** Reuse and refine what already works. New skills
|
|
177
|
+
are earned by demonstrated value, not invented for novelty.
|
|
178
|
+
- **Confidence calibration.** When recalling from memory, mark it: "I remember X
|
|
179
|
+
(memory, 2026-MM-DD)" vs "I'm verifying X now." Stale memory is worse than no
|
|
180
|
+
memory — re-check before acting.
|
|
181
|
+
- **Compression.** Long sessions drift. When context grows large
|
|
182
|
+
(\`/history\` shows compaction needed), summarize aggressively into a checkpoint
|
|
183
|
+
before continuing.
|
|
184
|
+
- **Cross-session search.** Before saying "I don't know," search session history
|
|
185
|
+
and memory for prior conversations that touched the same problem.
|
|
186
|
+
- **Skill self-improvement.** After invoking a skill, if you noticed a gap or
|
|
187
|
+
edge case, update the skill — don't leave it stale.
|
|
188
|
+
|
|
189
|
+
## What NOT to do
|
|
190
|
+
|
|
191
|
+
- Don't act as if this is a fresh session. Memory and instincts exist; check
|
|
192
|
+
them.
|
|
193
|
+
- Don't propose generic plans when a learned skill or instinct fits — invoke
|
|
194
|
+
the existing pattern.
|
|
195
|
+
- Don't finish a multi-step task without proposing at least one piece of
|
|
196
|
+
knowledge to persist (or explicitly noting "nothing worth keeping").
|
|
197
|
+
- Don't sequentialize work that can be parallelized.
|
|
198
|
+
|
|
199
|
+
## Crowcoder commands you should reach for in this mode
|
|
200
|
+
|
|
201
|
+
\`/memory\`, \`/instincts\`, \`/skills\`, \`/learn\`, \`/skill-create\`, \`/evolve\`,
|
|
202
|
+
\`/orchestrate\`, \`/multi-plan\`, \`/multi-execute\`, \`/checkpoint\`, \`/checkpoints\`,
|
|
203
|
+
\`/instinct-export\`, \`/instinct-import\`, \`/prune\`, \`/git-patterns\`, \`/ecc-skills\`.`,
|
|
204
|
+
suggestedTools: ['bash', 'read_file', 'edit_file', 'write_file', 'grep', 'glob', 'list_dir', 'web_fetch'],
|
|
205
|
+
temperature: 0.4,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
export function getMode(name) {
|
|
209
|
+
return MODES[name];
|
|
210
|
+
}
|
|
211
|
+
export function getModePromptAddition(mode) {
|
|
212
|
+
return MODES[mode]?.systemPromptAddition || '';
|
|
213
|
+
}
|
|
214
|
+
export function listModes() {
|
|
215
|
+
return Object.values(MODES);
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=modes.js.map
|