|
1 | | -# Repository Guidelines |
| 1 | +# Repository Map |
2 | 2 |
|
3 | | -This is a Stow-managed personal dotfiles repository. The `.local/`, `home/`, |
4 | | -and `.config/` packages target `~/.local`, `~`, and `~/.config`; `.stowrc` |
5 | | -deliberately disables folding. |
| 3 | +## Repository Purpose |
6 | 4 |
|
7 | | -## Repository Map |
| 5 | +This Stow-managed personal repository holds shell tooling, desktop applications, system setup, and AI-agent configuration. `.local/`, `home/`, and `.config/` are packages installed into `~/.local`, `~`, and `~/.config`; `.stowrc` deliberately disables Stow folding. |
8 | 6 |
|
9 | | -- `.local/` — user-local executables and shared data; add command-line helpers |
10 | | - under `.local/bin/`. |
11 | | -- `home/` — home-directory dotfiles, including shell configuration and agent |
12 | | - configuration. Keep tracked symlinks as symlinks: `.bash_profile` points to |
13 | | - `.profile`, and the Claude/Codex instruction links lead to |
14 | | - `.pi/agent/APPEND_SYSTEM.md`. |
15 | | -- `.config/` — application configuration for desktop applications. |
16 | | -- `.devcontainer/` — DevContainer setup (Dockerfile, devcontainer.json, |
17 | | - bootstrap script) plus the multi-architecture Alpine `sandbox.Dockerfile` |
18 | | - used by `sbx`. |
19 | | -- `data_analysis/` — privacy-preserving Pi JSONL efficiency/regression |
20 | | - reporting and the controlled RPC subagent evaluator in `subagent_eval/`; |
21 | | - generated reports, sessions, and evaluation runs are not committed. |
22 | | -- `misc/` — machine-level Arch, systemd, XKB/keyd, and pacman assets. |
23 | | -- The `codex-apply-patch` extension declares the `apply_patch` tool with a Lark |
24 | | - grammar via `constrainedSampling`; Pi 0.84.2 provides native grammar-tool |
25 | | - support, so no patched pi-ai build is needed. |
26 | | -- `.pkgList` — Arch package manifest used to provision a fresh system; see |
27 | | - `misc/pacman-hooks` and `just linux-system` for related setup. |
28 | | -- `home/.pi/agent/` — Pi settings, extensions, and Pi-only skills. |
29 | | - `extensions/*.ts` and `extensions/*/index.ts` are extension entry points; |
30 | | - `_shared/` is not. The RPC subagent extension separates role prompts |
31 | | - (`subagents/agents/`) from lifecycle, bounded direct-RPC transport, generation |
32 | | - capture, a single `ResultCatalog` for native session-checkpoint and legacy |
33 | | - result locators, and state modules; its tests are in `subagents/tests/`. |
34 | | - Children are leaves and one-shot by default. Ordinary assignment, follow-up, |
35 | | - steer, and fallback context is direct bounded RPC text. Native append/leaf |
36 | | - checkpoints delimit each logical generation; ordinary terminal assistant |
37 | | - entries provide exact results, and settlement records retain every generation |
38 | | - locator so `read_agent_result` survives restart while carrying child-only |
39 | | - usage. Legacy custom result pages are read-only compatibility data. |
40 | | - Retained children support follow-ups; child `ask_question` requests route to |
41 | | - the immediate spawning agent and resume through `answer_agent`. |
42 | | -- `home/.agents/skills/` — harness-independent skills. Put Pi-only skills in |
43 | | - `home/.pi/agent/skills/` instead. |
44 | | -- `.github/workflows/` — CI: extension checks run only for extension changes; |
45 | | - ShellCheck runs for all pushes and pull requests. |
46 | | -- `Justfile` — installation, formatting, and validation recipes; inspect it |
47 | | - before changing setup or system configuration. |
48 | | -- `CLAUDE.md` — symlink to this file. `home/.claude/CLAUDE.md` and |
49 | | - `home/.codex/AGENTS.md` are separate downstream instruction links. |
| 7 | +## Architecture and Ownership |
50 | 8 |
|
51 | | -## Essential Commands |
| 9 | +- `.local/bin/` owns user executables. `home/` owns configuration, including Bash, SSH, Git, and agent files. Start shell changes at `home/.profile`, `home/.bashrc`, and `home/.bashrc.d/`. |
| 10 | +- `.config/` owns application configuration. Neovim starts at `.config/nvim/init.lua`; compositor, terminal, and other desktop settings live beside it. |
| 11 | +- `misc/` owns Arch, systemd, pacman-hook, and keyboard assets. `.pkgList` is the Arch package manifest. `.devcontainer/` defines the Arch development environment rather than the installed host configuration. |
| 12 | +- `home/.agents/skills/` contains harness-independent skills. Pi-specific settings, prompts, themes, and skills belong in `home/.pi/agent/`; do not put Pi-only material in the shared skill tree. `home/.pi/agent/settings.json` owns local Pi defaults and external package registrations. |
| 13 | +- `home/.pi/agent/extensions/` is a strict TypeScript/NodeNext package. Root `*.ts` and feature `*/index.ts` files are extension entry points; `_shared/` supplies common support and `**/tests/` owns coverage. `subagents/` owns persistent RPC child lifecycle, roles, profiles, and result recovery. `plan/` owns interview, approval, and active-plan mode. `ask-question/` and `codex-apply-patch/` own their corresponding tools. The root `caffeinate.ts`, `footer.ts`, and `model-shortcuts.ts` entry points own small host-integration features. |
52 | 14 |
|
53 | | -Run these from the repository root unless noted otherwise. |
| 15 | +## Key Flows and Sources of Truth |
54 | 16 |
|
55 | | -- `just` — list available recipes. |
56 | | -- `just install` — restow user configuration and link shared skills; run after |
57 | | - Stow-layout changes. It changes paths in `$HOME` and enables the user |
58 | | - `ssh-agent` service when its bus is available. |
59 | | -- `just install-pi` — install locked Pi extension dependencies with pnpm in |
60 | | - `$HOME/.pi/agent/extensions`. |
61 | | -- `just fmt` — format Pi extensions with `oxfmt`. |
62 | | -- `just check` — run Pi dependency, formatting, type, lint, dead-code, and test |
63 | | - checks. |
64 | | -- `pnpm run test:extensions` — focused extension tests; run from |
65 | | - `home/.pi/agent/extensions/`. |
66 | | -- `bash -n home/.bashrc home/.profile` — syntax-check the primary shell files. |
67 | | -- `just linux-system` — privileged Arch system configuration; do not run |
68 | | - casually. `just mac-system` installs, but does not enable, the macOS |
69 | | - Colemak-DH layout. |
| 17 | +`just install` restows the three user packages and links shared skills; it can change `$HOME` and enable the user `ssh-agent`. `Justfile` is the source for installation and host setup. GitHub Actions runs extension checks for extension changes and ShellCheck for all changes. |
70 | 18 |
|
71 | | -## Architecture & Working Agreements |
| 19 | +Within Pi extensions, session snapshots are authoritative for branch-local plan state; `plan/store.ts` writes durable mirrors under `~/.pi/agent/plans/`. `subagents/result-store.ts` owns the `ResultCatalog`: native session result locators preserve generation results across restart, while legacy custom result pages are compatibility-only reads. Role prompts in `subagents/agents/` are separate from the runtime and transport implementation. |
72 | 20 |
|
73 | | -- Pi extensions require Node 26+ and use strict TypeScript with NodeNext |
74 | | - imports. Their package manager is pnpm; keep `pnpm-lock.yaml`, |
75 | | - `pnpm-workspace.yaml` synchronized. Use tabs and let `oxfmt` format them. |
76 | | -- Pi, Pi AI, and Pi TUI are pinned to `0.84.2`. Keep `pnpm-lock.yaml`, |
77 | | - `pnpm-workspace.yaml`, and the `codex-apply-patch` tool grammar synchronized |
78 | | - when upgrading Pi packages. |
79 | | -- Colemak-DH navigation mappings span nvim, tmux, sail, keyd, Karabiner, |
80 | | - Ghostty, and readline; update every affected layer when changing navigation |
81 | | - intent. |
82 | | -- Keep unrelated local edits intact. Use concise Conventional Commit-style |
83 | | - subjects consistent with recent history. |
| 21 | +## Where to Start |
84 | 22 |
|
85 | | -## Keeping This File Accurate |
| 23 | +- For user commands or shell behavior, inspect `.local/bin/` and the `home/` shell file. |
| 24 | +- For an application or desktop change, begin under `.config/`; follow related Colemak-DH mappings across affected applications. |
| 25 | +- For system provisioning or keymaps, begin at `misc/`, `.pkgList`, and the matching `Justfile` recipe. Do not casually run `just linux-system`, which makes privileged host changes. |
| 26 | +- For Pi behavior, begin at the relevant extension entry point and its tests. Run `just check` for extension changes; use `bash -n home/.bashrc home/.profile` for shell changes. |
86 | 27 |
|
87 | | -This file must stay accurate. Before finishing any change, check whether it |
88 | | -alters a mapped path or responsibility, or a documented command, workflow, |
89 | | -dependency, or architectural rule. If so, update `AGENTS.md` in the same |
90 | | -change. When creating, deleting, moving, renaming, or repurposing files or |
91 | | -directories, always review the repository map; do not add entries for ordinary |
92 | | -files already covered by an existing responsibility. |
| 28 | +## Critical Constraints |
| 29 | + |
| 30 | +Keep tracked links as links: `CLAUDE.md` targets this file, `home/.bash_profile` targets `.profile`, and the Claude/Codex instruction links lead to `home/.pi/agent/APPEND_SYSTEM.md`. Extensions require Node 26+, pnpm, tabs, and `oxfmt`; Pi, Pi AI, and Pi TUI are pinned to `0.84.2`. Keep the package manifest, lockfile, workspace policy, and `codex-apply-patch` grammar synchronized when upgrading those packages. That extension uses Pi's native grammar-tool support and replaces Pi's edit/write tools only for the `openai-codex` provider. Subagent children are one-shot leaves by default; retained children are the follow-up path. Colemak-DH navigation is coordinated across Nvim, tmux, Sail, keyd, Karabiner, Ghostty, and readline. |
| 31 | + |
| 32 | +## Maintenance |
| 33 | + |
| 34 | +Keep this repository map current. When a change adds, removes, or relocates a major subsystem; changes an architectural boundary or source of truth; or introduces a critical repository-wide constraint, update `AGENTS.md` in the same commit. Do not record routine implementation details or file-level churn. |
0 commit comments