wayfind 2.0.1 → 2.0.10
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.
- package/LICENSE +200 -0
- package/README.md +197 -0
- package/backup/hooks/session-end.sh +44 -0
- package/backup/hooks/session-start.sh +37 -0
- package/backup/setup.sh +156 -0
- package/bin/content-store.js +34 -5
- package/bin/digest.js +47 -10
- package/bin/team-context.js +102 -20
- package/install.sh +2 -2
- package/package.json +1 -1
- package/specializations/claude-code/README.md +4 -0
- package/specializations/claude-code/commands/doctor.md +11 -9
- package/specializations/claude-code/commands/init-memory.md +21 -0
- package/templates/deploy/.env.example +5 -2
- package/templates/deploy/docker-compose.yml +3 -1
- package/uninstall.sh +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. Please also get it reviewed
|
|
186
|
+
by a counsel familiar with open source licensing.
|
|
187
|
+
|
|
188
|
+
Copyright 2025-2026 Greg Leizerowicz
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Wayfind
|
|
2
|
+
|
|
3
|
+
**Team decision trail for AI-assisted development.**
|
|
4
|
+
|
|
5
|
+
> AI makes individual engineers faster. Nobody has solved coherent, maintainable software built by a *team* over time. Every handoff loses context. Wayfind captures it.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/usewayfind/wayfind/actions/workflows/ci.yml)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://www.npmjs.com/package/wayfind)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g wayfind
|
|
17
|
+
wayfind init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then in a Claude Code session:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/init-memory # Persistent context for this repo
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Your AI sessions now resume where you left off instead of cold-starting.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## What It Does
|
|
31
|
+
|
|
32
|
+
### For You (solo engineer)
|
|
33
|
+
|
|
34
|
+
- **Persistent memory** — sessions pick up where the last one ended
|
|
35
|
+
- **Automatic journal** — decisions and rationale extracted from every session
|
|
36
|
+
- **Searchable history** — `wayfind search-journals "auth refactor"`
|
|
37
|
+
- **Drift detection** — AI flags when work drifts from the stated goal
|
|
38
|
+
|
|
39
|
+
### For Your Team
|
|
40
|
+
|
|
41
|
+
- **Digests** — weekly summaries tailored per role (engineering, product, design, strategy)
|
|
42
|
+
- **Slack bot** — anyone on the team asks `@wayfind` and gets answers from the decision trail
|
|
43
|
+
- **Signal connectors** — pull context from GitHub, Intercom, and Notion into digests
|
|
44
|
+
- **Context shift detection** — surfaces significant pivots and architecture changes
|
|
45
|
+
|
|
46
|
+
Only the engineer installs anything. Everyone else sees a Slack digest.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
/init-team # Set up team context, journals, and digests
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
### Plain Files, Not Databases
|
|
57
|
+
|
|
58
|
+
All context is plain markdown in directories you control:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
~/.claude/
|
|
62
|
+
global-state.md # Thin index — always loaded at session start
|
|
63
|
+
memory/
|
|
64
|
+
journal/YYYY-MM-DD.md # Daily decision log
|
|
65
|
+
|
|
66
|
+
<repo>/.claude/
|
|
67
|
+
state.md # Per-repo: branch, status, next steps
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
No proprietary formats. No vendor lock-in. `grep` works if Wayfind breaks.
|
|
71
|
+
|
|
72
|
+
### The Session Protocol
|
|
73
|
+
|
|
74
|
+
**Start:** AI reads state files, summarizes context, asks "What's the goal?"
|
|
75
|
+
|
|
76
|
+
**Mid-session:** If work drifts from the goal, the AI flags it.
|
|
77
|
+
|
|
78
|
+
**End:** Decisions are extracted, written as journal entries, and synced to the team repo — automatically via hooks.
|
|
79
|
+
|
|
80
|
+
### Digests
|
|
81
|
+
|
|
82
|
+
Each role sees the same underlying data through a different lens:
|
|
83
|
+
|
|
84
|
+
- **Engineering**: What shipped, what drifted, patterns
|
|
85
|
+
- **Product**: What shipped vs. planned, discovery signals
|
|
86
|
+
- **Design**: UX decisions, implementation gaps vs. design intent
|
|
87
|
+
- **Strategy**: Cross-team patterns, drift trends, capability gaps
|
|
88
|
+
|
|
89
|
+
### Signal Connectors
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
wayfind pull github # Issues, PRs, Actions status
|
|
93
|
+
wayfind pull intercom # Support conversations, tags, response times
|
|
94
|
+
wayfind pull notion # Pages, databases, comments
|
|
95
|
+
wayfind pull --all # All configured channels
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Commands
|
|
101
|
+
|
|
102
|
+
| Command | Description |
|
|
103
|
+
|---------|-------------|
|
|
104
|
+
| `wayfind init` | Install for your AI tool |
|
|
105
|
+
| `wayfind doctor` | Check installation health |
|
|
106
|
+
| `wayfind update` | Update to latest version |
|
|
107
|
+
| `wayfind status` | Cross-project status |
|
|
108
|
+
| `wayfind team create` | Create a new team |
|
|
109
|
+
| `wayfind team join` | Join an existing team |
|
|
110
|
+
| `wayfind digest` | Generate persona-specific digests |
|
|
111
|
+
| `wayfind digest --deliver` | Generate and post to Slack |
|
|
112
|
+
| `wayfind bot` | Start the Slack bot |
|
|
113
|
+
| `wayfind reindex` | Index journals + conversations |
|
|
114
|
+
| `wayfind search-journals <q>` | Search decision history |
|
|
115
|
+
| `wayfind pull <channel>` | Pull signals from a source |
|
|
116
|
+
| `wayfind journal sync` | Sync journals to team repo |
|
|
117
|
+
| `wayfind onboard <repo>` | Generate onboarding context pack |
|
|
118
|
+
| `wayfind deploy init` | Scaffold Docker deployment |
|
|
119
|
+
|
|
120
|
+
Run `wayfind help` for the full list.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Environment Variables
|
|
125
|
+
|
|
126
|
+
### For digests and bot
|
|
127
|
+
|
|
128
|
+
| Variable | Description |
|
|
129
|
+
|----------|-------------|
|
|
130
|
+
| `ANTHROPIC_API_KEY` | Digest generation and bot answers |
|
|
131
|
+
| `SLACK_BOT_TOKEN` | Slack bot token (`xoxb-...`) |
|
|
132
|
+
| `SLACK_APP_TOKEN` | Slack app-level token (`xapp-...`) |
|
|
133
|
+
| `GITHUB_TOKEN` | Signal data and journal sync |
|
|
134
|
+
|
|
135
|
+
### Optional
|
|
136
|
+
|
|
137
|
+
| Variable | Description |
|
|
138
|
+
|----------|-------------|
|
|
139
|
+
| `OPENAI_API_KEY` | Semantic search embeddings (full-text works without it) |
|
|
140
|
+
| `TEAM_CONTEXT_LLM_MODEL` | LLM for digests (default: `claude-sonnet-4-5-20250929`) |
|
|
141
|
+
| `TEAM_CONTEXT_DIGEST_SCHEDULE` | Cron schedule (default: `0 8 * * 1` — Monday 8am) |
|
|
142
|
+
| `TEAM_CONTEXT_EXCLUDE_REPOS` | Repos to exclude from digests |
|
|
143
|
+
| `TEAM_CONTEXT_TELEMETRY` | `true` for anonymous usage telemetry |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Tool Support
|
|
148
|
+
|
|
149
|
+
| Tool | Status | Setup |
|
|
150
|
+
|------|--------|-------|
|
|
151
|
+
| Claude Code | Full support | `wayfind init` |
|
|
152
|
+
| Cursor | Session protocol | `wayfind init-cursor` |
|
|
153
|
+
| Generic | Manual | See `specializations/generic/` |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## What's Open Source
|
|
158
|
+
|
|
159
|
+
Everything that runs on your machine is open source (Apache 2.0).
|
|
160
|
+
|
|
161
|
+
| Open Source (this repo) | Commercial (future) |
|
|
162
|
+
|---|---|
|
|
163
|
+
| CLI and all commands | Cloud-hosted team aggregation |
|
|
164
|
+
| Session protocol and journal extraction | Managed digest delivery |
|
|
165
|
+
| Content store and search | Web dashboard |
|
|
166
|
+
| Signal connectors (GitHub, Intercom, Notion) | SSO and tenant isolation |
|
|
167
|
+
| Digest generation (your API key) | |
|
|
168
|
+
| Slack bot (self-hosted) | |
|
|
169
|
+
| Multi-team support | |
|
|
170
|
+
|
|
171
|
+
See [LICENSING.md](LICENSING.md) for details.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Architecture
|
|
176
|
+
|
|
177
|
+
- [Data Flow](docs/architecture/data-flow.md) — sessions to digests
|
|
178
|
+
- [Principles](docs/architecture/architecture-principles.md) — the eight constraints
|
|
179
|
+
- [Content Store](docs/architecture/content-store.md) — indexing, search, schema
|
|
180
|
+
- [Signal Channels](docs/architecture/architecture-signal-channels.md) — connector architecture
|
|
181
|
+
- [Signal Roadmap](docs/architecture/signal-source-roadmap.md) — planned connectors
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Contributing
|
|
186
|
+
|
|
187
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Good first contributions:
|
|
188
|
+
|
|
189
|
+
- **Specializations** for AI tools (Windsurf, Aider, Continue)
|
|
190
|
+
- **Signal connectors** for new tools (Linear, Jira, Slack, HubSpot)
|
|
191
|
+
- Bug reports and feature requests via [issues](https://github.com/usewayfind/wayfind/issues)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
Apache 2.0. See [LICENSE](LICENSE) and [LICENSING.md](LICENSING.md).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Wayfind — Backup Push Hook
|
|
3
|
+
# Runs at session end. Syncs ~/.claude/ memory files to backup repo and pushes.
|
|
4
|
+
# Silently no-ops if backup isn't configured or nothing changed.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
MEMORY_DIR="$HOME/.claude"
|
|
9
|
+
BACKUP_DIR_FILE="$MEMORY_DIR/.backup-dir"
|
|
10
|
+
|
|
11
|
+
[ -f "$BACKUP_DIR_FILE" ] || exit 0
|
|
12
|
+
BACKUP_DIR="$(cat "$BACKUP_DIR_FILE")"
|
|
13
|
+
[ -d "$BACKUP_DIR/.git" ] || exit 0
|
|
14
|
+
command -v git &>/dev/null || exit 0
|
|
15
|
+
|
|
16
|
+
# Sync: ~/.claude/ -> backup repo
|
|
17
|
+
rsync -a \
|
|
18
|
+
"$MEMORY_DIR/global-state.md" \
|
|
19
|
+
"$MEMORY_DIR/state.md" \
|
|
20
|
+
"$BACKUP_DIR/" 2>/dev/null || true
|
|
21
|
+
|
|
22
|
+
if [ -d "$MEMORY_DIR/memory" ]; then
|
|
23
|
+
rsync -a "$MEMORY_DIR/memory/" "$BACKUP_DIR/memory/" 2>/dev/null || true
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Commit and push if anything changed
|
|
27
|
+
cd "$BACKUP_DIR" || { echo "ERROR: cannot cd to backup dir $BACKUP_DIR"; exit 1; }
|
|
28
|
+
git add -A
|
|
29
|
+
if git diff --cached --quiet; then
|
|
30
|
+
exit 0 # Nothing changed — skip silently
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
git commit -m "auto: $(date '+%Y-%m-%d %H:%M')" --quiet
|
|
34
|
+
|
|
35
|
+
# Push
|
|
36
|
+
GIT_ERROR=$(git push origin "${BRANCH:-main}" --quiet 2>&1) && {
|
|
37
|
+
echo "$(date '+%Y-%m-%d %H:%M')" > "$HOME/.claude/.backup-last-push"
|
|
38
|
+
rm -f "$HOME/.claude/.backup-last-error"
|
|
39
|
+
} || {
|
|
40
|
+
ERROR_MSG="$(date '+%Y-%m-%d %H:%M') — git push failed: $GIT_ERROR"
|
|
41
|
+
echo "$ERROR_MSG" > "$HOME/.claude/.backup-last-error"
|
|
42
|
+
echo "Warning: Backup push failed. Details: $HOME/.claude/.backup-last-error"
|
|
43
|
+
exit 1
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Wayfind — Backup Restore Hook
|
|
3
|
+
# Runs at session start. Pulls latest from backup repo, then syncs to ~/.claude/
|
|
4
|
+
# Silently no-ops if backup isn't configured or git isn't available.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
MEMORY_DIR="$HOME/.claude"
|
|
9
|
+
BACKUP_DIR_FILE="$MEMORY_DIR/.backup-dir"
|
|
10
|
+
|
|
11
|
+
[ -f "$BACKUP_DIR_FILE" ] || exit 0
|
|
12
|
+
BACKUP_DIR="$(cat "$BACKUP_DIR_FILE")"
|
|
13
|
+
[ -d "$BACKUP_DIR/.git" ] || exit 0
|
|
14
|
+
command -v git &>/dev/null || exit 0
|
|
15
|
+
|
|
16
|
+
# Warn if last push failed
|
|
17
|
+
LAST_ERROR="$HOME/.claude/.backup-last-error"
|
|
18
|
+
if [ -f "$LAST_ERROR" ]; then
|
|
19
|
+
echo "Warning: Backup: last push FAILED at $(cat "$LAST_ERROR")"
|
|
20
|
+
echo " Fix and re-run: cd ~/.claude-backup && git push"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Pull latest (silently — don't block session start)
|
|
24
|
+
git -C "$BACKUP_DIR" pull --quiet --ff-only 2>/dev/null || true
|
|
25
|
+
|
|
26
|
+
# Restore: sync backup -> ~/.claude/
|
|
27
|
+
rsync -a --update \
|
|
28
|
+
"$BACKUP_DIR/global-state.md" \
|
|
29
|
+
"$MEMORY_DIR/" 2>/dev/null || true
|
|
30
|
+
|
|
31
|
+
rsync -a --update \
|
|
32
|
+
"$BACKUP_DIR/state.md" \
|
|
33
|
+
"$MEMORY_DIR/" 2>/dev/null || true
|
|
34
|
+
|
|
35
|
+
if [ -d "$BACKUP_DIR/memory" ]; then
|
|
36
|
+
rsync -a --update "$BACKUP_DIR/memory/" "$MEMORY_DIR/memory/" 2>/dev/null || true
|
|
37
|
+
fi
|
package/backup/setup.sh
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Wayfind — Backup Setup
|
|
3
|
+
# Wires a private GitHub repo as your memory backup.
|
|
4
|
+
#
|
|
5
|
+
# Usage: bash backup/setup.sh <repo-url>
|
|
6
|
+
# Example: bash backup/setup.sh git@github.com:you/claude-memory.git
|
|
7
|
+
# bash backup/setup.sh https://github.com/you/claude-memory.git
|
|
8
|
+
#
|
|
9
|
+
# What this does:
|
|
10
|
+
# 1. Clones your backup repo to ~/.claude-backup/
|
|
11
|
+
# 2. Does an initial sync of your memory files into it
|
|
12
|
+
# 3. Installs session-start (restore) and session-end (push) hooks
|
|
13
|
+
# 4. Registers both hooks in ~/.claude/settings.json
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
REPO_URL="${1:-}"
|
|
18
|
+
BACKUP_DIR="$HOME/.claude-backup"
|
|
19
|
+
MEMORY_DIR="$HOME/.claude"
|
|
20
|
+
HOOKS_DIR="$HOME/.claude/hooks"
|
|
21
|
+
SETTINGS="$HOME/.claude/settings.json"
|
|
22
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
23
|
+
|
|
24
|
+
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; RESET='\033[0m'
|
|
25
|
+
log() { echo -e "${GREEN}✓${RESET} $1"; }
|
|
26
|
+
warn() { echo -e "${YELLOW}⚠${RESET} $1"; }
|
|
27
|
+
err() { echo -e "${RED}✗${RESET} $1"; exit 1; }
|
|
28
|
+
|
|
29
|
+
# ── Validate ──────────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
if [ -z "$REPO_URL" ]; then
|
|
32
|
+
err "No repo URL provided.\nUsage: bash backup/setup.sh <repo-url>"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if ! command -v git &>/dev/null; then
|
|
36
|
+
err "git is required but not installed."
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if ! command -v rsync &>/dev/null; then
|
|
40
|
+
err "rsync is required but not installed. On macOS: brew install rsync"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# ── Clone or init backup repo ─────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
echo ""
|
|
46
|
+
echo "Wayfind — Backup Setup"
|
|
47
|
+
echo ""
|
|
48
|
+
|
|
49
|
+
if [ -d "$BACKUP_DIR/.git" ]; then
|
|
50
|
+
warn "Backup repo already exists at $BACKUP_DIR — pulling latest"
|
|
51
|
+
git -C "$BACKUP_DIR" pull --quiet
|
|
52
|
+
else
|
|
53
|
+
echo "Cloning backup repo..."
|
|
54
|
+
if git clone "$REPO_URL" "$BACKUP_DIR" 2>/dev/null; then
|
|
55
|
+
log "Cloned $REPO_URL → $BACKUP_DIR"
|
|
56
|
+
else
|
|
57
|
+
# Repo exists on GitHub but is empty — clone fails. Init locally instead.
|
|
58
|
+
mkdir -p "$BACKUP_DIR"
|
|
59
|
+
git -C "$BACKUP_DIR" init
|
|
60
|
+
git -C "$BACKUP_DIR" remote add origin "$REPO_URL"
|
|
61
|
+
log "Initialized empty backup repo at $BACKUP_DIR"
|
|
62
|
+
fi
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# ── Initial sync ──────────────────────────────────────────────────────────────
|
|
66
|
+
|
|
67
|
+
echo "Syncing memory files to backup repo..."
|
|
68
|
+
|
|
69
|
+
# Files to back up: global index, admin state, and the entire memory/ directory
|
|
70
|
+
mkdir -p "$BACKUP_DIR"
|
|
71
|
+
rsync -a \
|
|
72
|
+
"$MEMORY_DIR/global-state.md" \
|
|
73
|
+
"$MEMORY_DIR/state.md" \
|
|
74
|
+
"$BACKUP_DIR/" 2>/dev/null || true
|
|
75
|
+
|
|
76
|
+
if [ -d "$MEMORY_DIR/memory" ]; then
|
|
77
|
+
mkdir -p "$BACKUP_DIR/memory"
|
|
78
|
+
rsync -a "$MEMORY_DIR/memory/" "$BACKUP_DIR/memory/" 2>/dev/null || true
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Initial commit
|
|
82
|
+
cd "$BACKUP_DIR"
|
|
83
|
+
git add -A
|
|
84
|
+
if ! git diff --cached --quiet; then
|
|
85
|
+
git commit -m "initial backup — $(date '+%Y-%m-%d')"
|
|
86
|
+
git push -u origin main 2>/dev/null || git push -u origin master 2>/dev/null || \
|
|
87
|
+
warn "Push failed — check your repo URL and SSH/token auth, then run: git -C $BACKUP_DIR push"
|
|
88
|
+
log "Initial backup pushed"
|
|
89
|
+
else
|
|
90
|
+
log "Nothing to commit in initial sync"
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
# ── Install hook scripts ──────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
mkdir -p "$HOOKS_DIR"
|
|
96
|
+
|
|
97
|
+
cp "$SCRIPT_DIR/hooks/session-start.sh" "$HOOKS_DIR/backup-restore.sh"
|
|
98
|
+
chmod +x "$HOOKS_DIR/backup-restore.sh"
|
|
99
|
+
log "Installed: $HOOKS_DIR/backup-restore.sh"
|
|
100
|
+
|
|
101
|
+
cp "$SCRIPT_DIR/hooks/session-end.sh" "$HOOKS_DIR/backup-push.sh"
|
|
102
|
+
chmod +x "$HOOKS_DIR/backup-push.sh"
|
|
103
|
+
log "Installed: $HOOKS_DIR/backup-push.sh"
|
|
104
|
+
|
|
105
|
+
# Store the backup dir path so hooks know where to find it
|
|
106
|
+
echo "$BACKUP_DIR" > "$MEMORY_DIR/.backup-dir"
|
|
107
|
+
log "Stored backup dir config: $MEMORY_DIR/.backup-dir"
|
|
108
|
+
|
|
109
|
+
# ── Register hooks in settings.json ──────────────────────────────────────────
|
|
110
|
+
|
|
111
|
+
if [ ! -f "$SETTINGS" ]; then
|
|
112
|
+
cp "$SCRIPT_DIR/../specializations/claude-code/settings.json" "$SETTINGS"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
python3 - <<PYEOF
|
|
116
|
+
import json, os
|
|
117
|
+
|
|
118
|
+
settings_path = os.path.expanduser("$SETTINGS")
|
|
119
|
+
with open(settings_path) as f:
|
|
120
|
+
s = json.load(f)
|
|
121
|
+
|
|
122
|
+
hooks = s.setdefault("hooks", {})
|
|
123
|
+
|
|
124
|
+
# SessionStart: restore (pull) — prepend so it runs before check-global-state
|
|
125
|
+
start_hooks = hooks.setdefault("SessionStart", [])
|
|
126
|
+
restore_cmd = {"type": "command", "command": "bash ~/.claude/hooks/backup-restore.sh"}
|
|
127
|
+
if not any(h.get("command", "").endswith("backup-restore.sh") for h in start_hooks):
|
|
128
|
+
start_hooks.insert(0, restore_cmd)
|
|
129
|
+
print(" + Registered backup-restore.sh in SessionStart")
|
|
130
|
+
else:
|
|
131
|
+
print(" - backup-restore.sh already in SessionStart")
|
|
132
|
+
|
|
133
|
+
# Stop: push — runs when Claude session ends
|
|
134
|
+
stop_hooks = hooks.setdefault("Stop", [])
|
|
135
|
+
push_cmd = {"type": "command", "command": "bash ~/.claude/hooks/backup-push.sh"}
|
|
136
|
+
if not any(h.get("command", "").endswith("backup-push.sh") for h in stop_hooks):
|
|
137
|
+
stop_hooks.append(push_cmd)
|
|
138
|
+
print(" + Registered backup-push.sh in Stop")
|
|
139
|
+
else:
|
|
140
|
+
print(" - backup-push.sh already in Stop")
|
|
141
|
+
|
|
142
|
+
with open(settings_path, "w") as f:
|
|
143
|
+
json.dump(s, f, indent=2)
|
|
144
|
+
f.write("\n")
|
|
145
|
+
PYEOF
|
|
146
|
+
|
|
147
|
+
log "Updated $SETTINGS"
|
|
148
|
+
|
|
149
|
+
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
echo ""
|
|
152
|
+
echo "Backup setup complete."
|
|
153
|
+
echo " Backup repo: $BACKUP_DIR → $REPO_URL"
|
|
154
|
+
echo " Restore hook: runs at session start (pulls latest)"
|
|
155
|
+
echo " Push hook: runs at session end (commits + pushes changes)"
|
|
156
|
+
echo ""
|
package/bin/content-store.js
CHANGED
|
@@ -39,7 +39,14 @@ const ENTRY_HEADER_RE = /^##\s+(.+?)\s+[—–]\s+(.+)$/;
|
|
|
39
39
|
const FIELD_RE = /^\*\*([^*:]+):\*\*\s*(.*)$/;
|
|
40
40
|
const DATE_FILE_RE = /^(\d{4}-\d{2}-\d{2})(?:-([a-z0-9._-]+))?\.md$/;
|
|
41
41
|
|
|
42
|
-
//
|
|
42
|
+
// Team repo allowlist — when set, only entries from matching repos are indexed/queried.
|
|
43
|
+
// Replaces the old TEAM_CONTEXT_EXCLUDE_REPOS blocklist approach.
|
|
44
|
+
// Format: comma-separated, supports org/* wildcards (e.g., "HopSkipInc/*,Doorbell/*")
|
|
45
|
+
const INCLUDE_REPOS = (process.env.TEAM_CONTEXT_INCLUDE_REPOS || '')
|
|
46
|
+
.split(',').map(r => r.trim().toLowerCase()).filter(Boolean);
|
|
47
|
+
|
|
48
|
+
// DEPRECATED: Legacy blocklist — use TEAM_CONTEXT_INCLUDE_REPOS instead.
|
|
49
|
+
// Still read for backward compatibility during migration.
|
|
43
50
|
const EXCLUDE_REPOS = (process.env.TEAM_CONTEXT_EXCLUDE_REPOS || '')
|
|
44
51
|
.split(',').map(r => r.trim().toLowerCase()).filter(Boolean);
|
|
45
52
|
|
|
@@ -48,13 +55,33 @@ const DRIFT_POSITIVE = ['drift', 'drifted', 'tangent', 'pivoted', 'sidetracked',
|
|
|
48
55
|
const DRIFT_NEGATIVE = ['no drift', 'no tangent', 'on track', 'focused', 'laser focused', 'stayed focused'];
|
|
49
56
|
|
|
50
57
|
/**
|
|
51
|
-
* Check if a repo
|
|
52
|
-
*
|
|
58
|
+
* Check if a repo should be filtered out.
|
|
59
|
+
* If INCLUDE_REPOS is set: only allow repos matching the allowlist.
|
|
60
|
+
* If only EXCLUDE_REPOS is set (legacy): block repos on the blocklist.
|
|
61
|
+
* Supports org/* wildcard patterns.
|
|
53
62
|
*/
|
|
54
63
|
function isRepoExcluded(repo) {
|
|
55
|
-
if (!
|
|
64
|
+
if (!repo) return (INCLUDE_REPOS.length > 0); // exclude null repo only when allowlist active
|
|
56
65
|
const lower = repo.toLowerCase();
|
|
57
|
-
|
|
66
|
+
|
|
67
|
+
// Allowlist takes priority — if set, only matching repos pass
|
|
68
|
+
if (INCLUDE_REPOS.length > 0) {
|
|
69
|
+
return !INCLUDE_REPOS.some(pattern => {
|
|
70
|
+
if (pattern.endsWith('/*')) {
|
|
71
|
+
// org/* wildcard — match org prefix
|
|
72
|
+
const org = pattern.slice(0, -2);
|
|
73
|
+
return lower.startsWith(org + '/');
|
|
74
|
+
}
|
|
75
|
+
return lower === pattern || lower.endsWith('/' + pattern) || lower.startsWith(pattern + '/');
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Legacy blocklist fallback
|
|
80
|
+
if (EXCLUDE_REPOS.length > 0) {
|
|
81
|
+
return EXCLUDE_REPOS.some(ex => lower === ex || lower.endsWith('/' + ex) || lower.startsWith(ex + '/'));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return false;
|
|
58
85
|
}
|
|
59
86
|
|
|
60
87
|
// ── Journal parsing ─────────────────────────────────────────────────────────
|
|
@@ -1560,6 +1587,7 @@ async function indexConversationsWithExport(options = {}) {
|
|
|
1560
1587
|
// Write pending exports — route to per-team journal files
|
|
1561
1588
|
for (const { date, repo, decisions } of pendingExports) {
|
|
1562
1589
|
const teamId = repoToTeam(repo);
|
|
1590
|
+
if (!teamId) continue; // Unbound repo — skip export (opt-in via .claude/wayfind.json)
|
|
1563
1591
|
exportDecisionsAsJournal(date, repo, decisions, exportDir, teamId, author);
|
|
1564
1592
|
exported += decisions.length;
|
|
1565
1593
|
for (const d of decisions) {
|
|
@@ -1969,6 +1997,7 @@ module.exports = {
|
|
|
1969
1997
|
saveConversationIndex: (storePath, convIndex) => getBackend(storePath || DEFAULT_STORE_PATH).saveConversationIndex(convIndex),
|
|
1970
1998
|
|
|
1971
1999
|
// Filtering
|
|
2000
|
+
isRepoExcluded,
|
|
1972
2001
|
applyFilters,
|
|
1973
2002
|
|
|
1974
2003
|
// Core operations
|
package/bin/digest.js
CHANGED
|
@@ -11,13 +11,32 @@ const HOME = process.env.HOME || process.env.USERPROFILE;
|
|
|
11
11
|
const WAYFIND_DIR = path.join(HOME, '.claude', 'team-context');
|
|
12
12
|
const ENV_FILE = path.join(WAYFIND_DIR, '.env');
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// Team repo allowlist — mirrors content-store.js logic for digest-time filtering.
|
|
15
|
+
// When INCLUDE_REPOS is set, sections mentioning repos NOT on the list are removed.
|
|
16
|
+
// Falls back to EXCLUDE_REPOS (legacy) for backward compatibility.
|
|
17
|
+
const INCLUDE_REPOS_RAW = (process.env.TEAM_CONTEXT_INCLUDE_REPOS || '')
|
|
18
|
+
.split(',').map(r => r.trim()).filter(Boolean);
|
|
15
19
|
const EXCLUDE_REPOS_RAW = (process.env.TEAM_CONTEXT_EXCLUDE_REPOS || '')
|
|
16
20
|
.split(',').map(r => r.trim()).filter(Boolean);
|
|
17
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Check if a repo name matches the include list.
|
|
24
|
+
* Supports org/* wildcards.
|
|
25
|
+
*/
|
|
26
|
+
function isRepoIncluded(repo) {
|
|
27
|
+
if (INCLUDE_REPOS_RAW.length === 0) return true; // no filter = include all
|
|
28
|
+
const lower = repo.toLowerCase();
|
|
29
|
+
return INCLUDE_REPOS_RAW.some(pattern => {
|
|
30
|
+
const p = pattern.toLowerCase();
|
|
31
|
+
if (p.endsWith('/*')) {
|
|
32
|
+
return lower.startsWith(p.slice(0, -2) + '/');
|
|
33
|
+
}
|
|
34
|
+
return lower === p || lower.endsWith('/' + p) || lower.startsWith(p + '/');
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
function buildExcludePattern() {
|
|
19
39
|
if (EXCLUDE_REPOS_RAW.length === 0) return null;
|
|
20
|
-
// Match repo names as whole words (case-insensitive)
|
|
21
40
|
const escaped = EXCLUDE_REPOS_RAW.map(r => r.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
22
41
|
return new RegExp(`\\b(${escaped.join('|')})\\b`, 'i');
|
|
23
42
|
}
|
|
@@ -25,15 +44,33 @@ function buildExcludePattern() {
|
|
|
25
44
|
const EXCLUDE_CONTENT_RE = buildExcludePattern();
|
|
26
45
|
|
|
27
46
|
/**
|
|
28
|
-
* Filter assembled content sections by
|
|
29
|
-
*
|
|
47
|
+
* Filter assembled content sections by team boundaries.
|
|
48
|
+
* Sections are separated by \n\n---\n\n.
|
|
49
|
+
* If INCLUDE_REPOS is set: keep only sections mentioning included repos.
|
|
50
|
+
* Falls back to EXCLUDE_REPOS regex for backward compatibility.
|
|
30
51
|
*/
|
|
31
52
|
function filterExcludedContent(content) {
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
if (!content) return content;
|
|
54
|
+
|
|
55
|
+
const sections = content.split('\n\n---\n\n');
|
|
56
|
+
|
|
57
|
+
if (INCLUDE_REPOS_RAW.length > 0) {
|
|
58
|
+
// Allowlist mode: extract repo from section header (### DATE — REPO) and check
|
|
59
|
+
return sections.filter(section => {
|
|
60
|
+
const repoMatch = section.match(/^###\s+\S+\s+[—–]\s+(\S+)/);
|
|
61
|
+
if (!repoMatch) return true; // keep non-journal sections (signals, etc.)
|
|
62
|
+
return isRepoIncluded(repoMatch[1]);
|
|
63
|
+
}).join('\n\n---\n\n');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Legacy: regex blocklist
|
|
67
|
+
if (EXCLUDE_CONTENT_RE) {
|
|
68
|
+
return sections
|
|
69
|
+
.filter(section => !EXCLUDE_CONTENT_RE.test(section))
|
|
70
|
+
.join('\n\n---\n\n');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return content;
|
|
37
74
|
}
|
|
38
75
|
|
|
39
76
|
// ── Env file helpers ────────────────────────────────────────────────────────
|
|
@@ -636,7 +673,7 @@ async function generateDigest(config, personaIds, sinceDate, onProgress) {
|
|
|
636
673
|
journalContent = collectJournals(sinceDate, config.journal_dir);
|
|
637
674
|
}
|
|
638
675
|
|
|
639
|
-
// Filter
|
|
676
|
+
// Filter by team boundaries (TEAM_CONTEXT_INCLUDE_REPOS allowlist, falls back to EXCLUDE_REPOS)
|
|
640
677
|
journalContent = filterExcludedContent(journalContent);
|
|
641
678
|
signalContent = filterExcludedContent(signalContent);
|
|
642
679
|
|
package/bin/team-context.js
CHANGED
|
@@ -1175,8 +1175,11 @@ async function runReindex(args) {
|
|
|
1175
1175
|
/**
|
|
1176
1176
|
* Build a repo-to-team resolver function.
|
|
1177
1177
|
* Scans context.json teams and all known repo bindings to map repo names → team IDs.
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1178
|
+
* Returns null for unbound repos — they are invisible to export/sync.
|
|
1179
|
+
* NOTE: config.default is intentionally NOT used here. The "default" field in context.json
|
|
1180
|
+
* exists for the `context bind` command's UX (pre-selecting a team), not for implicit
|
|
1181
|
+
* routing of unknown repos. Repos must opt in via .claude/wayfind.json to participate.
|
|
1182
|
+
* @returns {function(string): string|null} - Maps repo name (e.g. "acme-corp/api") to team ID, or null if unbound
|
|
1180
1183
|
*/
|
|
1181
1184
|
function buildRepoToTeamResolver() {
|
|
1182
1185
|
const config = readContextConfig();
|
|
@@ -1228,8 +1231,11 @@ function buildRepoToTeamResolver() {
|
|
|
1228
1231
|
if (repoName.startsWith(key + '/') || repoName === key) return teamId;
|
|
1229
1232
|
}
|
|
1230
1233
|
|
|
1231
|
-
//
|
|
1232
|
-
|
|
1234
|
+
// No binding found — return null so unbound repos don't leak into
|
|
1235
|
+
// the default team's digest. Repos must have .claude/wayfind.json to
|
|
1236
|
+
// be routed. The "default" team in context.json is for the `context bind`
|
|
1237
|
+
// command's UX, not for implicit routing of unknown repos.
|
|
1238
|
+
return null;
|
|
1233
1239
|
};
|
|
1234
1240
|
}
|
|
1235
1241
|
|
|
@@ -1850,7 +1856,7 @@ function journalSplitByTeam(args) {
|
|
|
1850
1856
|
* Sync local journals to team-context repo(s) journals/ directory.
|
|
1851
1857
|
* Routes per-team journal files (YYYY-MM-DD-{teamId}.md or YYYY-MM-DD-{author}-{teamId}.md)
|
|
1852
1858
|
* to the correct team-context repo based on the team ID suffix.
|
|
1853
|
-
*
|
|
1859
|
+
* Files without a team suffix are skipped — repos must opt in via .claude/wayfind.json.
|
|
1854
1860
|
* Usage: wayfind journal sync [--dir <path>] [--since YYYY-MM-DD]
|
|
1855
1861
|
*/
|
|
1856
1862
|
function journalSync(args) {
|
|
@@ -1906,8 +1912,6 @@ function journalSync(args) {
|
|
|
1906
1912
|
|
|
1907
1913
|
// Categorize files: { teamId → [{ file, srcPath }] }
|
|
1908
1914
|
const teamFiles = {};
|
|
1909
|
-
const defaultTeam = config.default || null;
|
|
1910
|
-
|
|
1911
1915
|
for (const file of allFiles) {
|
|
1912
1916
|
// Extract date for --since filtering
|
|
1913
1917
|
const dateMatch = file.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
@@ -1932,8 +1936,7 @@ function journalSync(args) {
|
|
|
1932
1936
|
}
|
|
1933
1937
|
}
|
|
1934
1938
|
|
|
1935
|
-
// No team suffix →
|
|
1936
|
-
if (!teamId) teamId = defaultTeam;
|
|
1939
|
+
// No team suffix → skip. Repos must opt in via .claude/wayfind.json.
|
|
1937
1940
|
if (!teamId) continue;
|
|
1938
1941
|
|
|
1939
1942
|
if (!teamFiles[teamId]) teamFiles[teamId] = [];
|
|
@@ -3977,7 +3980,7 @@ const COMMANDS = {
|
|
|
3977
3980
|
desc: 'Sync code to the public usewayfind/wayfind repo',
|
|
3978
3981
|
run: () => {
|
|
3979
3982
|
const tmpDir = path.join(os.tmpdir(), 'wayfind-public-sync');
|
|
3980
|
-
const publicRepo = 'https://github.com/usewayfind/wayfind.git';
|
|
3983
|
+
const publicRepo = process.env.WAYFIND_PUBLIC_REPO || 'https://github.com/usewayfind/wayfind.git';
|
|
3981
3984
|
|
|
3982
3985
|
// Clone or pull public repo
|
|
3983
3986
|
if (fs.existsSync(tmpDir)) {
|
|
@@ -3999,10 +4002,14 @@ const COMMANDS = {
|
|
|
3999
4002
|
// Files and directories to sync
|
|
4000
4003
|
const syncItems = [
|
|
4001
4004
|
'bin/', 'templates/', 'specializations/', 'tests/', 'simulation/',
|
|
4002
|
-
'
|
|
4003
|
-
'
|
|
4005
|
+
'backup/', '.github/', 'Dockerfile', 'package.json', 'setup.sh',
|
|
4006
|
+
'install.sh', 'uninstall.sh', 'doctor.sh', 'journal-summary.sh',
|
|
4007
|
+
'BOOTSTRAP_PROMPT.md', '.gitattributes', '.gitignore', 'VERSIONS.md',
|
|
4004
4008
|
];
|
|
4005
4009
|
|
|
4010
|
+
// Workflows that only belong on the private repo
|
|
4011
|
+
const privateOnlyWorkflows = ['sync-public.yml', 'simulation.yml'];
|
|
4012
|
+
|
|
4006
4013
|
// Also sync public-staging docs if they exist
|
|
4007
4014
|
const publicDocsDir = path.join(ROOT, 'public-staging', 'docs');
|
|
4008
4015
|
|
|
@@ -4022,10 +4029,85 @@ const COMMANDS = {
|
|
|
4022
4029
|
}
|
|
4023
4030
|
}
|
|
4024
4031
|
|
|
4025
|
-
//
|
|
4026
|
-
|
|
4027
|
-
|
|
4032
|
+
// Remove private-only workflows from the public copy
|
|
4033
|
+
for (const wf of privateOnlyWorkflows) {
|
|
4034
|
+
const wfPath = path.join(tmpDir, '.github', 'workflows', wf);
|
|
4035
|
+
if (fs.existsSync(wfPath)) fs.unlinkSync(wfPath);
|
|
4036
|
+
}
|
|
4037
|
+
|
|
4038
|
+
// Sync public-staging/ → public repo root (recursive)
|
|
4039
|
+
// This overlays LICENSE, README, CHANGELOG, SECURITY, CONTRIBUTING, docs/, etc.
|
|
4040
|
+
const publicStagingDir = path.join(ROOT, 'public-staging');
|
|
4041
|
+
if (fs.existsSync(publicStagingDir)) {
|
|
4042
|
+
spawnSync('rsync', ['-a', publicStagingDir + '/', tmpDir + '/'], { stdio: 'inherit' });
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
// ── Sanitization gate ───────────────────────────────────────────────
|
|
4046
|
+
// Scan all tracked text files for proprietary patterns before pushing.
|
|
4047
|
+
// Patterns loaded from .sync-blocklist (not synced to public repo).
|
|
4048
|
+
const blocklistPath = path.join(ROOT, '.sync-blocklist');
|
|
4049
|
+
const BLOCKED_PATTERNS = [];
|
|
4050
|
+
if (fs.existsSync(blocklistPath)) {
|
|
4051
|
+
for (const line of fs.readFileSync(blocklistPath, 'utf8').split('\n')) {
|
|
4052
|
+
const trimmed = line.trim();
|
|
4053
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
4054
|
+
// Each line is a regex pattern, optionally with /flags
|
|
4055
|
+
const m = trimmed.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
4056
|
+
if (m) {
|
|
4057
|
+
BLOCKED_PATTERNS.push(new RegExp(m[1], m[2]));
|
|
4058
|
+
} else {
|
|
4059
|
+
// Plain string → case-insensitive word boundary match
|
|
4060
|
+
BLOCKED_PATTERNS.push(new RegExp('\\b' + trimmed.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\b', 'i'));
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
if (BLOCKED_PATTERNS.length === 0) {
|
|
4065
|
+
console.warn('⚠️ No .sync-blocklist found — skipping sanitization scan.');
|
|
4066
|
+
console.warn(' Create .sync-blocklist with one pattern per line to enable leak detection.');
|
|
4028
4067
|
}
|
|
4068
|
+
// Files/dirs exempt from scanning
|
|
4069
|
+
const SCAN_EXEMPT = [
|
|
4070
|
+
/\/\.git\//,
|
|
4071
|
+
/node_modules\//,
|
|
4072
|
+
/clean-machine-onboard\.sh$/, // contains negative assertions checking for org-name leaks
|
|
4073
|
+
];
|
|
4074
|
+
|
|
4075
|
+
console.log('Running sanitization scan...');
|
|
4076
|
+
const violations = [];
|
|
4077
|
+
const scanDir = (dir) => {
|
|
4078
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
4079
|
+
const full = path.join(dir, entry.name);
|
|
4080
|
+
const rel = path.relative(tmpDir, full);
|
|
4081
|
+
if (SCAN_EXEMPT.some(r => r.test(full))) continue;
|
|
4082
|
+
if (entry.isDirectory()) { scanDir(full); continue; }
|
|
4083
|
+
// Skip binary files
|
|
4084
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
4085
|
+
if (['.png', '.jpg', '.jpeg', '.gif', '.ico', '.woff', '.woff2', '.ttf', '.eot', '.tgz', '.gz', '.zip'].includes(ext)) continue;
|
|
4086
|
+
try {
|
|
4087
|
+
const content = fs.readFileSync(full, 'utf8');
|
|
4088
|
+
const lines = content.split('\n');
|
|
4089
|
+
for (let i = 0; i < lines.length; i++) {
|
|
4090
|
+
for (const pat of BLOCKED_PATTERNS) {
|
|
4091
|
+
if (pat.test(lines[i])) {
|
|
4092
|
+
violations.push({ file: rel, line: i + 1, pattern: pat.source, text: lines[i].trim().slice(0, 120) });
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
} catch { /* binary file, skip */ }
|
|
4097
|
+
}
|
|
4098
|
+
};
|
|
4099
|
+
scanDir(tmpDir);
|
|
4100
|
+
|
|
4101
|
+
if (violations.length > 0) {
|
|
4102
|
+
console.error('\n❌ Sanitization FAILED — proprietary content detected:\n');
|
|
4103
|
+
for (const v of violations) {
|
|
4104
|
+
console.error(` ${v.file}:${v.line} [${v.pattern}]`);
|
|
4105
|
+
console.error(` ${v.text}\n`);
|
|
4106
|
+
}
|
|
4107
|
+
console.error(`${violations.length} violation(s) found. Fix these before syncing to the public repo.`);
|
|
4108
|
+
process.exit(1);
|
|
4109
|
+
}
|
|
4110
|
+
console.log('Sanitization passed — no proprietary content detected.');
|
|
4029
4111
|
|
|
4030
4112
|
// Show what changed
|
|
4031
4113
|
const diffResult = spawnSync('git', ['status', '--short'], { cwd: tmpDir, stdio: 'pipe' });
|
|
@@ -4052,11 +4134,11 @@ const COMMANDS = {
|
|
|
4052
4134
|
}
|
|
4053
4135
|
|
|
4054
4136
|
console.log('Pushing to usewayfind/wayfind...');
|
|
4055
|
-
//
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
const pushResult = spawnSync('git', ['push'], { cwd: tmpDir, stdio: 'inherit'
|
|
4137
|
+
// Allow override for SSH-based multi-account routing
|
|
4138
|
+
if (process.env.WAYFIND_PUBLIC_REPO) {
|
|
4139
|
+
spawnSync('git', ['remote', 'set-url', 'origin', process.env.WAYFIND_PUBLIC_REPO], { cwd: tmpDir });
|
|
4140
|
+
}
|
|
4141
|
+
const pushResult = spawnSync('git', ['push'], { cwd: tmpDir, stdio: 'inherit' });
|
|
4060
4142
|
if (pushResult.status !== 0) {
|
|
4061
4143
|
console.error('Push failed — check your access to usewayfind/wayfind');
|
|
4062
4144
|
process.exit(1);
|
package/install.sh
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Wayfind — Installer
|
|
3
3
|
# Usage:
|
|
4
|
-
# curl -fsSL https://raw.githubusercontent.com/
|
|
4
|
+
# curl -fsSL https://raw.githubusercontent.com/usewayfind/wayfind/main/install.sh | bash
|
|
5
5
|
# WAYFIND_VERSION=v1.1.0 bash install.sh # Install specific version
|
|
6
6
|
# bash install.sh --force # Force reinstall even if same version
|
|
7
7
|
|
|
8
8
|
set -euo pipefail
|
|
9
9
|
|
|
10
|
-
REPO="
|
|
10
|
+
REPO="usewayfind/wayfind"
|
|
11
11
|
VERSION="${WAYFIND_VERSION:-main}"
|
|
12
12
|
TMP_DIR="$(mktemp -d)"
|
|
13
13
|
FORCE=false
|
package/package.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Claude Code Specialization
|
|
2
2
|
|
|
3
|
+
> **Note:** The canonical plugin source is now in `plugin/` at the repo root.
|
|
4
|
+
> This `specializations/claude-code/` directory is kept for backward compatibility
|
|
5
|
+
> with `setup.sh` but `plugin/` is the source of truth for Claude Code integration.
|
|
6
|
+
|
|
3
7
|
This directory contains everything needed to wire Wayfind into Claude Code specifically.
|
|
4
8
|
|
|
5
9
|
## What's Different About Claude Code
|
|
@@ -13,19 +13,21 @@ Look for `~/.claude/team-context/doctor.sh`. If found, run it:
|
|
|
13
13
|
bash ~/.claude/team-context/doctor.sh
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
If not found, perform the checks manually
|
|
16
|
+
If `doctor.sh` is not found, perform the checks manually using Steps 2-3 below.
|
|
17
17
|
|
|
18
18
|
## Step 2: Manual checks
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
Use the Read tool (not Bash) for file checks. Use Glob for file discovery.
|
|
21
|
+
|
|
22
|
+
1. **Hook registered?** — Read `~/.claude/settings.json`. Check if it contains "check-global-state".
|
|
23
|
+
2. **Global state current?** — Read `~/.claude/global-state.md`. Check the "Last updated" line near the top.
|
|
24
|
+
3. **Backup status** — Read `~/.claude/.backup-last-push`. If the file doesn't exist, report "Backup not configured."
|
|
25
|
+
4. **Repos** — Use Glob to find `~/repos/**/.claude/state.md` and `~/repos/**/.claude/team-state.md` files. Report each with its parent repo name.
|
|
26
|
+
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/`.
|
|
25
27
|
|
|
26
28
|
## Step 3: Report findings
|
|
27
29
|
|
|
28
30
|
Report in this format:
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
31
|
+
- Items that are working correctly
|
|
32
|
+
- Items that need attention (not broken, but worth knowing)
|
|
33
|
+
- Items that are broken (with how to fix)
|
|
@@ -23,6 +23,26 @@ If the old protocol is not detected, skip this step silently.
|
|
|
23
23
|
- Check if it's a git repo (`ls .git` or `git rev-parse --show-toplevel`)
|
|
24
24
|
- Read `~/.claude/global-state.md` to check if this repo is already registered
|
|
25
25
|
|
|
26
|
+
## Step 1.5: Bind repo to team
|
|
27
|
+
|
|
28
|
+
Check if `.claude/wayfind.json` already exists in the repo.
|
|
29
|
+
|
|
30
|
+
**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).
|
|
31
|
+
|
|
32
|
+
**If it does not exist:** Read `~/.claude/team-context/context.json` to get the list of configured teams.
|
|
33
|
+
|
|
34
|
+
- **No teams configured (file missing or empty `teams` array):** Tell the user: "No teams configured yet. Run `/init-team` first to set up a team, then re-run `/init-memory`." **Stop here — do not continue to later steps.**
|
|
35
|
+
|
|
36
|
+
- **Exactly one team:** Auto-bind to that team. Create `.claude/wayfind.json`:
|
|
37
|
+
```json
|
|
38
|
+
{"team_id": "<teamId>", "bound_at": "<ISO 8601 timestamp>"}
|
|
39
|
+
```
|
|
40
|
+
Report: "Bound to team: <team name> (auto-selected, only team configured)"
|
|
41
|
+
|
|
42
|
+
- **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>"
|
|
43
|
+
|
|
44
|
+
**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.
|
|
45
|
+
|
|
26
46
|
## Step 2: Create state files (if missing)
|
|
27
47
|
|
|
28
48
|
This repo uses TWO state files with different visibility:
|
|
@@ -140,6 +160,7 @@ Add the repo's state files to the State Files table if missing:
|
|
|
140
160
|
## Step 6: Report
|
|
141
161
|
|
|
142
162
|
Tell the user:
|
|
163
|
+
- `.claude/wayfind.json` — bound to team: <team name> (or already bound)
|
|
143
164
|
- `.claude/team-state.md` — created or already existed (committed to git, shared with team)
|
|
144
165
|
- `.claude/personal-state.md` — created or already existed (gitignored, personal only)
|
|
145
166
|
- `.gitignore` — updated or already correct
|
|
@@ -35,8 +35,11 @@ GITHUB_TOKEN=
|
|
|
35
35
|
# Tenant identifier (prefixes storage paths)
|
|
36
36
|
# TEAM_CONTEXT_TENANT_ID=my-team
|
|
37
37
|
|
|
38
|
-
#
|
|
39
|
-
#
|
|
38
|
+
# Team repo allowlist — only journals from these repos appear in digests and queries.
|
|
39
|
+
# Supports org/* wildcards. This is the recommended way to scope a container to one team.
|
|
40
|
+
# TEAM_CONTEXT_INCLUDE_REPOS=MyOrg/*,MyOrg-Libs/*
|
|
41
|
+
|
|
42
|
+
# DEPRECATED: Blocklist approach. Use INCLUDE_REPOS instead.
|
|
40
43
|
# TEAM_CONTEXT_EXCLUDE_REPOS=wayfind,personal-project
|
|
41
44
|
|
|
42
45
|
# Encryption key — generate with: openssl rand -base64 32
|
|
@@ -18,7 +18,9 @@ services:
|
|
|
18
18
|
SLACK_DIGEST_CHANNEL: ${SLACK_DIGEST_CHANNEL:-}
|
|
19
19
|
TEAM_CONTEXT_SLACK_WEBHOOK: ${TEAM_CONTEXT_SLACK_WEBHOOK:-}
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# Team repo allowlist (recommended over EXCLUDE_REPOS)
|
|
22
|
+
TEAM_CONTEXT_INCLUDE_REPOS: ${TEAM_CONTEXT_INCLUDE_REPOS:-}
|
|
23
|
+
# DEPRECATED: Blocklist approach — use INCLUDE_REPOS instead
|
|
22
24
|
TEAM_CONTEXT_EXCLUDE_REPOS: ${TEAM_CONTEXT_EXCLUDE_REPOS:-}
|
|
23
25
|
|
|
24
26
|
# Telemetry (opt-in, sends anonymous usage data to improve Wayfind)
|
package/uninstall.sh
CHANGED
|
@@ -102,4 +102,4 @@ info "Your memory files are preserved:"
|
|
|
102
102
|
info " ~/.claude/global-state.md"
|
|
103
103
|
info " ~/.claude/memory/"
|
|
104
104
|
info ""
|
|
105
|
-
info "To reinstall: curl -fsSL https://raw.githubusercontent.com/
|
|
105
|
+
info "To reinstall: curl -fsSL https://raw.githubusercontent.com/usewayfind/wayfind/main/install.sh | bash"
|