Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Force LF line endings for shell scripts — prevents CRLF breakage on Windows
*.sh text eol=lf
*.py text eol=lf
*.md text eol=lf
*.yaml text eol=lf
*.json text eol=lf
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The GTM release. Two weeks live, 500+ installs, and a full architectural refacto
- **Author:** Stack Walnuts → Lock-in Lab
- **Category:** plugin → pcm (Personal Context Manager)
- **Twitter:** @ALIVE_context
- **All 5 rules rewritten** for v3 (version 3.0.0)
- **All 6 rules rewritten** for v3 (version 3.0.0)
- **All 15 skills updated** — 6 major rewrites, 9 moderate/minor
- **5 hooks updated** — project.py trigger, v3 paths, backward compat
- **generate-index.py** — reads v3 flat now.json, extracts task counts, includes recent sessions and unsigned stash count
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The squirrel is the agent runtime — rules, hooks, skills, and policies that an
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Rules │ │ Skills │ │ Hooks │ │
│ │ 6 files │ │ 15 skills │ │ 14 hooks │ │
│ │ 6 files │ │ 15 skills │ │ 13 hooks │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ │
│ ┌─────────────────────────────────────────────┐ │
Expand Down Expand Up @@ -183,7 +183,7 @@ claude plugin install alive@alivecontext

Requires [Claude Code](https://docs.anthropic.com/en/docs/claude-code) + Python 3. Works on macOS, Linux, Windows (WSL).

15 skills, 14 hooks, 6 rule files, templates, and a statusline.
15 skills, 13 hooks, 6 rule files, templates, and a statusline.

### Skills

Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "ALIVE Context System v214 hooks. Session hooks read/write .alive/_squirrels/. All read stdin JSON for session_id.",
"description": "ALIVE Context System v313 hooks. Session hooks read/write .alive/_squirrels/. All read stdin JSON for session_id.",
"hooks": {
"SessionStart": [
{
Expand Down
12 changes: 10 additions & 2 deletions plugins/alive/hooks/scripts/alive-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ fi

# -- JSON runtime detection --
# python3 preferred (fast). node guaranteed (Claude Code is a Node app).
# Windows ships a python3 Store stub (AppInstallerPythonRedirector.exe) that
# passes command -v but fails to execute (exit code 49). We validate execution,
# not just existence. The py -3 launcher is the standard Windows Python path.
ALIVE_JSON_RT=""
if command -v python3 &>/dev/null; then
if command -v python3 &>/dev/null && python3 -c "" &>/dev/null 2>&1; then
ALIVE_JSON_RT="python3"
elif command -v py &>/dev/null && py -3 -c "" &>/dev/null 2>&1; then
# Windows py launcher: shim python3 so all existing callsites work
python3() { py -3 "$@"; }
export -f python3
ALIVE_JSON_RT="python3"
elif command -v node &>/dev/null; then
ALIVE_JSON_RT="node"
Expand Down Expand Up @@ -51,7 +59,7 @@ const d=JSON.parse(require('fs').readFileSync(0,'utf8'));
# Read JSON input from stdin. Must be called BEFORE any other stdin read.
# Sets: HOOK_INPUT, HOOK_SESSION_ID, HOOK_CWD, HOOK_EVENT
read_hook_input() {
HOOK_INPUT=$(cat /dev/stdin 2>/dev/null || echo '{}')
HOOK_INPUT=$(cat 2>/dev/null || echo '{}')
local parsed
parsed=$(_json_multi "$HOOK_INPUT" "session_id cwd hook_event_name")
HOOK_SESSION_ID=$(echo "$parsed" | sed -n '1p')
Expand Down
4 changes: 2 additions & 2 deletions plugins/alive/rules/squirrels.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Do not panic about context usage. Do not suggest ending a session, starting a fr

Always have enough state on disk that a crash, compaction, or abrupt exit doesn't lose the session. This means:

- Stash checkpoint every 5 items or 20 minutes (shadow-write to squirrel YAML)
- Save IS the checkpoint — no automatic mid-session shadow-writes. If the session crashes before a save, the transcript JSONL is the recovery source (via `alive:session-context-rebuild`).
- Action log maintained in squirrel YAML throughout the session
- `recovery_state` written to squirrel YAML so the next session knows exactly where things stopped

Expand Down Expand Up @@ -578,6 +578,6 @@ Mid-session saves reset the stash but don't end the session. The squirrel return
- Stash on change only. No change = no stash shown.
- Every stash add includes a remove prompt (-> drop?)
- If 30+ minutes pass without stashing, scan back — decisions were probably made
- Stash checkpoint: every 5 items or 20 minutes, shadow-write to squirrel YAML (crash insurance)
- Stash checkpoint: save IS the checkpoint — no automatic mid-session shadow-writes
- Resolved questions don't stay in stash — they become decisions (log) or insights (if evergreen)
- At save: group by type (decisions / tasks / notes / insight candidates)
14 changes: 9 additions & 5 deletions plugins/alive/scripts/generate-graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def main():
json_file = os.path.join(world_root, '.alive', '_index.json')
html_file = os.path.join(world_root, '.alive', 'context-graph.html')

with open(json_file, 'r', encoding='utf-8') as f:
data = json.load(f)
try:
with open(json_file, 'r', encoding='utf-8') as f:
data = json.load(f)
except (IOError, json.JSONDecodeError) as e:
print(f"Error reading {json_file}: {e}", file=sys.stderr)
sys.exit(1)

stats = data['stats']
walnuts = data['walnuts']
Expand All @@ -54,7 +58,7 @@ def main():
try:
days_since = (datetime.strptime(today, '%Y-%m-%d') -
datetime.strptime(updated, '%Y-%m-%d')).days
except:
except (ValueError, TypeError, KeyError):
days_since = 30

if capsule_count >= 15: size = 20
Expand Down Expand Up @@ -129,7 +133,7 @@ def main():
import re
key_path = os.path.join(world_root, '.alive', 'key.md')
if os.path.exists(key_path):
with open(key_path) as f:
with open(key_path, encoding='utf-8') as f:
content = f.read()
m = re.search(r'^name:\s*(.+)$', content, re.MULTILINE)
if m:
Expand All @@ -148,7 +152,7 @@ def main():
try:
key_path = os.path.join(world_root, '.alive', 'key.md')
if os.path.exists(key_path):
with open(key_path) as f:
with open(key_path, encoding='utf-8') as f:
content = f.read()
# Parse wikilinks from links: field
links_match = re.search(r'^links:\s*(.+)$', content, re.MULTILINE)
Expand Down
1 change: 0 additions & 1 deletion plugins/alive/scripts/generate-index.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import re
import json
from datetime import datetime, timezone
from pathlib import Path


def extract_frontmatter(filepath):
Expand Down
4 changes: 2 additions & 2 deletions plugins/alive/scripts/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"""

import argparse
import getpass
import json
import os
import re
import sys
from datetime import datetime, timedelta
from pathlib import Path


# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -288,7 +288,7 @@ def cmd_done(args):

task["status"] = "done"
task["completed"] = _today()
task["completed_by"] = args.by or os.environ.get("USER", "unknown")
task["completed_by"] = args.by or getpass.getuser()

completed_data["completed"].append(task)
_atomic_write(completed_path, completed_data)
Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/skills/load-context/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ If `now.json` has a `bundle:` field pointing to an active bundle, offer to deep-

**Deep load reads:**

1. **`bundles/{name}/context.manifest.yaml`** — full file (context, changelog, work log, session history)
1. **`{name}/context.manifest.yaml`** — full file (context, changelog, work log, session history)
2. **`tasks.py list --walnut {path} --bundle {name}`** — call the script for the detailed task view. Do NOT read `tasks.json` directly; the script is the interface.
3. **Write `active_sessions:` entry** to the bundle's `context.manifest.yaml` — claim this session so other agents know you're here.

Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/skills/save/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Read these in parallel before presenting the stash or writing anything:
- `_kernel/log.md` — first ~100 lines (recent entries — what have previous sessions covered?)
- Active bundle's `context.manifest.yaml` — if `now.json` has a `next.bundle` value, read that bundle's manifest

**Do NOT read `bundles/*/tasks.md`** — task data lives in `now.json` already, or call `tasks.py list --walnut {path}` if you need specific detail.
**Do NOT read task files directly** — task data lives in `now.json` already, or call `tasks.py list --walnut {path}` if you need specific detail.

**Backward compat:** If `_kernel/now.json` does not exist, check `_kernel/_generated/now.json` as a fallback.

Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/skills/search-world/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Find searches across ALL walnuts by default. Results show which walnut each matc
│ 2. nova-station / _kernel/log.md — 2026-02-23
│ Decision: go with hybrid shielding approach
│ 3. nova-station / bundles/research/
│ 3. nova-station / research/
│ 2026-02-23-radiation-shielding-options.md
│ number to load, or refine search.
Expand Down
23 changes: 12 additions & 11 deletions plugins/alive/skills/world/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,11 @@ For each walnut in the list:
```
{{domain}}/{{slug}}/
{{domain}}/{{slug}}/_kernel/
{{domain}}/{{slug}}/_kernel/_generated/
{{domain}}/{{slug}}/bundles/
```

**Create walnut files from templates:**

For each file in `templates/walnut/` (key.md, now.json, log.md, tasks.md, insights.md):
For each file in `templates/walnut/` (key.md, log.md, insights.md):

Read the template. Replace variables:
- `{{name}}` → walnut display name (original casing)
Expand All @@ -505,16 +503,21 @@ For key.md specifically:
- Set `rhythm:` to the walnut's rhythm value
- If people are associated with this walnut, fill the `## Key People` section

Write each file to `{{domain}}/{{slug}}/_kernel/{{filename}}` (with now.json going to `_kernel/_generated/now.json`).
Write each file to `{{domain}}/{{slug}}/_kernel/{{filename}}`.

Additionally, create these JSON files directly (not from templates):
- `_kernel/tasks.json` with content `{"tasks": []}`
- `_kernel/completed.json` with content `{"completed": []}`
- `_kernel/now.json` is generated by `project.py` post-save -- do not create manually

Show:
```
│ ▸ {{domain}}/{{slug}}/
│ ▸ _kernel/key.md — "{{goal}}"
│ ▸ _kernel/_generated/now.json — phase: starting
│ ▸ _kernel/log.md — first entry signed
│ ▸ _kernel/insights.md — empty, ready
│ ▸ bundles/ — empty, ready
│ ▸ _kernel/tasks.json — empty queue
│ ▸ _kernel/completed.json — empty archive
```

#### Step 6: Create people walnuts
Expand All @@ -527,8 +530,6 @@ For each person in the list:
```
02_Life/people/{{slug}}/
02_Life/people/{{slug}}/_kernel/
02_Life/people/{{slug}}/_kernel/_generated/
02_Life/people/{{slug}}/bundles/
```

**Create walnut files from templates:**
Expand Down Expand Up @@ -597,11 +598,11 @@ Display this summary. Fill in actual values for every placeholder.
| `.alive/overrides.md` | User rule customizations (never overwritten by updates) |
| `.alive/_squirrels/` | Centralized session entries |
| `[walnut]/_kernel/key.md` | Walnut identity and standing context |
| `[walnut]/_kernel/_generated/now.json` | Current state synthesis (generated) |
| `[walnut]/_kernel/now.json` | Current state synthesis (generated by project.py) |
| `[walnut]/_kernel/log.md` | Prepend-only event spine |
| `[walnut]/bundles/*/tasks.md` | Work queue per bundle |
| `[walnut]/_kernel/tasks.json` | Task queue (script-operated via tasks.py) |
| `[walnut]/_kernel/completed.json` | Completed/dropped task archive |
| `[walnut]/_kernel/insights.md` | Evergreen domain knowledge |
| `[walnut]/bundles/` | Self-contained units of work |

## What Setup Does NOT Do

Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/statusline/alive-statusline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Boot message on first render, then working statusline after first response.
# Cross-platform: Mac, Linux, Windows (Git Bash). No python3 dependency.

INPUT=$(cat /dev/stdin 2>/dev/null || echo '{}')
INPUT=$(cat 2>/dev/null || echo '{}')

# ── Platform detection ──
ALIVE_PLATFORM="unix"
Expand Down
2 changes: 1 addition & 1 deletion plugins/alive/templates/walnut/key.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ published: []
## Context

<!-- Standing context that any new squirrel needs to understand this walnut.
Not decisions (log.md). Not current state (now.md). Not domain knowledge
Not decisions (log.md). Not current state (now.json). Not domain knowledge
(insights.md). This is "what is this thing and why does it exist."

Example:
Expand Down
Loading