198 lines
7.8 KiB
Markdown
198 lines
7.8 KiB
Markdown
Use this skill to bootstrap Cog for a new user or reconfigure domains. Trigger if the user says "setup", "bootstrap", "add a domain", "configure domains", or similar setup requests.
|
|
|
|
This skill is **conversational** — you ask the user about their life and work, then generate `memory/domains.yml` and everything that flows from it. No one should ever need to manually edit `domains.yml`.
|
|
|
|
## Phase 1: Discovery (Conversational)
|
|
|
|
Have a natural conversation to understand the user's domains. Ask about:
|
|
|
|
1. **Work** — "What do you do for work? Company name, role?" → becomes a `work` domain
|
|
- Follow-up: "Do you track career growth or reviews separately?" → potential subdomain
|
|
2. **Side projects** — "Any side projects or ventures?" → each becomes a `side-project` domain
|
|
3. **Personal** — The `personal` domain is always created. Ask: "Anything specific you want to track? Health conditions, hobbies, habits, kids' school stuff?"
|
|
- Use their answers to customize the `files` list (e.g., if they mention kids → add `school`, if health → add `health`)
|
|
4. **Anything else** — "Any other areas of your life you want Cog to help with?"
|
|
|
|
Keep it natural. Don't interrogate — 3-4 questions max. Use what they tell you to build the manifest.
|
|
|
|
### Domain Type Rules
|
|
|
|
| Type | What it means | Pipeline behavior |
|
|
|------|--------------|-------------------|
|
|
| `personal` | Personal life — always exactly one | Always in briefings |
|
|
| `work` | Day job | Included in briefings and foresight |
|
|
| `side-project` | Ventures, hobbies, side work | Included in briefings and foresight |
|
|
| `system` | Cog internals (`cog-meta`) | Never in briefings — auto-created, don't ask about |
|
|
|
|
### Building the Domain Entry
|
|
|
|
From the conversation, construct each domain:
|
|
|
|
- **id**: short slug (e.g., `canva`, `myapp`, `personal`)
|
|
- **path**: file path under `memory/` (e.g., `work/canva`, `work/myapp`, `personal`)
|
|
- **type**: one of `personal`, `work`, `side-project`, `system`
|
|
- **label**: one-line description from what the user said
|
|
- **triggers**: keywords that would route a message to this domain (infer from context — company name, project name, colleague names, etc.)
|
|
- **files**: which memory files to create. Defaults per type:
|
|
- `personal`: `[hot-memory, action-items, entities, observations, habits, health, calendar]`
|
|
- `work`: `[hot-memory, action-items, entities, projects, dev-log, observations]`
|
|
- `side-project`: `[hot-memory, action-items, projects, dev-log, observations]`
|
|
- Customize based on what user mentioned (e.g., add `school` if they have kids, add `annual-review` if they mentioned reviews)
|
|
|
|
## Phase 2: Confirm
|
|
|
|
Before writing anything, show the user a summary of what you'll create:
|
|
|
|
```
|
|
Here's what I'll set up:
|
|
|
|
Domains:
|
|
- personal — Family, health, day-to-day
|
|
- acme — Work at Acme Corp (Designer)
|
|
- myapp — Side project
|
|
|
|
This will create:
|
|
- memory/domains.yml (domain manifest)
|
|
- Memory directories + starter files for each domain
|
|
- Slash commands: /personal, /acme, /myapp
|
|
- Updated CLAUDE.md routing table
|
|
|
|
Good to go?
|
|
```
|
|
|
|
Wait for confirmation before proceeding.
|
|
|
|
## Phase 3: Generate
|
|
|
|
### 3a. Write `memory/domains.yml`
|
|
|
|
Write the complete manifest file. Always include `cog-meta` as a system domain (the user doesn't need to know about this one). Format:
|
|
|
|
```yaml
|
|
# Cog Domain Manifest — generated by /setup
|
|
# Single source of truth for all memory domains.
|
|
# To modify: run /setup again. Don't edit this file manually.
|
|
|
|
domains:
|
|
- id: personal
|
|
path: personal
|
|
type: personal
|
|
label: "<from conversation>"
|
|
triggers: [<inferred>]
|
|
files: [<based on type + customization>]
|
|
|
|
- id: cog-meta
|
|
path: cog-meta
|
|
type: system
|
|
label: "Cog self-knowledge, pipeline health, architecture"
|
|
triggers: [cog, meta, evolve, pipeline, memory system, architecture]
|
|
files: [self-observations, patterns, improvements, scenario-calibration, foresight-nudge]
|
|
|
|
# ... work and side-project domains from conversation
|
|
```
|
|
|
|
### 3b. Create Memory Directories and Starter Files
|
|
|
|
For each domain in the manifest:
|
|
1. Create `memory/{domain.path}/` if it doesn't exist
|
|
2. For each file in the domain's `files` array, create `memory/{domain.path}/{file}.md` if it doesn't exist
|
|
3. Use these starter templates for new files:
|
|
|
|
**hot-memory.md:**
|
|
```markdown
|
|
# {Domain Label} — Hot Memory
|
|
<!-- L0: Current state and top-of-mind for {domain label} -->
|
|
|
|
<!-- Rewrite freely. Keep under 50 lines. -->
|
|
```
|
|
|
|
**observations.md:**
|
|
```markdown
|
|
# {Domain Label} — Observations
|
|
<!-- L0: Timestamped observations and events -->
|
|
|
|
<!-- Append-only. Format: - YYYY-MM-DD [tags]: observation -->
|
|
```
|
|
|
|
**action-items.md:**
|
|
```markdown
|
|
# {Domain Label} — Action Items
|
|
<!-- L0: Open and completed tasks -->
|
|
|
|
<!-- Format: - [ ] task | due:YYYY-MM-DD | pri:high/medium/low | added:YYYY-MM-DD -->
|
|
```
|
|
|
|
**entities.md:**
|
|
```markdown
|
|
# {Domain Label} — Entities
|
|
<!-- L0: People, places, and things -->
|
|
|
|
<!-- Edit in place by ### Name header. Use (since YYYY-MM) / (until YYYY-MM) for time-bound facts. -->
|
|
```
|
|
|
|
**Other files** (projects, dev-log, habits, health, calendar, etc.):
|
|
```markdown
|
|
# {Domain Label} — {File Name}
|
|
<!-- L0: {file name} data -->
|
|
```
|
|
|
|
Also handle subdomains the same way — create `memory/{subdomain.path}/` and its files.
|
|
|
|
### 3c. Generate Domain Command Files
|
|
|
|
For each domain (except `cog-meta` which has its own dedicated skills):
|
|
1. Read the template at `.claude/commands/_templates/domain.md`
|
|
2. Replace template variables:
|
|
- `{{ID}}` → domain id
|
|
- `{{LABEL}}` → domain label
|
|
- `{{PATH}}` → domain path
|
|
- `{{TRIGGERS}}` → bullet list of triggers (one per line, prefixed with `- `)
|
|
- `{{FILES}}` → comma-separated list of files
|
|
3. Write the result to `.claude/commands/{domain.id}.md`
|
|
4. If the file already exists, overwrite it (the template is the source of truth)
|
|
|
|
Also generate command files for subdomains.
|
|
|
|
### 3d. Discover Session Transcript Path
|
|
|
|
Claude Code saves conversation history as JSONL files under `~/.claude/projects/`. Find this project's session directory:
|
|
|
|
1. List `~/.claude/projects/` and find the directory that matches this project's path
|
|
2. Verify it exists and is readable
|
|
3. Write the discovered path to `memory/cog-meta/reflect-cursor.md`:
|
|
|
|
```markdown
|
|
# Reflect Cursor
|
|
<!-- L0: Session transcript path and ingestion cursor for /reflect -->
|
|
|
|
session_path: ~/.claude/projects/<discovered-slug>
|
|
last_processed: never
|
|
```
|
|
|
|
If the directory doesn't exist yet (fresh install, this is the first session), write the file anyway with the expected path — it will exist after this conversation ends.
|
|
|
|
Tell the user: "Found your session transcripts at `<path>` — /reflect will use these to review past conversations."
|
|
|
|
### 3e. Update CLAUDE.md Domain Routing Table
|
|
|
|
Read `CLAUDE.md`. Find the domain routing table (between `| Skill` header and the blank line after the table). Regenerate it from the manifest:
|
|
|
|
- For each domain (except cog-meta): add a row `| /{id} | {label} | {first 3 triggers} |`
|
|
- Keep all non-domain rows (explainer, humanizer, reflect, evolve, history, scenario, housekeeping, foresight, setup) as-is
|
|
- Preserve the internal skills line
|
|
|
|
## Phase 4: Summary
|
|
|
|
Output a summary:
|
|
- Domains created
|
|
- Files and directories generated
|
|
- Next steps: "Just talk naturally — I'll route to the right domain. If you want to add more domains later, just say 'add a domain'."
|
|
|
|
## Rules
|
|
|
|
1. **Never delete** — setup only creates and updates, never removes files or directories
|
|
2. **Idempotent** — running /setup multiple times is safe; it skips existing files (except command files which get regenerated from template, and domains.yml which gets rewritten)
|
|
3. **cog-meta is automatic** — always included, never ask about it
|
|
4. **Conversational first** — the whole point is that no one edits YAML manually
|
|
5. **Re-runs are additive** — if run again with existing domains, ask "Want to add more domains or reconfigure existing ones?"
|