feat: append workspace critical rules to compaction summary

- Add readWorkspaceContextForSummary() to extract Session Startup + Red Lines from AGENTS.md
- Inject workspace context into compaction summary (limited to 2000 chars)
- Export extractSections() from post-compaction-context.ts for reuse
- Ensures compaction summary includes core rules needed for recovery

Part 1 of post-compaction context injection feature.
This commit is contained in:
康熙
2026-02-16 21:06:08 +08:00
committed by Peter Steinberger
parent d0b33f23eb
commit c4f829411f
2 changed files with 44 additions and 1 deletions

View File

@@ -49,7 +49,7 @@ export async function readPostCompactionContext(workspaceDir: string): Promise<s
* Skips content inside fenced code blocks.
* Captures until the next heading of same or higher level, or end of string.
*/
function extractSections(content: string, sectionNames: string[]): string[] {
export function extractSections(content: string, sectionNames: string[]): string[] {
const results: string[] = [];
const lines = content.split("\n");