wayfind 0.0.1 → 2.0.0

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.
Files changed (60) hide show
  1. package/BOOTSTRAP_PROMPT.md +120 -0
  2. package/bin/connectors/github.js +617 -0
  3. package/bin/connectors/index.js +13 -0
  4. package/bin/connectors/intercom.js +595 -0
  5. package/bin/connectors/llm.js +469 -0
  6. package/bin/connectors/notion.js +747 -0
  7. package/bin/connectors/transport.js +325 -0
  8. package/bin/content-store.js +2006 -0
  9. package/bin/digest.js +813 -0
  10. package/bin/rebuild-status.js +297 -0
  11. package/bin/slack-bot.js +1535 -0
  12. package/bin/slack.js +342 -0
  13. package/bin/storage/index.js +171 -0
  14. package/bin/storage/json-backend.js +348 -0
  15. package/bin/storage/sqlite-backend.js +415 -0
  16. package/bin/team-context.js +4209 -0
  17. package/bin/telemetry.js +159 -0
  18. package/doctor.sh +291 -0
  19. package/install.sh +144 -0
  20. package/journal-summary.sh +577 -0
  21. package/package.json +48 -6
  22. package/setup.sh +641 -0
  23. package/specializations/claude-code/CLAUDE.md-global-fragment.md +53 -0
  24. package/specializations/claude-code/CLAUDE.md-repo-fragment.md +16 -0
  25. package/specializations/claude-code/README.md +99 -0
  26. package/specializations/claude-code/commands/doctor.md +31 -0
  27. package/specializations/claude-code/commands/init-memory.md +154 -0
  28. package/specializations/claude-code/commands/init-team.md +415 -0
  29. package/specializations/claude-code/commands/journal.md +66 -0
  30. package/specializations/claude-code/commands/review-prs.md +119 -0
  31. package/specializations/claude-code/hooks/check-global-state.sh +20 -0
  32. package/specializations/claude-code/hooks/session-end.sh +36 -0
  33. package/specializations/claude-code/settings.json +15 -0
  34. package/specializations/cursor/README.md +120 -0
  35. package/specializations/cursor/global-rule.mdc +53 -0
  36. package/specializations/cursor/repo-rule.mdc +25 -0
  37. package/specializations/generic/README.md +47 -0
  38. package/templates/autopilot/design.md +22 -0
  39. package/templates/autopilot/engineering.md +22 -0
  40. package/templates/autopilot/product.md +22 -0
  41. package/templates/autopilot/strategy.md +22 -0
  42. package/templates/autopilot/unified.md +24 -0
  43. package/templates/deploy/.env.example +110 -0
  44. package/templates/deploy/docker-compose.yml +63 -0
  45. package/templates/deploy/slack-app-manifest.json +45 -0
  46. package/templates/github-actions/meridian-digest.yml +85 -0
  47. package/templates/global.md +79 -0
  48. package/templates/memory-file.md +18 -0
  49. package/templates/personal-state.md +14 -0
  50. package/templates/personas.json +28 -0
  51. package/templates/product-state.md +41 -0
  52. package/templates/prompts-readme.md +19 -0
  53. package/templates/repo-state.md +18 -0
  54. package/templates/session-protocol-fragment.md +46 -0
  55. package/templates/slack-app-manifest.json +27 -0
  56. package/templates/statusline.sh +22 -0
  57. package/templates/strategy-state.md +39 -0
  58. package/templates/team-state.md +55 -0
  59. package/uninstall.sh +105 -0
  60. package/README.md +0 -4
@@ -0,0 +1,415 @@
1
+ ---
2
+ 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.
3
+ ---
4
+
5
+ # Initialize Team Context (Wayfind)
6
+
7
+ Interactive setup for team-level context sharing. Walk the user through each step,
8
+ asking questions as needed. Skip steps that are already done (idempotent).
9
+
10
+ ## Quick Start (CLI)
11
+
12
+ Before running this full walkthrough, you can quickly bootstrap team basics from
13
+ the command line:
14
+
15
+ ```bash
16
+ # Set up your personal profile and persona(s)
17
+ wayfind whoami --setup
18
+
19
+ # Create a new team (generates a shareable team ID)
20
+ wayfind team create
21
+
22
+ # Or join an existing team
23
+ wayfind team join <team-id>
24
+
25
+ # Check your profile and team status
26
+ wayfind whoami
27
+ wayfind team status
28
+ ```
29
+
30
+ These commands create local config files in `~/.claude/team-context/`. The full
31
+ `/init-team` walkthrough below sets up the shared infrastructure (repo, Slack,
32
+ Notion, journals).
33
+
34
+ ## Prerequisites Check
35
+
36
+ Before starting, verify:
37
+ 1. Wayfind is installed (`~/.claude/team-context/` exists or `wayfind version` works)
38
+ 2. User has a Wayfind profile (`wayfind whoami` -- if not, run `wayfind whoami --setup`, which also asks for Slack user ID)
39
+ 3. User has a team configured (`wayfind team status` -- if not, run `wayfind team create`)
40
+ 4. User has `gh` CLI authenticated (`gh auth status`)
41
+ 5. User is in a git repo within an organization (or can specify one)
42
+ 6. Ask: **"Which GitHub org will host the team context repo?"** (e.g., `acme-corp`)
43
+
44
+ If any prerequisite fails, tell the user what's needed and stop.
45
+
46
+ ## Step 1: Team Context Repo
47
+
48
+ This repo holds shared journals, strategy state, digest archives, and the GitHub
49
+ Action that generates digests.
50
+
51
+ 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."**
52
+
53
+ ### If creating new:
54
+
55
+ Ask: **"What should the repo be called?"** Suggest: `<org>/engineering-context`
56
+
57
+ Guide the user:
58
+ ```
59
+ gh repo create <org>/<repo-name> --private --description "Team decision trail — journals, digests, strategy (powered by Wayfind)"
60
+ ```
61
+
62
+ Then clone it and create the initial structure:
63
+ ```
64
+ <repo>/
65
+ README.md # Brief explanation of what this repo is
66
+ strategy-state.md # Strategy persona state (from templates/strategy-state.md)
67
+ context/ # Shared context (product.md, engineering.md, architecture.md)
68
+ members/ # Member profiles (<username>.json) with slack_user_id
69
+ journals/ # One subdirectory per team member
70
+ <username>/ # Journal files sync here from each person's local
71
+ digests/ # Archive of generated digests
72
+ prompts/ # Shared team prompts (from templates/prompts-readme.md)
73
+ README.md # How to use and contribute prompts
74
+ deploy/ # Docker deployment (docker-compose.yml, .env, manifest)
75
+ wayfind.json # Shared config (webhook URLs, model, excluded repos)
76
+ .github/workflows/ # Digest generation (added in Step 2)
77
+ ```
78
+
79
+ Create `README.md` with:
80
+ ```markdown
81
+ # Team Context
82
+
83
+ Shared decision trail for [team name]. Powered by [Wayfind](https://github.com/usewayfind/wayfind).
84
+
85
+ ## What's here
86
+
87
+ - `strategy-state.md` — Strategic direction, research, prototypes, technology bets
88
+ - `context/` — Shared context files (product.md, engineering.md, architecture.md)
89
+ - `members/` — Member profiles with slack_user_id (e.g., greg.json, nick.json)
90
+ - `journals/` — AI session journals from each team member (auto-synced)
91
+ - `digests/` — Weekly digest archives
92
+ - `prompts/` — Shared, version-controlled prompts for common workflows
93
+ - `deploy/` — Docker deployment configuration (docker-compose.yml, .env, manifest)
94
+ - `wayfind.json` — Shared config (webhook URLs, model, excluded repos)
95
+ - `.github/workflows/` — Automated digest generation
96
+
97
+ ## How it works
98
+
99
+ Team members use Wayfind in their daily AI-assisted development sessions.
100
+ Journals capture what was done, what was decided, what was discovered, and what drifted.
101
+ Weekly digests aggregate this into views for engineering, product, and strategy.
102
+ ```
103
+
104
+ Create `strategy-state.md` from the strategy-state template in this repo's
105
+ `templates/strategy-state.md`. Fill in today's date. Ask the user to provide
106
+ a brief summary of current strategic direction (or leave placeholder comments).
107
+
108
+ Create the `journals/` directory with a `.gitkeep` file.
109
+ Create the `digests/` directory with a `.gitkeep` file.
110
+ Create the `prompts/` directory with the README from `templates/prompts-readme.md`.
111
+
112
+ Commit and push the initial structure.
113
+
114
+ ### If existing:
115
+
116
+ Clone or pull the repo. Verify it has `journals/`, `digests/`, and `prompts/` directories.
117
+ Create them if missing. If `prompts/` is new, add the README from `templates/prompts-readme.md`.
118
+
119
+ Store the team context repo path for later steps. Record it in `~/.claude/global-state.md`
120
+ in the Memory Files table:
121
+
122
+ ```
123
+ | `wayfind-team-context.md` | team context, journals, digests, wayfind | Team context repo location and configuration |
124
+ ```
125
+
126
+ Create `~/.claude/memory/wayfind-team-context.md` with:
127
+ ```markdown
128
+ # Wayfind Team Context
129
+
130
+ > Load this file when: team context, journals, digests, wayfind, init-team
131
+
132
+ ## Team Context Repo
133
+ - Org: <org>
134
+ - Repo: <org>/<repo-name>
135
+ - Local path: <path>
136
+
137
+ ## Integrations Configured
138
+ - Slack webhook: [yes/no — URL stored in repo secret]
139
+ - Notion: [yes/no — page ID]
140
+
141
+ ## Team Members
142
+ - <list of usernames with journal directories>
143
+ ```
144
+
145
+ ## Step 1b: Link and Distribute Context
146
+
147
+ Once the team context repo exists, link it so Wayfind knows where to find shared
148
+ context files:
149
+
150
+ ```bash
151
+ # Link the team context repo (sets context_repo in config)
152
+ wayfind context init <path-to-team-context-repo>
153
+
154
+ # Distribute shared context files to engineer repos
155
+ wayfind context sync
156
+ ```
157
+
158
+ `wayfind context sync` copies files from `context/` in the team context repo into
159
+ `.claude/context/` in each engineer's local repos. PM/product owners maintain the
160
+ context files (e.g., `context/product.md`, `context/engineering.md`); engineers pull
161
+ them via sync.
162
+
163
+ ### Repo filtering
164
+
165
+ If certain repos should be excluded from digests and context sync (e.g., the wayfind
166
+ repo itself), set:
167
+
168
+ ```bash
169
+ export TEAM_CONTEXT_EXCLUDE_REPOS="wayfind,other-repo"
170
+ ```
171
+
172
+ This can also be configured in `wayfind.json` in the team context repo.
173
+
174
+ ### Docker deployment (optional)
175
+
176
+ To scaffold a self-hosted Docker deployment for the bot + scheduler + auto-indexer:
177
+
178
+ ```bash
179
+ wayfind deploy init
180
+ ```
181
+
182
+ This creates `deploy/docker-compose.yml`, `deploy/.env`, and related files in the
183
+ team context repo. The container runs the Slack bot, scheduled digests, and journal
184
+ reindexing with `restart: unless-stopped`.
185
+
186
+ ## Step 2: Slack Integration
187
+
188
+ 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."**
189
+
190
+ ### If they need help creating a webhook:
191
+ 1. Go to https://api.slack.com/apps → Create New App → From Scratch
192
+ 2. Name it "Wayfind Digests" (or team preference), select workspace
193
+ 3. Features → Incoming Webhooks → Activate
194
+ 4. Add New Webhook to Workspace → Select channel (suggest `#engineering`)
195
+ 5. Copy the webhook URL
196
+
197
+ ### Once they have the URL:
198
+
199
+ Store it as a GitHub repo secret (NOT in plain text):
200
+ ```
201
+ gh secret set SLACK_WEBHOOK_URL --repo <org>/<team-context-repo> --body "<webhook-url>"
202
+ ```
203
+
204
+ Ask: **"Which Slack channel(s) should receive digests?"**
205
+ Suggest defaults based on the team's configured personas (see `wayfind personas`).
206
+ For example, with the default personas:
207
+ - Engineering digest -> `#engineering`
208
+ - Product digest -> `#product` (or the same channel if team is small)
209
+ - Strategy digest -> `#leadership` (or skip if the strategy owner just reads the Notion page)
210
+
211
+ Record the channel configuration in `wayfind-team-context.md`.
212
+
213
+ ### Create the GitHub Action:
214
+
215
+ Create `.github/workflows/weekly-digest.yml` in the team context repo:
216
+
217
+ ```yaml
218
+ name: Weekly Digest
219
+
220
+ on:
221
+ schedule:
222
+ - cron: '0 10 * * 1' # Monday 10:00 UTC (adjust for timezone)
223
+ workflow_dispatch: # Manual trigger for testing
224
+
225
+ jobs:
226
+ digest:
227
+ runs-on: ubuntu-latest
228
+ steps:
229
+ - uses: actions/checkout@v4
230
+
231
+ - uses: actions/setup-node@v4
232
+ with:
233
+ node-version: '20'
234
+
235
+ - name: Install Wayfind
236
+ run: npm install -g wayfind
237
+
238
+ - name: Reindex journals
239
+ run: wayfind reindex
240
+
241
+ - name: Generate and deliver digest
242
+ env:
243
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
244
+ run: wayfind digest --since last-week --deliver
245
+
246
+ - name: Archive digest
247
+ run: |
248
+ git config user.name "Wayfind Bot"
249
+ git config user.email "wayfind-bot@users.noreply.github.com"
250
+ git add digests/
251
+ git diff --cached --quiet || git commit -m "Weekly digest $(date +%Y-%m-%d)"
252
+ git push
253
+ ```
254
+
255
+ Tell the user: **"You can test the digest manually: go to the Actions tab in the team context repo and run the 'Weekly Digest' workflow."**
256
+
257
+ ## Step 3: Notion Integration
258
+
259
+ Ask: **"Do you want digests and product context visible in Notion? This creates a shared Notion page your PM and team can browse."**
260
+
261
+ ### If yes:
262
+
263
+ Ask: **"What Notion workspace should I create the Wayfind pages in? I can search for existing pages or create a new top-level page."**
264
+
265
+ Use the Notion MCP tools to:
266
+
267
+ 1. **Create a top-level page**: "Wayfind — [Team Name]"
268
+ - Use `mcp__notion__notion-create-pages` or the Claude.ai Notion tools
269
+
270
+ 2. **Create child pages**:
271
+ - "Weekly Digests" — will hold one child page per week
272
+ - "Product State" — browseable product intent (mirrors product-state.md files, if using the Product persona)
273
+ - "Decisions Log" — searchable history of decisions
274
+ - "Strategy" — mirrors strategy-state.md (if using the Strategy persona)
275
+ Adapt these pages to match the team's configured personas (see `wayfind personas`).
276
+
277
+ 3. For now, note the page IDs. Full Notion sync (automated posting of digests to
278
+ Notion pages) will be added as a GitHub Action step later. For the dogfood phase,
279
+ digests can be manually pasted or the CTO can update Notion from their session.
280
+
281
+ Record the Notion page IDs in `wayfind-team-context.md`.
282
+
283
+ Tell the user: **"Notion pages created. For now, digests will post to Slack automatically. Notion gets updated when you or a team member copies the digest over, or we can automate that next."**
284
+
285
+ ## Step 4: Product State for Pilot Repo
286
+
287
+ Ask: **"Which repo should we set up persona state files for first? I'll create the intent layer so sessions have context from your configured personas."**
288
+
289
+ Check the team's configured personas (read from `~/.claude/team-context/personas.json` or fall back to `templates/personas.json`). For personas that have state templates (e.g. product-state.md, strategy-state.md), offer to create them.
290
+
291
+ Navigate to that repo (or confirm we're already in it).
292
+
293
+ For the Product persona (default), create `.claude/product-state.md` using the template from `templates/product-state.md`.
294
+
295
+ Walk through filling it in interactively:
296
+
297
+ 1. Ask: **"Who's the PM for this repo?"** → record in team-state.md Signal Routing
298
+ 2. Ask: **"In one or two sentences, what is this repo building and for whom?"** → fill "What We're Building"
299
+ 3. Ask: **"Why is this the priority right now?"** → fill "Why This, Why Now"
300
+ 4. Ask: **"How will you know it's working? What does success look like in user terms?"** → fill "Success Criteria"
301
+ 5. Ask: **"Any scope constraints or product decisions that engineering should know?"** → fill "Scope & Constraints"
302
+ 6. Ask: **"Any open questions that haven't been decided yet?"** → fill "Open Questions"
303
+
304
+ If the user doesn't know answers to some questions, leave the placeholder comments.
305
+ Those fields will get filled by the PM in a future session.
306
+
307
+ ## Step 5: Update Team State
308
+
309
+ If `.claude/team-state.md` exists in the pilot repo, update the Signal Routing section:
310
+
311
+ ```markdown
312
+ ## Signal Routing
313
+ Bugs & feedback: [answer from user or "TBD"]
314
+ Persona contacts: [one entry per configured persona — name and role]
315
+ QA process: [answer from user or "TBD"]
316
+ ```
317
+
318
+ If it doesn't exist, create it from `templates/team-state.md` and fill in what we know.
319
+
320
+ ## Step 6: Journal Sync Configuration
321
+
322
+ Each team member's journals need to flow to the team context repo. Wayfind handles
323
+ this with a single command:
324
+
325
+ ```bash
326
+ wayfind journal sync
327
+ ```
328
+
329
+ This copies local journal files to the team context repo's `journals/<username>/`
330
+ directory, commits, and pushes. The session-end hook should run this automatically.
331
+
332
+ Tell the user to ensure their session-end Stop hook includes `wayfind journal sync`.
333
+ The hook is configured in `~/.claude/settings.json` and typically runs
334
+ `wayfind reindex --conversations-only --export` followed by `wayfind journal sync`.
335
+
336
+ ## Step 7: Onboarding Instructions
337
+
338
+ Generate a message the user can send to their team. Ask: **"What's the best way to share setup instructions with your team? Slack message? Notion page?"**
339
+
340
+ Draft the onboarding message:
341
+
342
+ ```
343
+ Hey team — I've set up Wayfind for our engineering context.
344
+
345
+ **What it does**: Captures the decisions, discoveries, and context from your AI-assisted
346
+ sessions and generates weekly digests so everyone stays oriented.
347
+
348
+ **What you need to do**:
349
+ 1. Install Wayfind:
350
+ ```
351
+ npm install -g wayfind
352
+ ```
353
+ 2. Initialize Wayfind:
354
+ ```
355
+ wayfind init
356
+ ```
357
+ 3. Join our team:
358
+ ```
359
+ wayfind team join [TEAM_ID]
360
+ ```
361
+ 4. Set up your profile (includes Slack user ID):
362
+ ```
363
+ wayfind whoami --setup
364
+ ```
365
+ 5. In any repo you work in, run `/init-memory` to set up context tracking
366
+ 6. That's it. Work normally. Claude will capture context at the end of each session.
367
+
368
+ **What you'll see**:
369
+ - Monday digest in #[channel] showing what shipped, what drifted, and what was discovered
370
+ - Product context in your sessions (so your AI knows *why* you're building what you're building)
371
+
372
+ Questions? Ask [user's name].
373
+ ```
374
+
375
+ ## Step 8: Autopilot Configuration
376
+
377
+ Personas without a human assigned will run in **autopilot mode**. When a persona
378
+ has no user profile claiming it, Wayfind will use autopilot prompt templates
379
+ (in `templates/autopilot/`) to generate that persona's perspective in digests.
380
+
381
+ Tell the user:
382
+
383
+ **"Any persona that no team member claims will run in autopilot mode — the system
384
+ generates that persona's perspective automatically. You can check the current state
385
+ with `wayfind autopilot status`."**
386
+
387
+ Show them the current autopilot status:
388
+
389
+ ```
390
+ wayfind autopilot status
391
+ ```
392
+
393
+ If they want to disable autopilot for a specific persona (leaving it unfilled
394
+ rather than AI-generated):
395
+
396
+ ```
397
+ wayfind autopilot disable <persona-id>
398
+ ```
399
+
400
+ They can re-enable it later with `wayfind autopilot enable <persona-id>`.
401
+
402
+ ## Step 9: Report
403
+
404
+ Summarize everything that was set up:
405
+
406
+ - Team context repo: `<org>/<repo>` — created/configured
407
+ - Slack: webhook configured, posting to `#<channel>` on Mondays
408
+ - Notion: pages created at [page link] (or skipped)
409
+ - Persona state: initialized in `<pilot-repo>` for configured personas
410
+ - Journal sync: configured for current user
411
+ - Onboarding: message drafted for team
412
+
413
+ Tell the user: **"Team context is set up. Send the onboarding message to your team,
414
+ then run the GitHub Action manually to test the first digest. Once journals start
415
+ flowing, you'll see the first real digest next Monday."**
@@ -0,0 +1,66 @@
1
+ ---
2
+ description: Generate a journal summary — weekly digest, drift detection, and recurring lessons from AI session journals.
3
+ ---
4
+
5
+ # Wayfind — Journal Summary
6
+
7
+ Aggregate AI session journal entries into a weekly digest with drift detection and recurring lesson extraction.
8
+
9
+ ## Step 1: Run journal-summary.sh
10
+
11
+ Look for `~/.claude/team-context/journal-summary.sh`. If found, run it based on what the user asked:
12
+
13
+ ```bash
14
+ # This week (default)
15
+ bash ~/.claude/team-context/journal-summary.sh
16
+
17
+ # Last week
18
+ bash ~/.claude/team-context/journal-summary.sh --last-week
19
+
20
+ # Specific date range
21
+ bash ~/.claude/team-context/journal-summary.sh --from 2026-02-01 --to 2026-02-28
22
+
23
+ # All history as Markdown (good for Notion/GitHub)
24
+ bash ~/.claude/team-context/journal-summary.sh --all --format markdown
25
+
26
+ # Team aggregate (each subdir is a contributor's journal dir)
27
+ bash ~/.claude/team-context/journal-summary.sh --team ~/team-journals
28
+
29
+ # Custom journal directory
30
+ bash ~/.claude/team-context/journal-summary.sh --dir ~/.ai-memory/memory/journal
31
+ ```
32
+
33
+ ## Step 2: If journal-summary.sh is not installed
34
+
35
+ Run setup.sh with `--update` to install it:
36
+ ```bash
37
+ bash ~/repos/greg/meridian/setup.sh --tool claude-code --update
38
+ ```
39
+
40
+ Or install manually:
41
+ ```bash
42
+ cp ~/repos/greg/meridian/journal-summary.sh ~/.claude/team-context/journal-summary.sh
43
+ chmod +x ~/.claude/team-context/journal-summary.sh
44
+ ```
45
+
46
+ ## Step 3: Interpret results
47
+
48
+ The summary surfaces four key sections:
49
+
50
+ - **Sessions by Repo** — Every session in the period, grouped by repo. ⚠ marks drifted sessions.
51
+ - **Drift Log** — Sessions where "On track?" indicated scope creep or goal drift. Review these to identify recurring blockers.
52
+ - **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.
53
+ - **All Lessons** — Full lesson archive for the period, with ♻ markers on recurring ones.
54
+
55
+ ## Options quick reference
56
+
57
+ ```
58
+ --dir <path> Journal directory (auto-detects ~/.claude or ~/.ai-memory)
59
+ --team <path> Team mode: each subdirectory is a contributor's journal dir
60
+ --week This week Mon–Sun (default)
61
+ --last-week Last week Mon–Sun
62
+ --from <YYYY-MM-DD> Start date
63
+ --to <YYYY-MM-DD> End date (default: today)
64
+ --all All available journal files
65
+ --format markdown Output as Markdown instead of plain text
66
+ ```
@@ -0,0 +1,119 @@
1
+ ---
2
+ description: Review overnight NanoClaw PRs — fact-check, assess against repo conventions, summarize, and offer merge/revise/close for each.
3
+ ---
4
+
5
+ # Review NanoClaw PRs
6
+
7
+ 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.
8
+
9
+ ## Step 0: Discover repos
10
+
11
+ Read the Wayfind context registry to find repos to scan:
12
+
13
+ ```bash
14
+ cat ~/.claude/team-context/context.json 2>/dev/null | node -e "
15
+ const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
16
+ const teams = d.teams || {};
17
+ Object.values(teams).forEach(t => {
18
+ if (t.repos) t.repos.forEach(r => console.log(r));
19
+ if (t.path) console.log(t.path);
20
+ });
21
+ " 2>/dev/null
22
+ ```
23
+
24
+ If no context registry exists, ask the user which repos to scan. Store the list for subsequent steps.
25
+
26
+ Also detect the GitHub owner by reading git remote from each repo path, or ask the user.
27
+
28
+ ## Step 1: Find open NanoClaw PRs
29
+
30
+ For each discovered repo, check for open NanoClaw PRs:
31
+
32
+ ```bash
33
+ for repo in {owner/repo list from Step 0}; do
34
+ echo "=== $repo ==="
35
+ 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)"'
36
+ done
37
+ ```
38
+
39
+ If no open NanoClaw PRs found, report "No overnight PRs to review" and stop.
40
+
41
+ ## Step 2: Review each PR in parallel
42
+
43
+ **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.
44
+
45
+ Each agent should:
46
+
47
+ 1. **Get the full diff:**
48
+ ```bash
49
+ gh pr diff {number} --repo {owner/repo}
50
+ ```
51
+
52
+ 2. **Get PR metadata:**
53
+ ```bash
54
+ gh pr view {number} --repo {owner/repo} --json title,body,headRefName,createdAt
55
+ ```
56
+
57
+ 3. **Assess the content:**
58
+
59
+ For **competitive intel** PRs (files in `docs/competitive-intel/`):
60
+ - Read `docs/competitive-intel/MONITORING.md` for the required template
61
+ - Does it follow the template?
62
+ - Are sources cited? Do URLs look plausible (not hallucinated)?
63
+ - Are threat assessments reasonable given what we know?
64
+ - Does it claim `Verified: Yes` without evidence of verification?
65
+ - Are there new HIGH-threat competitors that need a full analysis file?
66
+ - Spot-check 2-3 factual claims using `gh api` or web search
67
+
68
+ For **code** PRs:
69
+ - Does it compile/pass tests? (`npm test` if applicable)
70
+ - Are changes scoped correctly (not too broad)?
71
+ - Any obvious bugs, security issues, or style violations?
72
+ - Does it match the repo's conventions?
73
+
74
+ For **documentation** PRs:
75
+ - Is the content accurate and well-structured?
76
+ - Does it duplicate existing docs?
77
+
78
+ 4. **Check the PR title.** NanoClaw often uses the raw prompt as the title. Flag if it needs fixing.
79
+
80
+ Wait for all agents to complete, then synthesize their findings into the summary below.
81
+
82
+ ## Step 3: Present summary
83
+
84
+ For each PR, present:
85
+
86
+ ```
87
+ ### PR #{number}: {title} ({repo})
88
+ **Files:** {list}
89
+ **Quality:** {Good / Needs revision / Reject}
90
+
91
+ **Summary:** {2-3 sentences on what the PR does}
92
+
93
+ **Issues found:**
94
+ - {issue 1}
95
+ - {issue 2}
96
+ (or "None — clean PR")
97
+
98
+ **Fact-check results:**
99
+ - {claim}: {verified/unverified/incorrect}
100
+
101
+ **Recommendation:** Merge / Merge after fixes / Request revision / Close
102
+
103
+ {If merge after fixes: list the specific fixes needed}
104
+ ```
105
+
106
+ ## Step 4: Act on decisions
107
+
108
+ After presenting all summaries, ask the user what to do with each PR. Support these actions:
109
+
110
+ - **Merge**: `gh pr merge {number} --repo {repo} --merge --delete-branch`
111
+ - **Fix title then merge**: `gh pr edit {number} --repo {repo} --title "{new title}"` then merge
112
+ - **Request changes**: Post a review comment and leave open
113
+ - **Close**: `gh pr close {number} --repo {repo}`
114
+ - **Skip**: Leave for later
115
+
116
+ After merging any PRs, pull main:
117
+ ```bash
118
+ git checkout main && git pull
119
+ ```
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+ # Wayfind — Rebuild Active Projects + version check on session start.
3
+ # Rebuilds the Active Projects table from per-repo state files (idempotent,
4
+ # concurrent-safe), then checks if the installed version meets the team
5
+ # minimum configured in the team-context repo's wayfind.json.
6
+ #
7
+ # Install: copy to ~/.claude/hooks/check-global-state.sh
8
+ # Register: add to ~/.claude/settings.json (see settings.json in this directory)
9
+
10
+ set -euo pipefail
11
+
12
+ # Use local wayfind checkout if available, otherwise try npx
13
+ WAYFIND_BIN="$HOME/repos/greg/meridian/bin/team-context.js"
14
+ if [ -f "$WAYFIND_BIN" ]; then
15
+ node "$WAYFIND_BIN" status --write --quiet 2>/dev/null || true
16
+ node "$WAYFIND_BIN" check-version 2>/dev/null || true
17
+ elif command -v wayfind >/dev/null 2>&1; then
18
+ wayfind status --write --quiet 2>/dev/null || true
19
+ wayfind check-version 2>/dev/null || true
20
+ fi
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ # Wayfind session-end 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
+ set -euo pipefail
8
+
9
+ # Skip export for worker agents in multi-agent swarms.
10
+ # Set TEAM_CONTEXT_SKIP_EXPORT=1 when spawning worker agents so only the
11
+ # orchestrator's decisions flow into the journal.
12
+ if [ "${TEAM_CONTEXT_SKIP_EXPORT:-}" = "1" ]; then
13
+ exit 0
14
+ fi
15
+
16
+ # Find wayfind binary
17
+ WAYFIND="$(command -v wayfind 2>/dev/null || echo "")"
18
+ if [ -z "$WAYFIND" ]; then
19
+ # Try npx
20
+ if command -v npx &>/dev/null; then
21
+ WAYFIND="npx --yes wayfind"
22
+ else
23
+ exit 0
24
+ fi
25
+ fi
26
+
27
+ # Run incremental reindex (conversations only — journals are handled by the journal write itself)
28
+ # --conversations-only: skip journals (just written by the session, no need to re-index)
29
+ # --export: write extracted decisions as journal entries for git sync
30
+ # --detect-shifts: auto-update state files when significant context shifts are detected
31
+ # --write-stats: write session stats JSON for status line display
32
+ $WAYFIND reindex --conversations-only --export --detect-shifts --write-stats 2>/dev/null || true
33
+
34
+ # Sync authored journals to team-context repo (commit + push)
35
+ # This makes local journals available to the container and other team members
36
+ $WAYFIND journal sync 2>/dev/null || true
@@ -0,0 +1,15 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "bash ~/.claude/hooks/check-global-state.sh"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }