context_log_decision
Track and document technical decisions by logging project context, alternatives, consequences, and status to maintain clarity and continuity in AI development processes.
Instructions
Log a technical decision
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alternatives | No | Alternative options considered | |
| consequences | No | Consequences of the decision | |
| context | No | Decision context | |
| decision | Yes | The decision made | |
| projectPath | Yes | Path to project directory | |
| status | No | Decision status | accepted |
| title | Yes | Decision title |
Implementation Reference
- src/context-manager.ts:110-132 (handler)The core handler function that logs a technical decision by appending a formatted markdown entry to the decisions.md file in the project's .context/progress directory. This implements the logic for the 'context_log_decision' tool.async logDecision(projectPath: string, decision: Omit<TechnicalDecision, 'id' | 'createdAt'>): Promise<void> { const decisionsPath = path.join(projectPath, '.context', 'progress', 'decisions.md'); const newDecision: TechnicalDecision = { ...decision, id: this.generateId(), createdAt: new Date(), }; await this.ensureProgressDirectory(projectPath); let content = ''; try { content = await fs.readFile(decisionsPath, 'utf8'); } catch { content = '# Technical Decisions\n\n'; } const decisionMarkdown = this.generateDecisionMarkdown(newDecision); content += `\n${decisionMarkdown}\n`; await fs.writeFile(decisionsPath, content, 'utf8'); }
- src/types.ts:39-48 (schema)Type definition/schema for the technical decision object used as input to the logDecision handler.export interface TechnicalDecision { id: string; title: string; context: string; decision: string; alternatives: string[]; consequences: string[]; status: 'proposed' | 'accepted' | 'rejected'; createdAt: Date; }
- src/context-manager.ts:321-330 (helper)Helper function that formats a TechnicalDecision into markdown for storage in decisions.md.private generateDecisionMarkdown(decision: TechnicalDecision): string { const date = format(decision.createdAt, 'yyyy-MM-dd'); return `### ADR-${this.generateId().slice(-3)}: ${decision.title} **Date:** ${date} **Status:** ${decision.status} **Context:** ${decision.context} **Decision:** ${decision.decision} **Consequences:** ${decision.consequences.join(', ')}`; }