anvil-dev-framework 0.1.6
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 +719 -0
- package/VERSION +1 -0
- package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
- package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
- package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
- package/docs/INSTALLATION.md +984 -0
- package/docs/anvil-hud.md +469 -0
- package/docs/anvil-init.md +255 -0
- package/docs/anvil-state.md +210 -0
- package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
- package/docs/command-reference.md +2022 -0
- package/docs/hooks-tts.md +368 -0
- package/docs/implementation-guide.md +810 -0
- package/docs/linear-github-integration.md +247 -0
- package/docs/local-issues.md +677 -0
- package/docs/patterns/README.md +419 -0
- package/docs/planning-responsibilities.md +139 -0
- package/docs/session-workflow.md +573 -0
- package/docs/simplification-plan-template.md +297 -0
- package/docs/simplification-principles.md +129 -0
- package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
- package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
- package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
- package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
- package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
- package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
- package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
- package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
- package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
- package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
- package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
- package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
- package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
- package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
- package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
- package/docs/sync.md +122 -0
- package/global/CLAUDE.md +140 -0
- package/global/agents/verify-app.md +164 -0
- package/global/commands/anvil-settings.md +527 -0
- package/global/commands/anvil-sync.md +121 -0
- package/global/commands/change.md +197 -0
- package/global/commands/clarify.md +252 -0
- package/global/commands/cleanup.md +292 -0
- package/global/commands/commit-push-pr.md +207 -0
- package/global/commands/decay-review.md +127 -0
- package/global/commands/discover.md +158 -0
- package/global/commands/doc-coverage.md +122 -0
- package/global/commands/evidence.md +307 -0
- package/global/commands/explore.md +121 -0
- package/global/commands/force-exit.md +135 -0
- package/global/commands/handoff.md +191 -0
- package/global/commands/healthcheck.md +302 -0
- package/global/commands/hud.md +84 -0
- package/global/commands/insights.md +319 -0
- package/global/commands/linear-setup.md +184 -0
- package/global/commands/lint-fix.md +198 -0
- package/global/commands/orient.md +510 -0
- package/global/commands/plan.md +228 -0
- package/global/commands/ralph.md +346 -0
- package/global/commands/ready.md +182 -0
- package/global/commands/release.md +305 -0
- package/global/commands/retro.md +96 -0
- package/global/commands/shard.md +166 -0
- package/global/commands/spec.md +227 -0
- package/global/commands/sprint.md +184 -0
- package/global/commands/tasks.md +228 -0
- package/global/commands/test-and-commit.md +151 -0
- package/global/commands/validate.md +132 -0
- package/global/commands/verify.md +251 -0
- package/global/commands/weekly-review.md +156 -0
- package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
- package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
- package/global/hooks/anvil_memory_observe.ts +322 -0
- package/global/hooks/anvil_memory_session.ts +166 -0
- package/global/hooks/anvil_memory_stop.ts +187 -0
- package/global/hooks/parse_transcript.py +116 -0
- package/global/hooks/post_merge_cleanup.sh +132 -0
- package/global/hooks/post_tool_format.sh +215 -0
- package/global/hooks/ralph_context_monitor.py +240 -0
- package/global/hooks/ralph_stop.sh +502 -0
- package/global/hooks/statusline.sh +1110 -0
- package/global/hooks/statusline_agent_sync.py +224 -0
- package/global/hooks/stop_gate.sh +250 -0
- package/global/lib/.claude/anvil-state.json +21 -0
- package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
- package/global/lib/agent_registry.py +995 -0
- package/global/lib/anvil-state.sh +435 -0
- package/global/lib/claim_service.py +515 -0
- package/global/lib/coderabbit_service.py +314 -0
- package/global/lib/config_service.py +423 -0
- package/global/lib/coordination_service.py +331 -0
- package/global/lib/doc_coverage_service.py +1305 -0
- package/global/lib/gate_logger.py +316 -0
- package/global/lib/github_service.py +310 -0
- package/global/lib/handoff_generator.py +775 -0
- package/global/lib/hygiene_service.py +712 -0
- package/global/lib/issue_models.py +257 -0
- package/global/lib/issue_provider.py +339 -0
- package/global/lib/linear_data_service.py +210 -0
- package/global/lib/linear_provider.py +987 -0
- package/global/lib/linear_provider.py.backup +671 -0
- package/global/lib/local_provider.py +486 -0
- package/global/lib/orient_fast.py +457 -0
- package/global/lib/quality_service.py +470 -0
- package/global/lib/ralph_prompt_generator.py +563 -0
- package/global/lib/ralph_state.py +1202 -0
- package/global/lib/state_manager.py +417 -0
- package/global/lib/transcript_parser.py +597 -0
- package/global/lib/verification_runner.py +557 -0
- package/global/lib/verify_iteration.py +490 -0
- package/global/lib/verify_subagent.py +250 -0
- package/global/skills/README.md +155 -0
- package/global/skills/quality-gates/SKILL.md +252 -0
- package/global/skills/skill-template/SKILL.md +109 -0
- package/global/skills/testing-strategies/SKILL.md +337 -0
- package/global/templates/CHANGE-template.md +105 -0
- package/global/templates/HANDOFF-template.md +63 -0
- package/global/templates/PLAN-template.md +111 -0
- package/global/templates/SPEC-template.md +93 -0
- package/global/templates/ralph/PROMPT.md.template +89 -0
- package/global/templates/ralph/fix_plan.md.template +31 -0
- package/global/templates/ralph/progress.txt.template +23 -0
- package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
- package/global/tests/test_doc_coverage.py +520 -0
- package/global/tests/test_issue_models.py +299 -0
- package/global/tests/test_local_provider.py +323 -0
- package/global/tools/README.md +178 -0
- package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
- package/global/tools/anvil-hud.py +3622 -0
- package/global/tools/anvil-hud.py.bak +3318 -0
- package/global/tools/anvil-issue.py +432 -0
- package/global/tools/anvil-memory/CLAUDE.md +49 -0
- package/global/tools/anvil-memory/README.md +42 -0
- package/global/tools/anvil-memory/bun.lock +25 -0
- package/global/tools/anvil-memory/bunfig.toml +9 -0
- package/global/tools/anvil-memory/package.json +23 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
- package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
- package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
- package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
- package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
- package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
- package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
- package/global/tools/anvil-memory/src/commands/get.ts +115 -0
- package/global/tools/anvil-memory/src/commands/init.ts +94 -0
- package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
- package/global/tools/anvil-memory/src/commands/search.ts +112 -0
- package/global/tools/anvil-memory/src/db.ts +638 -0
- package/global/tools/anvil-memory/src/index.ts +205 -0
- package/global/tools/anvil-memory/src/types.ts +122 -0
- package/global/tools/anvil-memory/tsconfig.json +29 -0
- package/global/tools/ralph-loop.sh +359 -0
- package/package.json +45 -0
- package/scripts/anvil +822 -0
- package/scripts/extract_patterns.py +222 -0
- package/scripts/init-project.sh +541 -0
- package/scripts/install.sh +229 -0
- package/scripts/postinstall.js +41 -0
- package/scripts/rollback.sh +188 -0
- package/scripts/sync.sh +623 -0
- package/scripts/test-statusline.sh +248 -0
- package/scripts/update_claude_md.py +224 -0
- package/scripts/verify.sh +255 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CCS Test Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Mock data and fixtures for Context Checkpoint System (CCS) testing.
|
|
5
|
+
* Provides realistic Claude Code JSON input and Ralph state structures.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Claude Code context window input structure
|
|
10
|
+
*/
|
|
11
|
+
export interface ContextWindowInput {
|
|
12
|
+
context_window: {
|
|
13
|
+
current_usage: {
|
|
14
|
+
input_tokens: number;
|
|
15
|
+
output_tokens: number;
|
|
16
|
+
cache_read_input_tokens: number;
|
|
17
|
+
cache_creation_input_tokens: number;
|
|
18
|
+
};
|
|
19
|
+
context_window_size: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Generate Claude Code JSON input with specified context percentage
|
|
25
|
+
*
|
|
26
|
+
* @param percent - Target context percentage (0-100)
|
|
27
|
+
* @param windowSize - Total context window size (default 200000)
|
|
28
|
+
*/
|
|
29
|
+
export function createContextInput(percent: number, windowSize = 200000): ContextWindowInput {
|
|
30
|
+
// Calculate tokens to achieve target percentage
|
|
31
|
+
// Context usage = input_tokens + cache_creation_input_tokens
|
|
32
|
+
const targetTokens = Math.floor((percent / 100) * windowSize);
|
|
33
|
+
|
|
34
|
+
// Split between input and cache write tokens
|
|
35
|
+
const inputTokens = Math.floor(targetTokens * 0.8);
|
|
36
|
+
const cacheWriteTokens = targetTokens - inputTokens;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
context_window: {
|
|
40
|
+
current_usage: {
|
|
41
|
+
input_tokens: inputTokens,
|
|
42
|
+
output_tokens: Math.floor(inputTokens * 0.3), // Output doesn't count toward limit
|
|
43
|
+
cache_read_input_tokens: Math.floor(inputTokens * 0.1), // Cache reads don't count
|
|
44
|
+
cache_creation_input_tokens: cacheWriteTokens,
|
|
45
|
+
},
|
|
46
|
+
context_window_size: windowSize,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Ralph state file structure
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* File in progress entry for context checkpoint
|
|
56
|
+
*/
|
|
57
|
+
export interface FileInProgress {
|
|
58
|
+
path: string;
|
|
59
|
+
start_line?: number;
|
|
60
|
+
end_line?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface RalphState {
|
|
64
|
+
iteration?: number;
|
|
65
|
+
started_at?: string;
|
|
66
|
+
status?: 'running' | 'completed' | 'max_iterations' | 'circuit_breaker' | 'fatal_error';
|
|
67
|
+
task_name?: string;
|
|
68
|
+
objective?: string;
|
|
69
|
+
todo_items?: string[];
|
|
70
|
+
completed_items?: string[];
|
|
71
|
+
no_change_count?: number;
|
|
72
|
+
last_diff_hash?: string;
|
|
73
|
+
error_hashes?: string[];
|
|
74
|
+
context_history?: Array<{
|
|
75
|
+
iteration: number;
|
|
76
|
+
peak_percent: number;
|
|
77
|
+
checkpoint: boolean;
|
|
78
|
+
level?: string;
|
|
79
|
+
timestamp?: string;
|
|
80
|
+
}>;
|
|
81
|
+
context_checkpoint?: {
|
|
82
|
+
active: boolean;
|
|
83
|
+
level: string;
|
|
84
|
+
percent_at_checkpoint: number;
|
|
85
|
+
timestamp: string;
|
|
86
|
+
handoff_file: string;
|
|
87
|
+
resume_summary: string;
|
|
88
|
+
files_in_progress: FileInProgress[];
|
|
89
|
+
current_todo_item: string;
|
|
90
|
+
progress_on_item: string;
|
|
91
|
+
};
|
|
92
|
+
linear_integration?: {
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
parent_issue?: string;
|
|
95
|
+
no_sync?: boolean;
|
|
96
|
+
last_sync?: string;
|
|
97
|
+
subtasks?: Array<{
|
|
98
|
+
identifier: string;
|
|
99
|
+
title: string;
|
|
100
|
+
status: 'pending' | 'completed';
|
|
101
|
+
completed_at?: string;
|
|
102
|
+
}>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Create a minimal Ralph state for testing
|
|
108
|
+
*/
|
|
109
|
+
export function createMinimalRalphState(overrides: Partial<RalphState> = {}): RalphState {
|
|
110
|
+
return {
|
|
111
|
+
iteration: 0,
|
|
112
|
+
started_at: new Date().toISOString(),
|
|
113
|
+
status: 'running',
|
|
114
|
+
no_change_count: 0,
|
|
115
|
+
last_diff_hash: '',
|
|
116
|
+
error_hashes: [],
|
|
117
|
+
...overrides,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Create a full Ralph state with all fields
|
|
123
|
+
*/
|
|
124
|
+
export function createFullRalphState(overrides: Partial<RalphState> = {}): RalphState {
|
|
125
|
+
return {
|
|
126
|
+
iteration: 5,
|
|
127
|
+
started_at: new Date(Date.now() - 3600000).toISOString(), // 1 hour ago
|
|
128
|
+
status: 'running',
|
|
129
|
+
task_name: 'Implement ANV-204 CCS E2E Testing',
|
|
130
|
+
todo_items: [
|
|
131
|
+
'Create test infrastructure',
|
|
132
|
+
'Implement context monitor tests',
|
|
133
|
+
'Implement ralph stop tests',
|
|
134
|
+
'Implement integration tests',
|
|
135
|
+
],
|
|
136
|
+
no_change_count: 0,
|
|
137
|
+
last_diff_hash: 'abc123',
|
|
138
|
+
error_hashes: [],
|
|
139
|
+
context_history: [
|
|
140
|
+
{ iteration: 1, peak_percent: 25, checkpoint: false },
|
|
141
|
+
{ iteration: 2, peak_percent: 45, checkpoint: false },
|
|
142
|
+
{ iteration: 3, peak_percent: 55, checkpoint: false },
|
|
143
|
+
{ iteration: 4, peak_percent: 62, checkpoint: false },
|
|
144
|
+
{ iteration: 5, peak_percent: 68, checkpoint: false },
|
|
145
|
+
],
|
|
146
|
+
...overrides,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Create a Ralph state with an active checkpoint
|
|
152
|
+
*/
|
|
153
|
+
export function createCheckpointedState(
|
|
154
|
+
level: 'L2' | 'L3',
|
|
155
|
+
percent: number,
|
|
156
|
+
overrides: Partial<RalphState> = {}
|
|
157
|
+
): RalphState {
|
|
158
|
+
const timestamp = new Date().toISOString();
|
|
159
|
+
const handoffFile = `.claude/handoffs/${new Date().toISOString().slice(0, 16).replace('T', '-').replace(':', '')}-checkpoint.md`;
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
iteration: 10,
|
|
163
|
+
started_at: new Date(Date.now() - 7200000).toISOString(), // 2 hours ago
|
|
164
|
+
status: 'running',
|
|
165
|
+
task_name: 'Long Running Task',
|
|
166
|
+
todo_items: [
|
|
167
|
+
'Current task in progress',
|
|
168
|
+
'Next pending task',
|
|
169
|
+
'Another pending task',
|
|
170
|
+
],
|
|
171
|
+
no_change_count: 0,
|
|
172
|
+
last_diff_hash: 'def456',
|
|
173
|
+
error_hashes: [],
|
|
174
|
+
context_history: [
|
|
175
|
+
{ iteration: 8, peak_percent: 75, checkpoint: false },
|
|
176
|
+
{ iteration: 9, peak_percent: 82, checkpoint: false },
|
|
177
|
+
{ iteration: 10, peak_percent: percent, checkpoint: true, level, timestamp },
|
|
178
|
+
],
|
|
179
|
+
context_checkpoint: {
|
|
180
|
+
active: true,
|
|
181
|
+
level,
|
|
182
|
+
percent_at_checkpoint: percent,
|
|
183
|
+
timestamp,
|
|
184
|
+
handoff_file: handoffFile,
|
|
185
|
+
resume_summary: '',
|
|
186
|
+
files_in_progress: [
|
|
187
|
+
{ path: 'src/feature.ts', start_line: 10, end_line: 50 },
|
|
188
|
+
{ path: 'src/feature.test.ts', start_line: 1, end_line: 100 },
|
|
189
|
+
],
|
|
190
|
+
current_todo_item: 'Current task in progress',
|
|
191
|
+
progress_on_item: 'checkpoint triggered',
|
|
192
|
+
},
|
|
193
|
+
...overrides,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Create a Ralph state with Linear integration
|
|
199
|
+
*/
|
|
200
|
+
export function createLinearIntegratedState(overrides: Partial<RalphState> = {}): RalphState {
|
|
201
|
+
return {
|
|
202
|
+
...createFullRalphState(),
|
|
203
|
+
linear_integration: {
|
|
204
|
+
enabled: true,
|
|
205
|
+
parent_issue: 'ANV-204',
|
|
206
|
+
no_sync: false,
|
|
207
|
+
subtasks: [
|
|
208
|
+
{ identifier: 'ANV-204-1', title: 'Phase 1: Setup', status: 'completed', completed_at: new Date(Date.now() - 1800000).toISOString() },
|
|
209
|
+
{ identifier: 'ANV-204-2', title: 'Phase 2: Tests', status: 'pending' },
|
|
210
|
+
{ identifier: 'ANV-204-3', title: 'Phase 3: Integration', status: 'pending' },
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
...overrides,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Create a Ralph state suitable for prompt generator testing
|
|
219
|
+
* Includes all fields expected by ralph_prompt_generator.py
|
|
220
|
+
*/
|
|
221
|
+
export function createPromptGeneratorState(overrides: Partial<RalphState> = {}): RalphState {
|
|
222
|
+
const timestamp = new Date().toISOString();
|
|
223
|
+
const handoffFile = `.claude/handoffs/${new Date().toISOString().slice(0, 16).replace('T', '-').replace(':', '')}-checkpoint.md`;
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
iteration: 15,
|
|
227
|
+
started_at: new Date(Date.now() - 3600000).toISOString(),
|
|
228
|
+
status: 'running',
|
|
229
|
+
task_name: 'Implement Feature X',
|
|
230
|
+
objective: 'Complete the feature implementation with full test coverage',
|
|
231
|
+
todo_items: [
|
|
232
|
+
'Implement core logic',
|
|
233
|
+
'Add unit tests',
|
|
234
|
+
'Update documentation',
|
|
235
|
+
],
|
|
236
|
+
completed_items: [
|
|
237
|
+
'Research requirements',
|
|
238
|
+
'Design architecture',
|
|
239
|
+
'Set up project structure',
|
|
240
|
+
],
|
|
241
|
+
no_change_count: 0,
|
|
242
|
+
last_diff_hash: 'abc123',
|
|
243
|
+
error_hashes: [],
|
|
244
|
+
context_history: [
|
|
245
|
+
{ iteration: 13, peak_percent: 80, checkpoint: false },
|
|
246
|
+
{ iteration: 14, peak_percent: 87, checkpoint: false },
|
|
247
|
+
{ iteration: 15, peak_percent: 92, checkpoint: true, level: 'L2', timestamp },
|
|
248
|
+
],
|
|
249
|
+
context_checkpoint: {
|
|
250
|
+
active: true,
|
|
251
|
+
level: 'L2',
|
|
252
|
+
percent_at_checkpoint: 92,
|
|
253
|
+
timestamp,
|
|
254
|
+
handoff_file: handoffFile,
|
|
255
|
+
resume_summary: 'Implementing core feature logic',
|
|
256
|
+
files_in_progress: [
|
|
257
|
+
{ path: 'src/feature.ts', start_line: 45, end_line: 120 },
|
|
258
|
+
{ path: 'src/feature.test.ts', start_line: 1, end_line: 50 },
|
|
259
|
+
],
|
|
260
|
+
current_todo_item: 'Implement core logic',
|
|
261
|
+
progress_on_item: 'Added base implementation, working on edge cases',
|
|
262
|
+
},
|
|
263
|
+
...overrides,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Pre-defined context inputs for each threshold level
|
|
268
|
+
export const CONTEXT_INPUTS = {
|
|
269
|
+
/** L0: Normal operation (< 70%) */
|
|
270
|
+
L0_LOW: createContextInput(25),
|
|
271
|
+
L0_MEDIUM: createContextInput(50),
|
|
272
|
+
L0_HIGH: createContextInput(68),
|
|
273
|
+
|
|
274
|
+
/** L1: Warning zone (70-84%) */
|
|
275
|
+
L1_LOW: createContextInput(70),
|
|
276
|
+
L1_MEDIUM: createContextInput(77),
|
|
277
|
+
L1_HIGH: createContextInput(84),
|
|
278
|
+
|
|
279
|
+
/** L2: Checkpoint zone (85-94%) */
|
|
280
|
+
L2_LOW: createContextInput(85),
|
|
281
|
+
L2_MEDIUM: createContextInput(90),
|
|
282
|
+
L2_HIGH: createContextInput(94),
|
|
283
|
+
|
|
284
|
+
/** L3: Emergency zone (95%+) */
|
|
285
|
+
L3_LOW: createContextInput(95),
|
|
286
|
+
L3_MEDIUM: createContextInput(97),
|
|
287
|
+
L3_HIGH: createContextInput(99),
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
// Pre-defined Ralph states for common test scenarios
|
|
291
|
+
export const RALPH_STATES = {
|
|
292
|
+
/** Fresh start state */
|
|
293
|
+
FRESH: createMinimalRalphState(),
|
|
294
|
+
|
|
295
|
+
/** Mid-session state */
|
|
296
|
+
RUNNING: createFullRalphState(),
|
|
297
|
+
|
|
298
|
+
/** With active L2 checkpoint */
|
|
299
|
+
CHECKPOINT_L2: createCheckpointedState('L2', 87),
|
|
300
|
+
|
|
301
|
+
/** With active L3 checkpoint */
|
|
302
|
+
CHECKPOINT_L3: createCheckpointedState('L3', 96),
|
|
303
|
+
|
|
304
|
+
/** With Linear integration */
|
|
305
|
+
WITH_LINEAR: createLinearIntegratedState(),
|
|
306
|
+
|
|
307
|
+
/** Near max iterations */
|
|
308
|
+
NEAR_MAX: createMinimalRalphState({ iteration: 48 }),
|
|
309
|
+
|
|
310
|
+
/** At circuit breaker threshold */
|
|
311
|
+
CIRCUIT_BREAKER: createMinimalRalphState({ no_change_count: 2 }),
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Sample handoff document content
|
|
316
|
+
*/
|
|
317
|
+
export const SAMPLE_HANDOFF = `# Session Handoff
|
|
318
|
+
|
|
319
|
+
## Summary
|
|
320
|
+
Implementing ANV-204 CCS E2E Testing. Made progress on Phase 1 infrastructure.
|
|
321
|
+
|
|
322
|
+
## Progress
|
|
323
|
+
- [x] Created test-utils.ts
|
|
324
|
+
- [x] Created fixtures.ts
|
|
325
|
+
- [ ] Context monitor tests (in progress)
|
|
326
|
+
- [ ] Ralph stop tests
|
|
327
|
+
- [ ] Integration tests
|
|
328
|
+
|
|
329
|
+
## Current State
|
|
330
|
+
Working on context monitor threshold tests. Next step is L2 checkpoint scenarios.
|
|
331
|
+
|
|
332
|
+
## Files Modified
|
|
333
|
+
- global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts
|
|
334
|
+
- global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts
|
|
335
|
+
|
|
336
|
+
## Resume Instructions
|
|
337
|
+
Continue from Phase 2: Context Monitor Hook Tests.
|
|
338
|
+
`;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Sample transcript with completion promise
|
|
342
|
+
*/
|
|
343
|
+
export const TRANSCRIPT_COMPLETE = `
|
|
344
|
+
Working on the final task...
|
|
345
|
+
All tests are passing now.
|
|
346
|
+
<promise>COMPLETE</promise>
|
|
347
|
+
`;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Sample transcript with fatal error
|
|
351
|
+
*/
|
|
352
|
+
export const TRANSCRIPT_FATAL = `
|
|
353
|
+
Encountered a critical issue...
|
|
354
|
+
<fatal>Unable to proceed - missing required configuration</fatal>
|
|
355
|
+
`;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Sample transcript with stuck signals
|
|
359
|
+
*/
|
|
360
|
+
export const TRANSCRIPT_STUCK = `
|
|
361
|
+
I'm stuck on this issue and cannot proceed without more information.
|
|
362
|
+
The dependency seems to be blocked by an external factor.
|
|
363
|
+
`;
|