wayfind 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+ # Wayfind plugin — Stop hook
3
+ # Runs incremental conversation indexing with journal export after each session.
4
+ # Extracted decisions get written to the journal directory so they sync via git
5
+ # and the container's journal indexer picks them up.
6
+ #
7
+ # Performance target: <5s for the common case (no new conversations to process).
8
+
9
+ set -euo pipefail
10
+
11
+ # Skip export for worker agents in multi-agent swarms.
12
+ # Set TEAM_CONTEXT_SKIP_EXPORT=1 when spawning worker agents so only the
13
+ # orchestrator's decisions flow into the journal.
14
+ if [ "${TEAM_CONTEXT_SKIP_EXPORT:-${MERIDIAN_SKIP_EXPORT:-}}" = "1" ]; then
15
+ exit 0
16
+ fi
17
+
18
+ # Find wayfind binary
19
+ WAYFIND="$(command -v wayfind 2>/dev/null || echo "")"
20
+ if [ -z "$WAYFIND" ]; then
21
+ for candidate in \
22
+ "$HOME/repos/greg/wayfind/bin/team-context.js" \
23
+ "$HOME/repos/wayfind/bin/team-context.js"; do
24
+ if [ -f "$candidate" ]; then
25
+ WAYFIND="node $candidate"
26
+ break
27
+ fi
28
+ done
29
+ fi
30
+
31
+ if [ -z "$WAYFIND" ]; then
32
+ echo "[wayfind] CLI not found — decision extraction skipped. Install: npm install -g wayfind" >&2
33
+ exit 0
34
+ fi
35
+
36
+ # ── Fast path: skip reindex if no conversation files changed ──────────────────
37
+ LAST_RUN_FILE="$HOME/.claude/team-context/.last-reindex"
38
+ if [ -f "$LAST_RUN_FILE" ]; then
39
+ CHANGED=$(find "$HOME/.claude/projects" -name "*.jsonl" -newer "$LAST_RUN_FILE" 2>/dev/null | head -1)
40
+ if [ -z "$CHANGED" ]; then
41
+ # No conversation files changed — skip expensive reindex, just sync journals
42
+ $WAYFIND journal sync 2>/dev/null &
43
+ exit 0
44
+ fi
45
+ fi
46
+
47
+ # Run incremental reindex
48
+ $WAYFIND reindex --conversations-only --export --detect-shifts --write-stats 2>/dev/null || true
49
+
50
+ # Update the marker so the next session's fast-path check works
51
+ mkdir -p "$HOME/.claude/team-context"
52
+ touch "$LAST_RUN_FILE"
53
+
54
+ # Sync authored journals to team-context repo (backgrounded)
55
+ $WAYFIND journal sync 2>/dev/null &
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ # Wayfind plugin — SessionStart hook
3
+ # Rebuilds the Active Projects index and checks for version updates.
4
+ # Runs on every session start via the plugin hook system.
5
+
6
+ set -euo pipefail
7
+
8
+ # Find wayfind binary
9
+ WAYFIND="$(command -v wayfind 2>/dev/null || echo "")"
10
+ if [ -z "$WAYFIND" ]; then
11
+ # Try common local checkout paths
12
+ for candidate in \
13
+ "$HOME/repos/greg/wayfind/bin/team-context.js" \
14
+ "$HOME/repos/wayfind/bin/team-context.js"; do
15
+ if [ -f "$candidate" ]; then
16
+ WAYFIND="node $candidate"
17
+ break
18
+ fi
19
+ done
20
+ fi
21
+
22
+ if [ -z "$WAYFIND" ]; then
23
+ # No CLI available — plugin still works for skills, just no automation
24
+ echo "[wayfind] CLI not found. Skills work, but install the CLI for full features: npm install -g wayfind" >&2
25
+ exit 0
26
+ fi
27
+
28
+ # Rebuild Active Projects table (idempotent, concurrent-safe)
29
+ $WAYFIND status --write --quiet 2>/dev/null || true
30
+
31
+ # Check if installed version meets team minimum
32
+ $WAYFIND check-version 2>/dev/null || true
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: doctor
3
+ description: Run Wayfind health check — validates hooks, state files, backup status, and memory file sizes.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Wayfind — Doctor
8
+
9
+ Run a health check on the memory system.
10
+
11
+ ## Step 1: Check if the CLI is available
12
+
13
+ ```bash
14
+ wayfind doctor
15
+ ```
16
+
17
+ If the CLI is installed, its built-in doctor command handles everything. Present the output and stop.
18
+
19
+ If the CLI is not found, perform the checks manually using Steps 2-3 below.
20
+
21
+ ## Step 2: Manual checks
22
+
23
+ Use the Read tool (not Bash) for file checks. Use Glob for file discovery.
24
+
25
+ 1. **Hook registered?** — Read `~/.claude/settings.json`. Check if it contains "check-global-state" or if the wayfind plugin is installed (plugin hooks handle this automatically).
26
+ 2. **Global state current?** — Read `~/.claude/global-state.md`. Check the "Last updated" line near the top.
27
+ 3. **Backup status** — Read `~/.claude/.backup-last-push`. If the file doesn't exist, report "Backup not configured."
28
+ 4. **Repos** — Use Glob to find `~/repos/**/.claude/state.md` and `~/repos/**/.claude/team-state.md` files. Report each with its parent repo name.
29
+ 5. **Memory files** — Use Glob to find `~/.claude/memory/*.md`. For each file, read it and check if it's unusually large (mention if content seems over ~200 lines). Also count journal files in `~/.claude/memory/journal/`.
30
+
31
+ ## Step 3: Report findings
32
+
33
+ Report in this format:
34
+ - Items that are working correctly
35
+ - Items that need attention (not broken, but worth knowing)
36
+ - Items that are broken (with how to fix)
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: init-memory
3
+ description: Initialize Wayfind for the current repo. Creates .claude/team-state.md (tracked in git) and .claude/personal-state.md (gitignored), ensures correct .gitignore entries, appends session protocol to CLAUDE.md, and registers the repo in the global index. Safe to run multiple times (idempotent).
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Initialize Memory System for Current Repo
8
+
9
+ Run these steps in order. Skip any step that's already done (this command is idempotent).
10
+
11
+ ## Step 0: Detect and Migrate Old Protocol
12
+
13
+ Read the repo's `CLAUDE.md` (if it exists). If it contains "Update the project's row in" or "Update the Active Projects row", this repo has the old session protocol that writes to global-state.md.
14
+
15
+ **Migration:** Replace the matching Session End step with:
16
+ > 3. Do NOT update `~/.claude/global-state.md` — its Active Projects table is rebuilt automatically by `wayfind status`.
17
+
18
+ Report: "Migrated session protocol — sessions no longer write to global-state.md."
19
+
20
+ If the old protocol is not detected, skip this step silently.
21
+
22
+ ## Step 1: Detect Context
23
+
24
+ - Determine the current working directory
25
+ - Check if it's a git repo (`ls .git` or `git rev-parse --show-toplevel`)
26
+ - Read `~/.claude/global-state.md` to check if this repo is already registered
27
+
28
+ ## Step 1.5: Bind repo to team
29
+
30
+ Check if `.claude/wayfind.json` already exists in the repo.
31
+
32
+ **If it already exists:** Read it, report the current team binding ("Already bound to team: <team name>"), and ask: "Want to change the team binding?" If the user says no, skip to Step 2. If yes, proceed with team selection below (overwrite the file).
33
+
34
+ **If it does not exist:** Read `~/.claude/team-context/context.json` to get the list of configured teams.
35
+
36
+ - **No teams configured (file missing or empty `teams` array):** Tell the user: "No teams configured yet. Run `/wayfind:init-team` first to set up a team, then re-run `/wayfind:init-memory`." **Stop here — do not continue to later steps.**
37
+
38
+ - **Exactly one team:** Auto-bind to that team. Create `.claude/wayfind.json`:
39
+ ```json
40
+ {"team_id": "<teamId>", "bound_at": "<ISO 8601 timestamp>"}
41
+ ```
42
+ Report: "Bound to team: <team name> (auto-selected, only team configured)"
43
+
44
+ - **Multiple teams:** List the teams by name and ask the user which one this repo belongs to. Wait for their answer. Create `.claude/wayfind.json` with their chosen team's ID. Report: "Bound to team: <team name>"
45
+
46
+ **Verify `.gitignore` coverage:** `.claude/wayfind.json` must be gitignored. Step 3 already includes it in the required entries — confirm this is still the case. If someone removed it, Step 3 will restore it.
47
+
48
+ ## Step 2: Create state files (if missing)
49
+
50
+ This repo uses TWO state files with different visibility:
51
+
52
+ **`.claude/team-state.md`** — committed to git (shared team context)
53
+
54
+ If `.claude/team-state.md` does not exist, create it:
55
+
56
+ ```markdown
57
+ # [Repo Name] — Team State
58
+
59
+ Last updated: [today's date]
60
+
61
+ ## Architecture & Key Decisions
62
+ <!-- Decisions the whole team should know. Include the "why" not just the "what". -->
63
+
64
+ ## Conventions
65
+ <!-- Patterns, naming, tooling choices that apply across the team. -->
66
+
67
+ ## Current Sprint Focus
68
+ <!-- Team-level "what are we working on right now" -->
69
+
70
+ ## Elicitation Prompts
71
+
72
+ <!-- These prompts guide the AI to capture richer context at decision moments.
73
+ The answers aren't for you — they're for your teammates who read the digest. -->
74
+
75
+ When a technical or product decision is made without stated reasoning, ask one of:
76
+ - "What alternatives did you consider?"
77
+ - "What constraint or requirement drove this choice?"
78
+ - "What would need to change for you to reverse this decision?"
79
+ - "Who else on the team does this affect, and how?"
80
+ - "What's the risk if this assumption is wrong?"
81
+
82
+ Do not ask if the decision already includes reasoning, tradeoffs, or constraints.
83
+ Do not ask more than once per decision. Do not ask during routine implementation.
84
+
85
+ ## Shared Gotchas
86
+ <!-- Hard-won lessons. What surprised us. What NOT to do. -->
87
+ ```
88
+
89
+ **`.claude/personal-state.md`** — gitignored (your personal context)
90
+
91
+ If `.claude/personal-state.md` does not exist, create it:
92
+
93
+ ```markdown
94
+ # [Repo Name] — Personal State
95
+
96
+ Last updated: [today's date]
97
+
98
+ (This file is gitignored. It's yours — context you wouldn't want teammates reading as objective fact.)
99
+
100
+ ## My Current Focus
101
+ <!-- Your personal next steps -->
102
+
103
+ ## Personal Context
104
+ <!-- Working notes, opinions, relationship dynamics for this repo -->
105
+
106
+ ## What I'm Watching
107
+ <!-- Open questions, things to follow up on -->
108
+ ```
109
+
110
+ ## Step 3: Fix `.gitignore`
111
+
112
+ Check `.gitignore`. Ensure these lines are present:
113
+
114
+ ```
115
+ .claude/personal-state.md
116
+ .claude/state.md
117
+ .claude/settings.local.json
118
+ .claude/memory.db
119
+ .claude/wayfind.json
120
+ ```
121
+
122
+ **Do NOT add `.claude/` as a whole directory.** That breaks skills and commands. Only add the specific files above. Note that `team-state.md` is intentionally NOT gitignored — it is meant to be committed and shared with your team. The `.claude/state.md` entry covers legacy repos that use a single state file instead of the two-file model.
123
+
124
+ If any of those lines are missing, append them. If `.claude/` (as a directory) is already in `.gitignore`, remove it and replace with the four file-level entries above.
125
+
126
+ ## Step 4: Append Session Protocol to CLAUDE.md
127
+
128
+ Read the repo's `CLAUDE.md`. If it does NOT already contain "Session State Protocol", append this:
129
+
130
+ ```markdown
131
+
132
+ ## Session State Protocol
133
+
134
+ **At session start (REQUIRED):**
135
+ 1. Read `~/.claude/global-state.md` — preferences, active projects, memory file manifest
136
+ 2. Read `.claude/team-state.md` in this repo — shared team context: architecture decisions, conventions, sprint focus, gotchas
137
+ 3. Read `.claude/personal-state.md` in this repo — your personal context: current focus, working notes, opinions
138
+ 4. Check the Memory Files table in global-state.md — load any `~/.claude/memory/` files relevant to this session's topic
139
+
140
+ **At session end (when user says stop/done/pause/tomorrow):**
141
+ 1. Update `.claude/team-state.md` with shared context: architecture decisions, conventions, gotchas the team should know
142
+ 2. Update `.claude/personal-state.md` with personal context: your next steps, working notes, opinions
143
+ 3. Do NOT update `~/.claude/global-state.md` — its Active Projects table is rebuilt automatically by `wayfind status`.
144
+ 4. If significant new cross-repo context was created (patterns, strategies, decisions), create or update a file in `~/.claude/memory/` and add it to the Memory Files manifest in global-state.md
145
+
146
+ **Do NOT use external memory databases or CLI tools for state storage.** Use plain markdown files only.
147
+ ```
148
+
149
+ If `CLAUDE.md` doesn't exist, create a minimal one with the repo name as a heading and the block above.
150
+
151
+ ## Step 5: Register State Files in Global Index
152
+
153
+ Read `~/.claude/global-state.md`. The Active Projects table is auto-generated by `wayfind status --write` — do NOT add rows to it manually.
154
+
155
+ Add the repo's state files to the State Files table if missing:
156
+
157
+ ```
158
+ | `[full path]/.claude/team-state.md` | Shared team context for this repo |
159
+ | `[full path]/.claude/personal-state.md` | Personal context for this repo (gitignored) |
160
+ ```
161
+
162
+ ## Step 6: Report
163
+
164
+ Tell the user:
165
+ - `.claude/wayfind.json` — bound to team: <team name> (or already bound)
166
+ - `.claude/team-state.md` — created or already existed (committed to git, shared with team)
167
+ - `.claude/personal-state.md` — created or already existed (gitignored, personal only)
168
+ - `.gitignore` — updated or already correct
169
+ - `CLAUDE.md` — protocol appended or already present
170
+ - `global-state.md` — repo registered or already listed
171
+
172
+ **If they haven't set up team context yet**, mention:
173
+ "Run `/wayfind:init-team` to set up team-level context sharing — shared journals, weekly digests
174
+ (Slack + Notion), and persona state files for your configured personas."
175
+
176
+ **Mention persona configuration:**
177
+ "Run `wayfind personas` to see and customize your team's personas (defaults: Product, Design, Engineering, Strategy)."
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: init-team
3
+ description: Set up Wayfind team context for your organization. Interactive walkthrough that creates a team, sets up profiles, creates a team context repo, configures Slack digests, sets up Notion integration, and initializes product-state.md for a pilot repo. Run once per team.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Initialize Team Context (Wayfind)
8
+
9
+ Interactive setup for team-level context sharing. Walk the user through each step,
10
+ asking questions as needed. Skip steps that are already done (idempotent).
11
+
12
+ ## Quick Start (CLI)
13
+
14
+ Before running this full walkthrough, you can quickly bootstrap team basics from
15
+ the command line:
16
+
17
+ ```bash
18
+ # Set up your personal profile and persona(s)
19
+ wayfind whoami --setup
20
+
21
+ # Create a new team (generates a shareable team ID)
22
+ wayfind team create
23
+
24
+ # Or join an existing team
25
+ wayfind team join <team-id>
26
+
27
+ # Check your profile and team status
28
+ wayfind whoami
29
+ wayfind team status
30
+ ```
31
+
32
+ These commands create local config files in `~/.claude/team-context/`. The full
33
+ `/wayfind:init-team` walkthrough below sets up the shared infrastructure (repo, Slack,
34
+ Notion, journals).
35
+
36
+ ## Prerequisites Check
37
+
38
+ Before starting, verify:
39
+ 1. Wayfind is installed (`~/.claude/team-context/` exists or `wayfind version` works)
40
+ 2. User has a Wayfind profile (`wayfind whoami` -- if not, run `wayfind whoami --setup`, which also asks for Slack user ID)
41
+ 3. User has a team configured (`wayfind team status` -- if not, run `wayfind team create`)
42
+ 4. User has `gh` CLI authenticated (`gh auth status`)
43
+ 5. User is in a git repo within an organization (or can specify one)
44
+ 6. Ask: **"Which GitHub org will host the team context repo?"** (e.g., `acme-corp`)
45
+
46
+ If any prerequisite fails, tell the user what's needed and stop.
47
+
48
+ ## Step 1: Team Context Repo
49
+
50
+ This repo holds shared journals, strategy state, digest archives, and the GitHub
51
+ Action that generates digests.
52
+
53
+ Ask: **"Do you already have a team context repo for shared journals and digests? If so, what's the repo name? If not, I'll help you create one."**
54
+
55
+ ### If creating new:
56
+
57
+ Ask: **"What should the repo be called?"** Suggest: `<org>/engineering-context`
58
+
59
+ Guide the user:
60
+ ```
61
+ gh repo create <org>/<repo-name> --private --description "Team decision trail — journals, digests, strategy (powered by Wayfind)"
62
+ ```
63
+
64
+ Then clone it and create the initial structure:
65
+ ```
66
+ <repo>/
67
+ README.md # Brief explanation of what this repo is
68
+ strategy-state.md # Strategy persona state (from templates/strategy-state.md)
69
+ context/ # Shared context (product.md, engineering.md, architecture.md)
70
+ members/ # Member profiles (<username>.json) with slack_user_id
71
+ journals/ # One subdirectory per team member
72
+ <username>/ # Journal files sync here from each person's local
73
+ digests/ # Archive of generated digests
74
+ prompts/ # Shared team prompts (from templates/prompts-readme.md)
75
+ README.md # How to use and contribute prompts
76
+ deploy/ # Docker deployment (docker-compose.yml, .env, manifest)
77
+ wayfind.json # Shared config (webhook URLs, model, excluded repos)
78
+ .github/workflows/ # Digest generation (added in Step 2)
79
+ ```
80
+
81
+ Commit and push the initial structure.
82
+
83
+ ### If existing:
84
+
85
+ Clone or pull the repo. Verify it has `journals/`, `digests/`, and `prompts/` directories.
86
+ Create them if missing. If `prompts/` is new, add the README from `templates/prompts-readme.md`.
87
+
88
+ Store the team context repo path for later steps.
89
+
90
+ ## Step 2: Slack Integration
91
+
92
+ Ask: **"Do you want weekly digests posted to Slack? You'll need a Slack Incoming Webhook URL. If you have one, paste it. If not, I can walk you through creating one."**
93
+
94
+ ### If they need help creating a webhook:
95
+ 1. Go to https://api.slack.com/apps -> Create New App -> From Scratch
96
+ 2. Name it "Wayfind Digests" (or team preference), select workspace
97
+ 3. Features -> Incoming Webhooks -> Activate
98
+ 4. Add New Webhook to Workspace -> Select channel (suggest `#engineering`)
99
+ 5. Copy the webhook URL
100
+
101
+ ### Once they have the URL:
102
+
103
+ Store it as a GitHub repo secret (NOT in plain text):
104
+ ```
105
+ gh secret set SLACK_WEBHOOK_URL --repo <org>/<team-context-repo> --body "<webhook-url>"
106
+ ```
107
+
108
+ Ask: **"Which Slack channel(s) should receive digests?"**
109
+
110
+ ### Create the GitHub Action:
111
+
112
+ Create `.github/workflows/weekly-digest.yml` in the team context repo:
113
+
114
+ ```yaml
115
+ name: Weekly Digest
116
+
117
+ on:
118
+ schedule:
119
+ - cron: '0 10 * * 1' # Monday 10:00 UTC (adjust for timezone)
120
+ workflow_dispatch: # Manual trigger for testing
121
+
122
+ jobs:
123
+ digest:
124
+ runs-on: ubuntu-latest
125
+ steps:
126
+ - uses: actions/checkout@v4
127
+
128
+ - uses: actions/setup-node@v4
129
+ with:
130
+ node-version: '20'
131
+
132
+ - name: Install Wayfind
133
+ run: npm install -g wayfind
134
+
135
+ - name: Reindex journals
136
+ run: wayfind reindex
137
+
138
+ - name: Generate and deliver digest
139
+ env:
140
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
141
+ run: wayfind digest --since last-week --deliver
142
+
143
+ - name: Archive digest
144
+ run: |
145
+ git config user.name "Wayfind Bot"
146
+ git config user.email "wayfind-bot@users.noreply.github.com"
147
+ git add digests/
148
+ git diff --cached --quiet || git commit -m "Weekly digest $(date +%Y-%m-%d)"
149
+ git push
150
+ ```
151
+
152
+ ## Step 3: Notion Integration
153
+
154
+ Ask: **"Do you want digests and product context visible in Notion?"**
155
+
156
+ If yes, use Notion MCP tools to create pages and record the page IDs.
157
+
158
+ ## Step 4: Product State for Pilot Repo
159
+
160
+ Ask: **"Which repo should we set up persona state files for first?"**
161
+
162
+ Check the team's configured personas and create appropriate state templates.
163
+
164
+ ## Step 5: Journal Sync Configuration
165
+
166
+ Each team member's journals need to flow to the team context repo:
167
+
168
+ ```bash
169
+ wayfind journal sync
170
+ ```
171
+
172
+ Ensure the session-end hook includes journal sync (the plugin handles this automatically).
173
+
174
+ ## Step 6: Onboarding Instructions
175
+
176
+ Generate a message the user can send to their team:
177
+
178
+ ```
179
+ Hey team — I've set up Wayfind for our engineering context.
180
+
181
+ **What you need to do**:
182
+ 1. Install the Claude Code plugin:
183
+ /plugin marketplace add usewayfind/wayfind
184
+ /plugin install wayfind@usewayfind
185
+ 2. For full features (digests, extraction), also install the CLI:
186
+ npm install -g wayfind
187
+ 3. Join our team:
188
+ wayfind team join [TEAM_ID]
189
+ 4. Set up your profile:
190
+ wayfind whoami --setup
191
+ 5. In any repo you work in, run /wayfind:init-memory
192
+
193
+ That's it. Work normally. Wayfind captures context at the end of each session.
194
+ ```
195
+
196
+ ## Step 7: Report
197
+
198
+ Summarize everything that was set up and tell the user to send the onboarding message.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: journal
3
+ description: Generate a journal summary — weekly digest, drift detection, and recurring lessons from AI session journals.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Wayfind — Journal Summary
8
+
9
+ Aggregate AI session journal entries into a weekly digest with drift detection and recurring lesson extraction.
10
+
11
+ ## Step 1: Run journal-summary.sh
12
+
13
+ Look for `~/.claude/team-context/journal-summary.sh`. If found, run it based on what the user asked:
14
+
15
+ ```bash
16
+ # This week (default)
17
+ bash ~/.claude/team-context/journal-summary.sh
18
+
19
+ # Last week
20
+ bash ~/.claude/team-context/journal-summary.sh --last-week
21
+
22
+ # Specific date range
23
+ bash ~/.claude/team-context/journal-summary.sh --from 2026-02-01 --to 2026-02-28
24
+
25
+ # All history as Markdown (good for Notion/GitHub)
26
+ bash ~/.claude/team-context/journal-summary.sh --all --format markdown
27
+
28
+ # Team aggregate (each subdir is a contributor's journal dir)
29
+ bash ~/.claude/team-context/journal-summary.sh --team ~/team-journals
30
+
31
+ # Custom journal directory
32
+ bash ~/.claude/team-context/journal-summary.sh --dir ~/.ai-memory/memory/journal
33
+ ```
34
+
35
+ ## Step 2: If journal-summary.sh is not installed
36
+
37
+ Try the CLI instead:
38
+ ```bash
39
+ wayfind journal summary
40
+ ```
41
+
42
+ If neither is available, tell the user: "Install the Wayfind CLI for journal summaries: `npm install -g wayfind`"
43
+
44
+ ## Step 3: Interpret results
45
+
46
+ The summary surfaces four key sections:
47
+
48
+ - **Sessions by Repo** — Every session in the period, grouped by repo. Warning marks on drifted sessions.
49
+ - **Drift Log** — Sessions where "On track?" indicated scope creep or goal drift. Review these to identify recurring blockers.
50
+ - **Recurring Lessons** — Lessons that appeared in 2+ sessions. These are strong candidates to add to `CLAUDE.md` or `global-state.md` so the AI learns from them.
51
+ - **All Lessons** — Full lesson archive for the period, with markers on recurring ones.
52
+
53
+ ## Options quick reference
54
+
55
+ ```
56
+ --dir <path> Journal directory (auto-detects ~/.claude or ~/.ai-memory)
57
+ --team <path> Team mode: each subdirectory is a contributor's journal dir
58
+ --week This week Mon-Sun (default)
59
+ --last-week Last week Mon-Sun
60
+ --from <YYYY-MM-DD> Start date
61
+ --to <YYYY-MM-DD> End date (default: today)
62
+ --all All available journal files
63
+ --format markdown Output as Markdown instead of plain text
64
+ ```
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: review-prs
3
+ description: Review overnight NanoClaw PRs — fact-check, assess against repo conventions, summarize, and offer merge/revise/close for each.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Review NanoClaw PRs
8
+
9
+ Review open pull requests created by NanoClaw overnight. For each PR: read the diff, assess quality, fact-check where possible, and present a summary with a recommendation.
10
+
11
+ ## Step 0: Discover repos
12
+
13
+ Read the Wayfind context registry to find repos to scan:
14
+
15
+ ```bash
16
+ cat ~/.claude/team-context/context.json 2>/dev/null | node -e "
17
+ const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
18
+ const teams = d.teams || {};
19
+ Object.values(teams).forEach(t => {
20
+ if (t.repos) t.repos.forEach(r => console.log(r));
21
+ if (t.path) console.log(t.path);
22
+ });
23
+ " 2>/dev/null
24
+ ```
25
+
26
+ If no context registry exists, ask the user which repos to scan. Store the list for subsequent steps.
27
+
28
+ Also detect the GitHub owner by reading git remote from each repo path, or ask the user.
29
+
30
+ ## Step 1: Find open NanoClaw PRs
31
+
32
+ For each discovered repo, check for open NanoClaw PRs:
33
+
34
+ ```bash
35
+ for repo in {owner/repo list from Step 0}; do
36
+ echo "=== $repo ==="
37
+ gh pr list --repo "$repo" --state open --json number,title,headRefName,createdAt,additions,deletions,changedFiles 2>/dev/null | jq -r '.[] | select(.headRefName | startswith("nanoclaw/")) | "PR #\(.number): \(.title) (+\(.additions)/-\(.deletions), \(.changedFiles) files)"'
38
+ done
39
+ ```
40
+
41
+ If no open NanoClaw PRs found, report "No overnight PRs to review" and stop.
42
+
43
+ ## Step 2: Review each PR in parallel
44
+
45
+ **Spawn one Agent per PR** using the Agent tool with `run_in_background: true`. Each agent reviews its assigned PR independently. If there are 2+ PRs, all agents run concurrently. If there is only 1 PR, still spawn an agent for the review and a second agent to fact-check sources in parallel.
46
+
47
+ Each agent should:
48
+
49
+ 1. **Get the full diff:**
50
+ ```bash
51
+ gh pr diff {number} --repo {owner/repo}
52
+ ```
53
+
54
+ 2. **Get PR metadata:**
55
+ ```bash
56
+ gh pr view {number} --repo {owner/repo} --json title,body,headRefName,createdAt
57
+ ```
58
+
59
+ 3. **Assess the content:**
60
+
61
+ For **competitive intel** PRs (files in `docs/competitive-intel/`):
62
+ - Read `docs/competitive-intel/MONITORING.md` for the required template
63
+ - Does it follow the template?
64
+ - Are sources cited? Do URLs look plausible (not hallucinated)?
65
+ - Are threat assessments reasonable given what we know?
66
+ - Does it claim `Verified: Yes` without evidence of verification?
67
+ - Are there new HIGH-threat competitors that need a full analysis file?
68
+ - Spot-check 2-3 factual claims using `gh api` or web search
69
+
70
+ For **code** PRs:
71
+ - Does it compile/pass tests? (`npm test` if applicable)
72
+ - Are changes scoped correctly (not too broad)?
73
+ - Any obvious bugs, security issues, or style violations?
74
+ - Does it match the repo's conventions?
75
+
76
+ For **documentation** PRs:
77
+ - Is the content accurate and well-structured?
78
+ - Does it duplicate existing docs?
79
+
80
+ 4. **Check the PR title.** NanoClaw often uses the raw prompt as the title. Flag if it needs fixing.
81
+
82
+ Wait for all agents to complete, then synthesize their findings into the summary below.
83
+
84
+ ## Step 3: Present summary
85
+
86
+ For each PR, present:
87
+
88
+ ```
89
+ ### PR #{number}: {title} ({repo})
90
+ **Files:** {list}
91
+ **Quality:** {Good / Needs revision / Reject}
92
+
93
+ **Summary:** {2-3 sentences on what the PR does}
94
+
95
+ **Issues found:**
96
+ - {issue 1}
97
+ - {issue 2}
98
+ (or "None — clean PR")
99
+
100
+ **Fact-check results:**
101
+ - {claim}: {verified/unverified/incorrect}
102
+
103
+ **Recommendation:** Merge / Merge after fixes / Request revision / Close
104
+
105
+ {If merge after fixes: list the specific fixes needed}
106
+ ```
107
+
108
+ ## Step 4: Act on decisions
109
+
110
+ After presenting all summaries, ask the user what to do with each PR. Support these actions:
111
+
112
+ - **Merge**: `gh pr merge {number} --repo {repo} --merge --delete-branch`
113
+ - **Fix title then merge**: `gh pr edit {number} --repo {repo} --title "{new title}"` then merge
114
+ - **Request changes**: Post a review comment and leave open
115
+ - **Close**: `gh pr close {number} --repo {repo}`
116
+ - **Skip**: Leave for later
117
+
118
+ After merging any PRs, pull main:
119
+ ```bash
120
+ git checkout main && git pull
121
+ ```