mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
- Create task-schema.json (JSON Schema draft-07) with 10 field blocks fusing Unified JSONL, 6-field Task JSON, and Solution Schema advantages - Migrate unified-execute-with-file from JSONL to .task/*.json directory scanning - Migrate 3 producers (lite-plan, plan-converter, collaborative-plan) to .task/*.json multi-file output - Add review-cycle Phase 7.5 export-to-tasks (FIX-*.json) and issue-resolve --export-tasks option - Add schema compatibility annotations to action-planning-agent, workflow-plan, and tdd-plan - Add spec-generator skill phases and templates - Add memory v2 pipeline (consolidation, extraction, job scheduler, embedder) - Add secret-redactor utility and core-memory enhancements - Add codex-lens accuracy benchmarks and staged env config overrides
92 lines
3.0 KiB
TypeScript
92 lines
3.0 KiB
TypeScript
/**
|
|
* Memory Extraction Prompts - LLM prompt templates for Phase 1 extraction
|
|
*
|
|
* Provides system and user prompt templates for extracting structured memory
|
|
* from CLI session transcripts. The LLM output must conform to a JSON schema
|
|
* with raw_memory and rollout_summary fields.
|
|
*
|
|
* Design spec section 4.4: Prompt structure with outcome triage rules.
|
|
*/
|
|
|
|
/**
|
|
* System prompt for the extraction LLM call.
|
|
*
|
|
* Instructs the model to:
|
|
* - Produce a JSON object with raw_memory and rollout_summary
|
|
* - Follow structure markers in raw_memory (# summary, Memory context, etc.)
|
|
* - Apply outcome triage rules for categorizing task results
|
|
* - Keep rollout_summary concise (1-2 sentences)
|
|
*/
|
|
export const EXTRACTION_SYSTEM_PROMPT = `You are a memory extraction agent. Your job is to read a CLI session transcript and produce structured memory output.
|
|
|
|
You MUST respond with a valid JSON object containing exactly two fields:
|
|
|
|
{
|
|
"raw_memory": "<structured memory text>",
|
|
"rollout_summary": "<1-2 sentence summary>"
|
|
}
|
|
|
|
## raw_memory format
|
|
|
|
The raw_memory field must follow this structure:
|
|
|
|
# summary
|
|
<One paragraph high-level summary of what was accomplished in this session>
|
|
|
|
Memory context:
|
|
- Project: <project name or path if identifiable>
|
|
- Tools used: <CLI tools, frameworks, languages mentioned>
|
|
- Key files: <important files created or modified>
|
|
|
|
User preferences:
|
|
- <Any coding style preferences, conventions, or patterns the user demonstrated>
|
|
- <Tool preferences, workflow habits>
|
|
|
|
## Task: <task title or description>
|
|
Outcome: <success | partial | failed | abandoned>
|
|
<Detailed description of what was done, decisions made, and results>
|
|
|
|
### Key decisions
|
|
- <Important architectural or design decisions>
|
|
- <Trade-offs considered>
|
|
|
|
### Lessons learned
|
|
- <What worked well>
|
|
- <What did not work and why>
|
|
- <Gotchas or pitfalls discovered>
|
|
|
|
## Outcome Triage Rules
|
|
|
|
- **success**: Task was completed as intended, tests pass, code works
|
|
- **partial**: Some progress made but not fully complete; note what remains
|
|
- **failed**: Attempted but could not achieve the goal; document root cause
|
|
- **abandoned**: User switched direction or cancelled; note the reason
|
|
|
|
## rollout_summary format
|
|
|
|
A concise 1-2 sentence summary capturing:
|
|
- What the session was about (the goal)
|
|
- The outcome (success/partial/failed)
|
|
- The most important takeaway
|
|
|
|
Do NOT include markdown code fences in your response. Return raw JSON only.`;
|
|
|
|
/**
|
|
* Build the user prompt by injecting the session transcript.
|
|
*
|
|
* @param sessionId - The session/conversation ID for reference
|
|
* @param transcript - The filtered and truncated transcript text
|
|
* @returns The complete user prompt string
|
|
*/
|
|
export function buildExtractionUserPrompt(sessionId: string, transcript: string): string {
|
|
return `Extract structured memory from the following CLI session transcript.
|
|
|
|
Session ID: ${sessionId}
|
|
|
|
--- BEGIN TRANSCRIPT ---
|
|
${transcript}
|
|
--- END TRANSCRIPT ---
|
|
|
|
Respond with a JSON object containing "raw_memory" and "rollout_summary" fields.`;
|
|
}
|