File size: 1,441 Bytes
a02272f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""Project memory templates β€” scaffolding for per-project cognition."""

from pathlib import Path

# ── Directories ────────────────────────────────────────────

PROJECT_DIRS = [
    "docs",
    "logs",
    "agents",
]

# ── Template content ──────────────────────────────────────

PROJECT_TEMPLATES: dict[str, str] = {
    "context.md": """\
# Project Context

## Overview

## Technologies

## Key Components
""",
    "architecture.md": """\
# Architecture

## Overview

## Structure

## Key Patterns
""",
    "decisions.md": """\
# Architecture Decisions

| Date | Decision | Rationale | Status |
|------|----------|-----------|--------|
""",
    "tasks.md": """\
# Active Tasks

## In Progress

## Pending

## Completed
""",
    "handoff.md": """\
# Current Objective

# Current State

# Active Tasks

# Blockers

# Suggested Next Step
""",
}


def scaffold_project_memory(project_path: Path) -> None:
    """Create project memory structure with template files."""
    project_path.mkdir(parents=True, exist_ok=True)

    for d in PROJECT_DIRS:
        (project_path / d).mkdir(parents=True, exist_ok=True)

    for rel_path, content in PROJECT_TEMPLATES.items():
        file_path = project_path / rel_path
        file_path.write_text(content, encoding="utf-8")