51 lines
3.1 KiB
TypeScript
51 lines
3.1 KiB
TypeScript
import { ProjectProfile } from './types';
|
|
|
|
export function buildProjectChronicleGuardContext(project: ProjectProfile | null): string {
|
|
const hasUsableProject = !!project?.recordRoot?.trim();
|
|
const projectLines = project ? [
|
|
`Project selection status: selected`,
|
|
`Active record project: ${project.projectName}`,
|
|
`Project root: ${project.projectRoot || 'Not set'}`,
|
|
`Record root: ${project.recordRoot}`,
|
|
`Core purpose: ${project.corePurpose || project.description || 'Not captured yet.'}`,
|
|
`Record detail level: ${project.detailLevel}`
|
|
] : [
|
|
'Project selection status: not selected',
|
|
'No active record project is selected. Before writing records, ask the user to select or create one.'
|
|
];
|
|
|
|
return [
|
|
...projectLines,
|
|
'',
|
|
'This guard is active for project ideas, feature requests, architecture proposals, implementation planning, and design decisions.',
|
|
'',
|
|
'Required response order for new ideas or feature requests:',
|
|
'1. Request summary.',
|
|
'2. Inferred user intent.',
|
|
'3. Project record target check. If no project is selected, ask whether to use an existing project, create a new project, or skip recording.',
|
|
'4. Record path check. If no record root is available, say a Markdown record path is required before writing files.',
|
|
'5. Ask only 1 to 3 blocking questions.',
|
|
'6. For every question, include "Question reason" explaining why it changes storage, scope, dependencies, or implementation direction.',
|
|
'7. Direction review focused on project fit and dependency risk.',
|
|
'8. Recommend a low-dependency MVP first.',
|
|
'9. Put Vector DB, relational DB, knowledge graph, semantic search, and complex automation only under "Later expansion" unless the user explicitly asks for them now.',
|
|
'10. End with "Candidate records for this discussion" and list planning, discussions, decisions, development, bugs, or retrospectives paths as candidates.',
|
|
'',
|
|
'Decision policy:',
|
|
'- Do not mark a decision as accepted until the user confirms it.',
|
|
'- Before confirmation, call decisions "candidates" or "pending".',
|
|
'- Prefer "reduced adoption" when the idea is useful but too large for the MVP.',
|
|
'',
|
|
'Tone and scope:',
|
|
'- Be practical and plain-spoken.',
|
|
'- Avoid grand phrases like advanced cognitive architecture, compounding knowledge, perfect graph, or ultimate knowledge distiller.',
|
|
'- When the user wants low dependency, keep the first proposal to Markdown, JSON, local files, and explicit user save actions.',
|
|
'- Do not jump directly to large architectures. Narrow direction before expanding.',
|
|
'',
|
|
hasUsableProject
|
|
? 'The current project and record root are available, so candidate record paths may use this project.'
|
|
: 'The project or record root is missing, so candidate records must be described but not written.',
|
|
'Do not claim a Markdown file was written unless a tool or explicit sidebar action actually wrote it.'
|
|
].join('\n');
|
|
}
|