oh-my-claude-sisyphus 2.5.0 → 2.6.1
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 +101 -24
- package/dist/__tests__/hooks.test.js +255 -1
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +1 -1
- package/dist/__tests__/notepad.test.d.ts +2 -0
- package/dist/__tests__/notepad.test.d.ts.map +1 -0
- package/dist/__tests__/notepad.test.js +374 -0
- package/dist/__tests__/notepad.test.js.map +1 -0
- package/dist/__tests__/ralph-prd.test.d.ts +2 -0
- package/dist/__tests__/ralph-prd.test.d.ts.map +1 -0
- package/dist/__tests__/ralph-prd.test.js +308 -0
- package/dist/__tests__/ralph-prd.test.js.map +1 -0
- package/dist/__tests__/ralph-progress.test.d.ts +2 -0
- package/dist/__tests__/ralph-progress.test.d.ts.map +1 -0
- package/dist/__tests__/ralph-progress.test.js +312 -0
- package/dist/__tests__/ralph-progress.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +5 -3
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/agents/definitions.d.ts +4 -0
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +147 -3
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prometheus.js +2 -2
- package/dist/agents/prometheus.js.map +1 -1
- package/dist/features/builtin-skills/skills.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.js +61 -0
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/magic-keywords.js +1 -1
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +15 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/notepad/index.d.ts +114 -0
- package/dist/hooks/notepad/index.d.ts.map +1 -0
- package/dist/hooks/notepad/index.js +372 -0
- package/dist/hooks/notepad/index.js.map +1 -0
- package/dist/hooks/persistent-mode/index.d.ts +5 -0
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +71 -5
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/ralph-loop/index.d.ts +48 -0
- package/dist/hooks/ralph-loop/index.d.ts.map +1 -1
- package/dist/hooks/ralph-loop/index.js +127 -0
- package/dist/hooks/ralph-loop/index.js.map +1 -1
- package/dist/hooks/ralph-prd/index.d.ts +130 -0
- package/dist/hooks/ralph-prd/index.d.ts.map +1 -0
- package/dist/hooks/ralph-prd/index.js +310 -0
- package/dist/hooks/ralph-prd/index.js.map +1 -0
- package/dist/hooks/ralph-progress/index.d.ts +102 -0
- package/dist/hooks/ralph-progress/index.d.ts.map +1 -0
- package/dist/hooks/ralph-progress/index.js +408 -0
- package/dist/hooks/ralph-progress/index.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -1
- package/dist/hooks/sisyphus-orchestrator/index.js +26 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -1
- package/dist/hooks/ultraqa-loop/index.d.ts +94 -0
- package/dist/hooks/ultraqa-loop/index.d.ts.map +1 -0
- package/dist/hooks/ultraqa-loop/index.js +216 -0
- package/dist/hooks/ultraqa-loop/index.js.map +1 -0
- package/dist/installer/hooks.d.ts +28 -0
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +262 -2
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +426 -12
- package/dist/installer/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/persistent-mode.mjs +187 -7
- package/scripts/post-tool-verifier.mjs +62 -1
- package/scripts/session-start.mjs +22 -0
- package/scripts/test-max-attempts.ts +94 -0
- package/scripts/test-mutual-exclusion.ts +152 -0
- package/scripts/test-notepad-integration.ts +495 -0
- package/scripts/test-remember-tags.ts +121 -0
- package/scripts/test-session-injection.ts +41 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notepad Support
|
|
3
|
+
*
|
|
4
|
+
* Implements compaction-resilient memory persistence using notepad.md format.
|
|
5
|
+
* Provides a three-tier memory system:
|
|
6
|
+
* 1. Priority Context - Always loaded, critical discoveries (max 500 chars)
|
|
7
|
+
* 2. Working Memory - Session notes, auto-pruned after 7 days
|
|
8
|
+
* 3. MANUAL - User content, never auto-pruned
|
|
9
|
+
*
|
|
10
|
+
* Structure:
|
|
11
|
+
* ```markdown
|
|
12
|
+
* # Notepad
|
|
13
|
+
* <!-- Auto-managed by Sisyphus. Manual edits preserved in MANUAL section. -->
|
|
14
|
+
*
|
|
15
|
+
* ## Priority Context
|
|
16
|
+
* <!-- ALWAYS loaded. Keep under 500 chars. Critical discoveries only. -->
|
|
17
|
+
*
|
|
18
|
+
* ## Working Memory
|
|
19
|
+
* <!-- Session notes. Auto-pruned after 7 days. -->
|
|
20
|
+
*
|
|
21
|
+
* ## MANUAL
|
|
22
|
+
* <!-- User content. Never auto-pruned. -->
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface NotepadConfig {
|
|
26
|
+
/** Maximum characters for Priority Context section */
|
|
27
|
+
priorityMaxChars: number;
|
|
28
|
+
/** Days to keep Working Memory entries before pruning */
|
|
29
|
+
workingMemoryDays: number;
|
|
30
|
+
/** Maximum total file size in bytes */
|
|
31
|
+
maxTotalSize: number;
|
|
32
|
+
}
|
|
33
|
+
export interface NotepadStats {
|
|
34
|
+
/** Whether notepad.md exists */
|
|
35
|
+
exists: boolean;
|
|
36
|
+
/** Total file size in bytes */
|
|
37
|
+
totalSize: number;
|
|
38
|
+
/** Priority Context section size in bytes */
|
|
39
|
+
prioritySize: number;
|
|
40
|
+
/** Number of Working Memory entries */
|
|
41
|
+
workingMemoryEntries: number;
|
|
42
|
+
/** ISO timestamp of oldest Working Memory entry */
|
|
43
|
+
oldestEntry: string | null;
|
|
44
|
+
}
|
|
45
|
+
export interface PriorityContextResult {
|
|
46
|
+
/** Whether the operation succeeded */
|
|
47
|
+
success: boolean;
|
|
48
|
+
/** Warning message if content exceeds limit */
|
|
49
|
+
warning?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface PruneResult {
|
|
52
|
+
/** Number of entries pruned */
|
|
53
|
+
pruned: number;
|
|
54
|
+
/** Number of entries remaining */
|
|
55
|
+
remaining: number;
|
|
56
|
+
}
|
|
57
|
+
export declare const NOTEPAD_FILENAME = "notepad.md";
|
|
58
|
+
export declare const DEFAULT_CONFIG: NotepadConfig;
|
|
59
|
+
export declare const PRIORITY_HEADER = "## Priority Context";
|
|
60
|
+
export declare const WORKING_MEMORY_HEADER = "## Working Memory";
|
|
61
|
+
export declare const MANUAL_HEADER = "## MANUAL";
|
|
62
|
+
/**
|
|
63
|
+
* Get the path to notepad.md in .sisyphus subdirectory
|
|
64
|
+
*/
|
|
65
|
+
export declare function getNotepadPath(directory: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Initialize notepad.md if it doesn't exist
|
|
68
|
+
*/
|
|
69
|
+
export declare function initNotepad(directory: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Read entire notepad content
|
|
72
|
+
*/
|
|
73
|
+
export declare function readNotepad(directory: string): string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Get Priority Context section only (for injection)
|
|
76
|
+
*/
|
|
77
|
+
export declare function getPriorityContext(directory: string): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Get Working Memory section
|
|
80
|
+
*/
|
|
81
|
+
export declare function getWorkingMemory(directory: string): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Get MANUAL section
|
|
84
|
+
*/
|
|
85
|
+
export declare function getManualSection(directory: string): string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Add/update Priority Context (replaces content, warns if over limit)
|
|
88
|
+
*/
|
|
89
|
+
export declare function setPriorityContext(directory: string, content: string, config?: NotepadConfig): PriorityContextResult;
|
|
90
|
+
/**
|
|
91
|
+
* Add entry to Working Memory with timestamp
|
|
92
|
+
*/
|
|
93
|
+
export declare function addWorkingMemoryEntry(directory: string, content: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Add to MANUAL section
|
|
96
|
+
*/
|
|
97
|
+
export declare function addManualEntry(directory: string, content: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Prune Working Memory entries older than N days
|
|
100
|
+
*/
|
|
101
|
+
export declare function pruneOldEntries(directory: string, daysOld?: number): PruneResult;
|
|
102
|
+
/**
|
|
103
|
+
* Get notepad stats
|
|
104
|
+
*/
|
|
105
|
+
export declare function getNotepadStats(directory: string): NotepadStats;
|
|
106
|
+
/**
|
|
107
|
+
* Format context for injection into session
|
|
108
|
+
*/
|
|
109
|
+
export declare function formatNotepadContext(directory: string): string | null;
|
|
110
|
+
/**
|
|
111
|
+
* Format full notepad for display
|
|
112
|
+
*/
|
|
113
|
+
export declare function formatFullNotepad(directory: string): string | null;
|
|
114
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/notepad/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,oBAAoB,EAAE,M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E,MAAM,GAAG,OAAO,CA+BjF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CA6B1E;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAyC,GACjD,WAAW,CAkDb;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAqC/D;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBrE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOlE"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notepad Support
|
|
3
|
+
*
|
|
4
|
+
* Implements compaction-resilient memory persistence using notepad.md format.
|
|
5
|
+
* Provides a three-tier memory system:
|
|
6
|
+
* 1. Priority Context - Always loaded, critical discoveries (max 500 chars)
|
|
7
|
+
* 2. Working Memory - Session notes, auto-pruned after 7 days
|
|
8
|
+
* 3. MANUAL - User content, never auto-pruned
|
|
9
|
+
*
|
|
10
|
+
* Structure:
|
|
11
|
+
* ```markdown
|
|
12
|
+
* # Notepad
|
|
13
|
+
* <!-- Auto-managed by Sisyphus. Manual edits preserved in MANUAL section. -->
|
|
14
|
+
*
|
|
15
|
+
* ## Priority Context
|
|
16
|
+
* <!-- ALWAYS loaded. Keep under 500 chars. Critical discoveries only. -->
|
|
17
|
+
*
|
|
18
|
+
* ## Working Memory
|
|
19
|
+
* <!-- Session notes. Auto-pruned after 7 days. -->
|
|
20
|
+
*
|
|
21
|
+
* ## MANUAL
|
|
22
|
+
* <!-- User content. Never auto-pruned. -->
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
26
|
+
import { join } from 'path';
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// Constants
|
|
29
|
+
// ============================================================================
|
|
30
|
+
export const NOTEPAD_FILENAME = 'notepad.md';
|
|
31
|
+
export const DEFAULT_CONFIG = {
|
|
32
|
+
priorityMaxChars: 500,
|
|
33
|
+
workingMemoryDays: 7,
|
|
34
|
+
maxTotalSize: 8192 // 8KB
|
|
35
|
+
};
|
|
36
|
+
export const PRIORITY_HEADER = '## Priority Context';
|
|
37
|
+
export const WORKING_MEMORY_HEADER = '## Working Memory';
|
|
38
|
+
export const MANUAL_HEADER = '## MANUAL';
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// File Operations
|
|
41
|
+
// ============================================================================
|
|
42
|
+
/**
|
|
43
|
+
* Get the path to notepad.md in .sisyphus subdirectory
|
|
44
|
+
*/
|
|
45
|
+
export function getNotepadPath(directory) {
|
|
46
|
+
return join(directory, '.sisyphus', NOTEPAD_FILENAME);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Initialize notepad.md if it doesn't exist
|
|
50
|
+
*/
|
|
51
|
+
export function initNotepad(directory) {
|
|
52
|
+
const sisyphusDir = join(directory, '.sisyphus');
|
|
53
|
+
if (!existsSync(sisyphusDir)) {
|
|
54
|
+
try {
|
|
55
|
+
mkdirSync(sisyphusDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const notepadPath = getNotepadPath(directory);
|
|
62
|
+
if (existsSync(notepadPath)) {
|
|
63
|
+
return true; // Already exists
|
|
64
|
+
}
|
|
65
|
+
const content = `# Notepad
|
|
66
|
+
<!-- Auto-managed by Sisyphus. Manual edits preserved in MANUAL section. -->
|
|
67
|
+
|
|
68
|
+
${PRIORITY_HEADER}
|
|
69
|
+
<!-- ALWAYS loaded. Keep under 500 chars. Critical discoveries only. -->
|
|
70
|
+
|
|
71
|
+
${WORKING_MEMORY_HEADER}
|
|
72
|
+
<!-- Session notes. Auto-pruned after 7 days. -->
|
|
73
|
+
|
|
74
|
+
${MANUAL_HEADER}
|
|
75
|
+
<!-- User content. Never auto-pruned. -->
|
|
76
|
+
|
|
77
|
+
`;
|
|
78
|
+
try {
|
|
79
|
+
writeFileSync(notepadPath, content);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Read entire notepad content
|
|
88
|
+
*/
|
|
89
|
+
export function readNotepad(directory) {
|
|
90
|
+
const notepadPath = getNotepadPath(directory);
|
|
91
|
+
if (!existsSync(notepadPath)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
return readFileSync(notepadPath, 'utf-8');
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Extract a section from notepad content using regex
|
|
103
|
+
*/
|
|
104
|
+
function extractSection(content, header) {
|
|
105
|
+
// Match from header to next section (## followed by space, at start of line)
|
|
106
|
+
// We need to match ## at the start of a line, not ### which is a subsection
|
|
107
|
+
const regex = new RegExp(`${header}\\n([\\s\\S]*?)(?=\\n## [^#]|$)`);
|
|
108
|
+
const match = content.match(regex);
|
|
109
|
+
if (!match) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
// Clean up the content - remove HTML comments and trim
|
|
113
|
+
let section = match[1];
|
|
114
|
+
section = section.replace(/<!--[\s\S]*?-->/g, '').trim();
|
|
115
|
+
return section || null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Replace a section in notepad content
|
|
119
|
+
*/
|
|
120
|
+
function replaceSection(content, header, newContent) {
|
|
121
|
+
const regex = new RegExp(`(${header}\\n)([\\s\\S]*?)(?=## |$)`);
|
|
122
|
+
// Preserve comment if it exists
|
|
123
|
+
const commentMatch = content.match(new RegExp(`${header}\\n(<!--[\\s\\S]*?-->)`));
|
|
124
|
+
const comment = commentMatch ? commentMatch[1] + '\n' : '';
|
|
125
|
+
return content.replace(regex, `$1${comment}${newContent}\n\n`);
|
|
126
|
+
}
|
|
127
|
+
// ============================================================================
|
|
128
|
+
// Section Access
|
|
129
|
+
// ============================================================================
|
|
130
|
+
/**
|
|
131
|
+
* Get Priority Context section only (for injection)
|
|
132
|
+
*/
|
|
133
|
+
export function getPriorityContext(directory) {
|
|
134
|
+
const content = readNotepad(directory);
|
|
135
|
+
if (!content) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return extractSection(content, PRIORITY_HEADER);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get Working Memory section
|
|
142
|
+
*/
|
|
143
|
+
export function getWorkingMemory(directory) {
|
|
144
|
+
const content = readNotepad(directory);
|
|
145
|
+
if (!content) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return extractSection(content, WORKING_MEMORY_HEADER);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get MANUAL section
|
|
152
|
+
*/
|
|
153
|
+
export function getManualSection(directory) {
|
|
154
|
+
const content = readNotepad(directory);
|
|
155
|
+
if (!content) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
return extractSection(content, MANUAL_HEADER);
|
|
159
|
+
}
|
|
160
|
+
// ============================================================================
|
|
161
|
+
// Section Updates
|
|
162
|
+
// ============================================================================
|
|
163
|
+
/**
|
|
164
|
+
* Add/update Priority Context (replaces content, warns if over limit)
|
|
165
|
+
*/
|
|
166
|
+
export function setPriorityContext(directory, content, config = DEFAULT_CONFIG) {
|
|
167
|
+
// Initialize if needed
|
|
168
|
+
if (!existsSync(getNotepadPath(directory))) {
|
|
169
|
+
if (!initNotepad(directory)) {
|
|
170
|
+
return { success: false };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const notepadPath = getNotepadPath(directory);
|
|
174
|
+
let notepadContent = readFileSync(notepadPath, 'utf-8');
|
|
175
|
+
// Check size
|
|
176
|
+
const warning = content.length > config.priorityMaxChars
|
|
177
|
+
? `Priority Context exceeds ${config.priorityMaxChars} chars (${content.length} chars). Consider condensing.`
|
|
178
|
+
: undefined;
|
|
179
|
+
// Replace the section
|
|
180
|
+
notepadContent = replaceSection(notepadContent, PRIORITY_HEADER, content);
|
|
181
|
+
try {
|
|
182
|
+
writeFileSync(notepadPath, notepadContent);
|
|
183
|
+
return { success: true, warning };
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return { success: false };
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Add entry to Working Memory with timestamp
|
|
191
|
+
*/
|
|
192
|
+
export function addWorkingMemoryEntry(directory, content) {
|
|
193
|
+
// Initialize if needed
|
|
194
|
+
if (!existsSync(getNotepadPath(directory))) {
|
|
195
|
+
if (!initNotepad(directory)) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const notepadPath = getNotepadPath(directory);
|
|
200
|
+
let notepadContent = readFileSync(notepadPath, 'utf-8');
|
|
201
|
+
// Get current Working Memory content
|
|
202
|
+
const currentMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER) || '';
|
|
203
|
+
// Format timestamp
|
|
204
|
+
const now = new Date();
|
|
205
|
+
const timestamp = now.toISOString().slice(0, 16).replace('T', ' '); // YYYY-MM-DD HH:MM
|
|
206
|
+
// Add new entry
|
|
207
|
+
const newEntry = `### ${timestamp}\n${content}\n`;
|
|
208
|
+
const updatedMemory = currentMemory ? currentMemory + '\n' + newEntry : newEntry;
|
|
209
|
+
// Replace the section
|
|
210
|
+
notepadContent = replaceSection(notepadContent, WORKING_MEMORY_HEADER, updatedMemory);
|
|
211
|
+
try {
|
|
212
|
+
writeFileSync(notepadPath, notepadContent);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Add to MANUAL section
|
|
221
|
+
*/
|
|
222
|
+
export function addManualEntry(directory, content) {
|
|
223
|
+
// Initialize if needed
|
|
224
|
+
if (!existsSync(getNotepadPath(directory))) {
|
|
225
|
+
if (!initNotepad(directory)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const notepadPath = getNotepadPath(directory);
|
|
230
|
+
let notepadContent = readFileSync(notepadPath, 'utf-8');
|
|
231
|
+
// Get current MANUAL content
|
|
232
|
+
const currentManual = extractSection(notepadContent, MANUAL_HEADER) || '';
|
|
233
|
+
// Add new entry with timestamp
|
|
234
|
+
const now = new Date();
|
|
235
|
+
const timestamp = now.toISOString().slice(0, 16).replace('T', ' '); // YYYY-MM-DD HH:MM
|
|
236
|
+
const newEntry = `### ${timestamp}\n${content}\n`;
|
|
237
|
+
const updatedManual = currentManual ? currentManual + '\n' + newEntry : newEntry;
|
|
238
|
+
// Replace the section
|
|
239
|
+
notepadContent = replaceSection(notepadContent, MANUAL_HEADER, updatedManual);
|
|
240
|
+
try {
|
|
241
|
+
writeFileSync(notepadPath, notepadContent);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// ============================================================================
|
|
249
|
+
// Pruning
|
|
250
|
+
// ============================================================================
|
|
251
|
+
/**
|
|
252
|
+
* Prune Working Memory entries older than N days
|
|
253
|
+
*/
|
|
254
|
+
export function pruneOldEntries(directory, daysOld = DEFAULT_CONFIG.workingMemoryDays) {
|
|
255
|
+
const notepadPath = getNotepadPath(directory);
|
|
256
|
+
if (!existsSync(notepadPath)) {
|
|
257
|
+
return { pruned: 0, remaining: 0 };
|
|
258
|
+
}
|
|
259
|
+
let notepadContent = readFileSync(notepadPath, 'utf-8');
|
|
260
|
+
const workingMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER);
|
|
261
|
+
if (!workingMemory) {
|
|
262
|
+
return { pruned: 0, remaining: 0 };
|
|
263
|
+
}
|
|
264
|
+
// Parse entries
|
|
265
|
+
const entryRegex = /### (\d{4}-\d{2}-\d{2} \d{2}:\d{2})\n([\s\S]*?)(?=### |$)/g;
|
|
266
|
+
const entries = [];
|
|
267
|
+
let match;
|
|
268
|
+
while ((match = entryRegex.exec(workingMemory)) !== null) {
|
|
269
|
+
entries.push({
|
|
270
|
+
timestamp: match[1],
|
|
271
|
+
content: match[2].trim()
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
// Calculate cutoff date
|
|
275
|
+
const cutoff = new Date();
|
|
276
|
+
cutoff.setDate(cutoff.getDate() - daysOld);
|
|
277
|
+
// Filter entries
|
|
278
|
+
const kept = entries.filter(entry => {
|
|
279
|
+
const entryDate = new Date(entry.timestamp);
|
|
280
|
+
return entryDate >= cutoff;
|
|
281
|
+
});
|
|
282
|
+
const pruned = entries.length - kept.length;
|
|
283
|
+
// Rebuild Working Memory section
|
|
284
|
+
const newContent = kept
|
|
285
|
+
.map(entry => `### ${entry.timestamp}\n${entry.content}`)
|
|
286
|
+
.join('\n\n');
|
|
287
|
+
notepadContent = replaceSection(notepadContent, WORKING_MEMORY_HEADER, newContent);
|
|
288
|
+
try {
|
|
289
|
+
writeFileSync(notepadPath, notepadContent);
|
|
290
|
+
return { pruned, remaining: kept.length };
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return { pruned: 0, remaining: entries.length };
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// ============================================================================
|
|
297
|
+
// Stats and Info
|
|
298
|
+
// ============================================================================
|
|
299
|
+
/**
|
|
300
|
+
* Get notepad stats
|
|
301
|
+
*/
|
|
302
|
+
export function getNotepadStats(directory) {
|
|
303
|
+
const notepadPath = getNotepadPath(directory);
|
|
304
|
+
if (!existsSync(notepadPath)) {
|
|
305
|
+
return {
|
|
306
|
+
exists: false,
|
|
307
|
+
totalSize: 0,
|
|
308
|
+
prioritySize: 0,
|
|
309
|
+
workingMemoryEntries: 0,
|
|
310
|
+
oldestEntry: null
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
const content = readFileSync(notepadPath, 'utf-8');
|
|
314
|
+
const priorityContext = extractSection(content, PRIORITY_HEADER) || '';
|
|
315
|
+
const workingMemory = extractSection(content, WORKING_MEMORY_HEADER) || '';
|
|
316
|
+
// Count entries
|
|
317
|
+
const entryMatches = workingMemory.match(/### \d{4}-\d{2}-\d{2} \d{2}:\d{2}/g);
|
|
318
|
+
const entryCount = entryMatches ? entryMatches.length : 0;
|
|
319
|
+
// Find oldest entry
|
|
320
|
+
let oldestEntry = null;
|
|
321
|
+
if (entryMatches && entryMatches.length > 0) {
|
|
322
|
+
// Extract just the timestamp part
|
|
323
|
+
const timestamps = entryMatches.map(m => m.replace('### ', ''));
|
|
324
|
+
timestamps.sort();
|
|
325
|
+
oldestEntry = timestamps[0];
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
exists: true,
|
|
329
|
+
totalSize: Buffer.byteLength(content, 'utf-8'),
|
|
330
|
+
prioritySize: Buffer.byteLength(priorityContext, 'utf-8'),
|
|
331
|
+
workingMemoryEntries: entryCount,
|
|
332
|
+
oldestEntry
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
// ============================================================================
|
|
336
|
+
// Context Formatting
|
|
337
|
+
// ============================================================================
|
|
338
|
+
/**
|
|
339
|
+
* Format context for injection into session
|
|
340
|
+
*/
|
|
341
|
+
export function formatNotepadContext(directory) {
|
|
342
|
+
const notepadPath = getNotepadPath(directory);
|
|
343
|
+
if (!existsSync(notepadPath)) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
const priorityContext = getPriorityContext(directory);
|
|
347
|
+
if (!priorityContext) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
const lines = [
|
|
351
|
+
'<notepad-priority>',
|
|
352
|
+
'',
|
|
353
|
+
'## Priority Context',
|
|
354
|
+
'',
|
|
355
|
+
priorityContext,
|
|
356
|
+
'',
|
|
357
|
+
'</notepad-priority>',
|
|
358
|
+
''
|
|
359
|
+
];
|
|
360
|
+
return lines.join('\n');
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Format full notepad for display
|
|
364
|
+
*/
|
|
365
|
+
export function formatFullNotepad(directory) {
|
|
366
|
+
const content = readNotepad(directory);
|
|
367
|
+
if (!content) {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
return content;
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/notepad/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA0C5B,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,gBAAgB,EAAE,GAAG;IACrB,iBAAiB,EAAE,CAAC;IACpB,YAAY,EAAE,IAAI,CAAC,MAAM;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AAEzC,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,IAAI,CAAC,SAAS,EAAE,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,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -22,8 +22,13 @@ export interface PersistentModeResult {
|
|
|
22
22
|
iteration?: number;
|
|
23
23
|
maxIterations?: number;
|
|
24
24
|
reinforcementCount?: number;
|
|
25
|
+
todoContinuationAttempts?: number;
|
|
25
26
|
};
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Reset todo-continuation attempt counter (call when todos actually change)
|
|
30
|
+
*/
|
|
31
|
+
export declare function resetTodoContinuationAttempts(sessionId: string): void;
|
|
27
32
|
/**
|
|
28
33
|
* Main persistent mode checker
|
|
29
34
|
* Checks all persistent modes in priority order and returns appropriate action
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/persistent-mode/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/persistent-mode/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgCH,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,mBAAmB,GAAG,MAAM,CAAC;IAChE,0BAA0B;IAC1B,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAC;KACnC,CAAC;CACH;AAkBD;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AA0VD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,CAAC,CAiC/B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,GAAG;IAC9D,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAcA"}
|