@phren/cli 0.0.1
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 +21 -0
- package/README.md +590 -0
- package/mcp/dist/capabilities/cli.js +61 -0
- package/mcp/dist/capabilities/index.js +15 -0
- package/mcp/dist/capabilities/mcp.js +61 -0
- package/mcp/dist/capabilities/types.js +57 -0
- package/mcp/dist/capabilities/vscode.js +61 -0
- package/mcp/dist/capabilities/web-ui.js +61 -0
- package/mcp/dist/cli-actions.js +302 -0
- package/mcp/dist/cli-config.js +580 -0
- package/mcp/dist/cli-extract.js +305 -0
- package/mcp/dist/cli-govern.js +371 -0
- package/mcp/dist/cli-graph.js +169 -0
- package/mcp/dist/cli-hooks-citations.js +44 -0
- package/mcp/dist/cli-hooks-context.js +56 -0
- package/mcp/dist/cli-hooks-globs.js +83 -0
- package/mcp/dist/cli-hooks-output.js +130 -0
- package/mcp/dist/cli-hooks-retrieval.js +2 -0
- package/mcp/dist/cli-hooks-session.js +1402 -0
- package/mcp/dist/cli-hooks.js +350 -0
- package/mcp/dist/cli-namespaces.js +989 -0
- package/mcp/dist/cli-ops.js +253 -0
- package/mcp/dist/cli-search.js +407 -0
- package/mcp/dist/cli.js +108 -0
- package/mcp/dist/content-archive.js +278 -0
- package/mcp/dist/content-citation.js +391 -0
- package/mcp/dist/content-dedup.js +622 -0
- package/mcp/dist/content-learning.js +472 -0
- package/mcp/dist/content-metadata.js +186 -0
- package/mcp/dist/content-validate.js +462 -0
- package/mcp/dist/core-finding.js +54 -0
- package/mcp/dist/core-project.js +36 -0
- package/mcp/dist/core-search.js +50 -0
- package/mcp/dist/data-access.js +400 -0
- package/mcp/dist/data-tasks.js +821 -0
- package/mcp/dist/embedding.js +344 -0
- package/mcp/dist/entrypoint.js +387 -0
- package/mcp/dist/finding-context.js +172 -0
- package/mcp/dist/finding-impact.js +181 -0
- package/mcp/dist/finding-journal.js +122 -0
- package/mcp/dist/finding-lifecycle.js +259 -0
- package/mcp/dist/governance-audit.js +22 -0
- package/mcp/dist/governance-locks.js +96 -0
- package/mcp/dist/governance-policy.js +648 -0
- package/mcp/dist/governance-scores.js +355 -0
- package/mcp/dist/hooks.js +449 -0
- package/mcp/dist/impact-scoring.js +22 -0
- package/mcp/dist/index-query.js +168 -0
- package/mcp/dist/index.js +205 -0
- package/mcp/dist/init-config.js +336 -0
- package/mcp/dist/init-preferences.js +62 -0
- package/mcp/dist/init-setup.js +1305 -0
- package/mcp/dist/init-shared.js +29 -0
- package/mcp/dist/init.js +1730 -0
- package/mcp/dist/link-checksums.js +62 -0
- package/mcp/dist/link-context.js +257 -0
- package/mcp/dist/link-doctor.js +591 -0
- package/mcp/dist/link-skills.js +212 -0
- package/mcp/dist/link.js +596 -0
- package/mcp/dist/logger.js +15 -0
- package/mcp/dist/machine-identity.js +38 -0
- package/mcp/dist/mcp-config.js +254 -0
- package/mcp/dist/mcp-data.js +315 -0
- package/mcp/dist/mcp-extract-facts.js +78 -0
- package/mcp/dist/mcp-extract.js +133 -0
- package/mcp/dist/mcp-finding.js +557 -0
- package/mcp/dist/mcp-graph.js +339 -0
- package/mcp/dist/mcp-hooks.js +256 -0
- package/mcp/dist/mcp-memory.js +58 -0
- package/mcp/dist/mcp-ops.js +328 -0
- package/mcp/dist/mcp-search.js +628 -0
- package/mcp/dist/mcp-session.js +651 -0
- package/mcp/dist/mcp-skills.js +189 -0
- package/mcp/dist/mcp-tasks.js +551 -0
- package/mcp/dist/mcp-types.js +7 -0
- package/mcp/dist/memory-ui-assets.js +6 -0
- package/mcp/dist/memory-ui-data.js +513 -0
- package/mcp/dist/memory-ui-graph.js +1910 -0
- package/mcp/dist/memory-ui-page.js +353 -0
- package/mcp/dist/memory-ui-scripts.js +1387 -0
- package/mcp/dist/memory-ui-server.js +1218 -0
- package/mcp/dist/memory-ui-styles.js +555 -0
- package/mcp/dist/memory-ui.js +9 -0
- package/mcp/dist/package-metadata.js +13 -0
- package/mcp/dist/phren-art.js +52 -0
- package/mcp/dist/phren-core.js +108 -0
- package/mcp/dist/phren-dotenv.js +67 -0
- package/mcp/dist/phren-paths.js +476 -0
- package/mcp/dist/proactivity.js +172 -0
- package/mcp/dist/profile-store.js +228 -0
- package/mcp/dist/project-config.js +85 -0
- package/mcp/dist/project-locator.js +25 -0
- package/mcp/dist/project-topics.js +1134 -0
- package/mcp/dist/provider-adapters.js +176 -0
- package/mcp/dist/runtime-profile.js +18 -0
- package/mcp/dist/session-checkpoints.js +131 -0
- package/mcp/dist/session-utils.js +68 -0
- package/mcp/dist/shared-content.js +8 -0
- package/mcp/dist/shared-embedding-cache.js +143 -0
- package/mcp/dist/shared-fragment-graph.js +456 -0
- package/mcp/dist/shared-governance.js +4 -0
- package/mcp/dist/shared-index.js +1334 -0
- package/mcp/dist/shared-ollama.js +192 -0
- package/mcp/dist/shared-paths.js +1 -0
- package/mcp/dist/shared-retrieval.js +796 -0
- package/mcp/dist/shared-search-fallback.js +375 -0
- package/mcp/dist/shared-sqljs.js +42 -0
- package/mcp/dist/shared-stemmer.js +171 -0
- package/mcp/dist/shared-vector-index.js +199 -0
- package/mcp/dist/shared.js +114 -0
- package/mcp/dist/shell-entry.js +209 -0
- package/mcp/dist/shell-input.js +943 -0
- package/mcp/dist/shell-palette.js +119 -0
- package/mcp/dist/shell-render.js +252 -0
- package/mcp/dist/shell-state-store.js +81 -0
- package/mcp/dist/shell-types.js +13 -0
- package/mcp/dist/shell-view-list.js +14 -0
- package/mcp/dist/shell-view.js +707 -0
- package/mcp/dist/shell.js +352 -0
- package/mcp/dist/skill-files.js +117 -0
- package/mcp/dist/skill-registry.js +279 -0
- package/mcp/dist/skill-state.js +28 -0
- package/mcp/dist/startup-embedding.js +57 -0
- package/mcp/dist/status.js +323 -0
- package/mcp/dist/synonyms.json +670 -0
- package/mcp/dist/task-hygiene.js +251 -0
- package/mcp/dist/task-lifecycle.js +347 -0
- package/mcp/dist/tasks-github.js +76 -0
- package/mcp/dist/telemetry.js +165 -0
- package/mcp/dist/test-global-setup.js +37 -0
- package/mcp/dist/tool-registry.js +104 -0
- package/mcp/dist/update.js +97 -0
- package/mcp/dist/utils.js +543 -0
- package/package.json +67 -0
- package/skills/README.md +7 -0
- package/skills/consolidate/SKILL.md +152 -0
- package/skills/discover/SKILL.md +175 -0
- package/skills/init/SKILL.md +216 -0
- package/skills/profiles/SKILL.md +121 -0
- package/skills/sync/SKILL.md +261 -0
- package/starter/README.md +74 -0
- package/starter/global/CLAUDE.md +89 -0
- package/starter/global/skills/humanize.md +30 -0
- package/starter/global/skills/pipeline.md +35 -0
- package/starter/global/skills/release.md +35 -0
- package/starter/machines.yaml +8 -0
- package/starter/my-api/.claude/skills/README.md +7 -0
- package/starter/my-api/CLAUDE.md +33 -0
- package/starter/my-api/FINDINGS.md +9 -0
- package/starter/my-api/summary.md +7 -0
- package/starter/my-api/tasks.md +7 -0
- package/starter/my-first-project/.claude/skills/README.md +7 -0
- package/starter/my-first-project/CLAUDE.md +49 -0
- package/starter/my-first-project/FINDINGS.md +24 -0
- package/starter/my-first-project/summary.md +11 -0
- package/starter/my-first-project/tasks.md +25 -0
- package/starter/my-frontend/.claude/skills/README.md +7 -0
- package/starter/my-frontend/CLAUDE.md +33 -0
- package/starter/my-frontend/FINDINGS.md +9 -0
- package/starter/my-frontend/summary.md +7 -0
- package/starter/my-frontend/tasks.md +7 -0
- package/starter/profiles/default.yaml +4 -0
- package/starter/profiles/personal.yaml +4 -0
- package/starter/profiles/work.yaml +4 -0
- package/starter/templates/README.md +7 -0
- package/starter/templates/frontend/CLAUDE.md +23 -0
- package/starter/templates/frontend/FINDINGS.md +7 -0
- package/starter/templates/frontend/reference/README.md +4 -0
- package/starter/templates/frontend/summary.md +7 -0
- package/starter/templates/frontend/tasks.md +11 -0
- package/starter/templates/library/CLAUDE.md +22 -0
- package/starter/templates/library/FINDINGS.md +7 -0
- package/starter/templates/library/reference/README.md +4 -0
- package/starter/templates/library/summary.md +7 -0
- package/starter/templates/library/tasks.md +11 -0
- package/starter/templates/monorepo/CLAUDE.md +21 -0
- package/starter/templates/monorepo/FINDINGS.md +7 -0
- package/starter/templates/monorepo/reference/README.md +4 -0
- package/starter/templates/monorepo/summary.md +7 -0
- package/starter/templates/monorepo/tasks.md +11 -0
- package/starter/templates/python-project/CLAUDE.md +21 -0
- package/starter/templates/python-project/FINDINGS.md +7 -0
- package/starter/templates/python-project/reference/README.md +4 -0
- package/starter/templates/python-project/summary.md +7 -0
- package/starter/templates/python-project/tasks.md +10 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync
|
|
3
|
+
description: Sync your Claude skills and project config across machines using profiles.
|
|
4
|
+
dependencies:
|
|
5
|
+
- git
|
|
6
|
+
---
|
|
7
|
+
# phren-sync - Profile-aware sync
|
|
8
|
+
|
|
9
|
+
> Sync your Claude skills and project config across machines using profiles that control what goes where.
|
|
10
|
+
|
|
11
|
+
Phren carries your skills and project config between machines. Profile-aware: he only syncs what belongs on this machine.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
This skill requires a phren repository. If you don't have one yet, see "New machine setup" at the bottom.
|
|
16
|
+
|
|
17
|
+
**Expected structure:**
|
|
18
|
+
```
|
|
19
|
+
~/.phren/ # or wherever your phren repo lives
|
|
20
|
+
global/ # skills and config for all projects
|
|
21
|
+
skills/ # global skill files (.md)
|
|
22
|
+
CLAUDE.md # global Claude instructions
|
|
23
|
+
<project>/ # per-project config
|
|
24
|
+
CLAUDE.md
|
|
25
|
+
skills/
|
|
26
|
+
summary.md
|
|
27
|
+
profiles/ # machine profile definitions
|
|
28
|
+
work.yaml
|
|
29
|
+
personal.yaml
|
|
30
|
+
machines.yaml # maps machine names to profiles
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If any of these are missing, the skill will tell you what to create and how.
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
Phren uses profiles to decide what goes where. A profile is a list of projects. A machine is mapped to a profile. When you sync, phren only brings over the projects in your machine's profile.
|
|
38
|
+
|
|
39
|
+
## Sync down (pull to this machine)
|
|
40
|
+
|
|
41
|
+
When the user says "get my skills", "sync my config", "pull from phren", or just "phren-sync":
|
|
42
|
+
|
|
43
|
+
### 1. Find the phren directory
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
PHREN_DIR="${PHREN_DIR:-$HOME/.phren}"
|
|
47
|
+
ls "$PHREN_DIR" 2>/dev/null
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If the directory doesn't exist, tell the user:
|
|
51
|
+
> "No phren repo found at ~/.phren. Clone yours with `git clone <your-repo-url> ~/.phren`, or set `PHREN_DIR` to point to a different location."
|
|
52
|
+
|
|
53
|
+
### 2. Figure out which machine this is
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cat ~/.phren/.machine-id 2>/dev/null || hostname
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If `~/.phren/.machine-id` doesn't exist, ask the user to pick a name:
|
|
60
|
+
> "I need a machine name to look up your profile. What should I call this machine? (e.g. 'work-laptop', 'home-desktop')"
|
|
61
|
+
|
|
62
|
+
Then save it:
|
|
63
|
+
```bash
|
|
64
|
+
mkdir -p ~/.phren && echo "work-laptop" > ~/.phren/.machine-id
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Look up the profile
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cat "$PHREN_DIR/machines.yaml"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If the machine name isn't in `machines.yaml`, tell the user:
|
|
74
|
+
> "Machine 'work-laptop' isn't in machines.yaml yet. Which profile should it use?"
|
|
75
|
+
> Then show available profiles: `ls "$PHREN_DIR/profiles/"*.yaml`
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cat "$PHREN_DIR/profiles/<profile-name>.yaml"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The profile YAML has:
|
|
82
|
+
```yaml
|
|
83
|
+
name: work
|
|
84
|
+
description: Work laptop setup
|
|
85
|
+
projects:
|
|
86
|
+
- myapp
|
|
87
|
+
- api-server
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If no profiles exist yet, offer to create one with `phren-init`.
|
|
91
|
+
|
|
92
|
+
### 4. Pull latest
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd "$PHREN_DIR" && git pull
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If this fails (not a git repo, no remote), tell the user. Don't silently skip.
|
|
99
|
+
|
|
100
|
+
### 5. Refresh the machine with the supported flow
|
|
101
|
+
|
|
102
|
+
Run init against the pulled phren repo so hooks, MCP registration, and machine/profile wiring are refreshed:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
PHREN_PATH="$PHREN_DIR" npx phren init -y
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If the user is in an untracked repo afterward, tell them to open a session there and let the agent ask, or run `phren add` from that directory.
|
|
109
|
+
|
|
110
|
+
Only mention `phren link` if the user is explicitly repairing an older pre-init install.
|
|
111
|
+
|
|
112
|
+
### 6. Build the context file
|
|
113
|
+
|
|
114
|
+
Write `~/.phren-context.md` with a summary of what's active on this machine:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
# Phren context: <machine-name> (<profile-name>)
|
|
118
|
+
|
|
119
|
+
Machine: <machine-name>
|
|
120
|
+
Profile: <profile-name>
|
|
121
|
+
Last synced: <date>
|
|
122
|
+
|
|
123
|
+
## Active projects
|
|
124
|
+
- myapp: Description from summary.md
|
|
125
|
+
- api-server: Description from summary.md
|
|
126
|
+
|
|
127
|
+
## Global skills
|
|
128
|
+
phren-sync, phren-init, phren-consolidate, phren-discover
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Pull project descriptions from each project's `summary.md` if it exists.
|
|
132
|
+
|
|
133
|
+
### 7. Rebuild MEMORY.md
|
|
134
|
+
|
|
135
|
+
Regenerate `~/.claude/projects/*/memory/MEMORY.md` with cross-project awareness from the active profile. Pull key facts from each project's `summary.md`.
|
|
136
|
+
|
|
137
|
+
### 8. Check project health
|
|
138
|
+
|
|
139
|
+
After syncing, check each active project in the phren directory for missing files. Print a one-line status per project. Informational only, does not block the sync.
|
|
140
|
+
|
|
141
|
+
**Required files** (warn if missing):
|
|
142
|
+
- `summary.md`: project description used by context file and memory
|
|
143
|
+
- `CLAUDE.md`: project-level Claude instructions
|
|
144
|
+
|
|
145
|
+
**Recommended files** (note if missing, don't warn):
|
|
146
|
+
- `tasks.md`: persistent task queue
|
|
147
|
+
- `FINDINGS.md`: captured session findings
|
|
148
|
+
|
|
149
|
+
For each project in the profile, check `$PHREN_DIR/<project>/` for these files and print:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
Project health:
|
|
153
|
+
+ my-app: all files present
|
|
154
|
+
~ backend: missing recommended: FINDINGS.md
|
|
155
|
+
! new-project: missing required: summary.md, CLAUDE.md
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Legend: `+` all good, `~` missing recommended files, `!` missing required files.
|
|
159
|
+
|
|
160
|
+
Skip the "global" entry since it has a different structure. Only check actual project directories.
|
|
161
|
+
|
|
162
|
+
### 9. Report
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
phren-sync down: <machine-name> (<profile-name>)
|
|
166
|
+
|
|
167
|
+
Synced:
|
|
168
|
+
- myapp (CLAUDE.md + 3 skills)
|
|
169
|
+
- api-server (CLAUDE.md + 1 skill)
|
|
170
|
+
- global (CLAUDE.md + 11 skills)
|
|
171
|
+
|
|
172
|
+
Skipped (not in profile):
|
|
173
|
+
- old-project
|
|
174
|
+
|
|
175
|
+
Project health:
|
|
176
|
+
+ myapp: all files present
|
|
177
|
+
~ api-server: missing recommended: FINDINGS.md
|
|
178
|
+
|
|
179
|
+
Context: ~/.phren-context.md updated
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Sync up (push changes back)
|
|
183
|
+
|
|
184
|
+
When the user says "sync this back", "push to phren", "save this to my phren":
|
|
185
|
+
|
|
186
|
+
### 1. Find what changed
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
diff "$PHREN_DIR/<project>/CLAUDE.md" ./<project-path>/CLAUDE.md
|
|
190
|
+
diff -r "$PHREN_DIR/<project>/skills/" ./<project-path>/.claude/skills/
|
|
191
|
+
|
|
192
|
+
Remember: `.claude/skills/` is a generated mirror. The source-of-truth lives in phren `skills/`, and the project mirror also includes inherited global skills after resolution.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
If files are symlinked (same inode), they're already in sync. Just commit from the phren directory.
|
|
196
|
+
|
|
197
|
+
If files are regular copies that differ, copy them back:
|
|
198
|
+
```bash
|
|
199
|
+
cp <changed-file> "$PHREN_DIR/<project>/<corresponding-path>"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 2. Commit and push
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
cd "$PHREN_DIR"
|
|
206
|
+
git add -A
|
|
207
|
+
git commit -m "<project> updates from <machine-name>"
|
|
208
|
+
git push
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Conversational shortcuts
|
|
212
|
+
|
|
213
|
+
These should work naturally in conversation:
|
|
214
|
+
|
|
215
|
+
| User says | What to do |
|
|
216
|
+
|-----------|-----------|
|
|
217
|
+
| "add myapp to my work profile" | Edit the profile YAML, add to projects list, commit |
|
|
218
|
+
| "show me my personal profile" | Read and display the profile YAML |
|
|
219
|
+
| "what's on this machine?" | Read and display `~/.phren-context.md` |
|
|
220
|
+
| "remove old-project from work" | Edit the profile YAML, commit |
|
|
221
|
+
| "switch to personal profile" | Update the machine mapping in `machines.yaml`, re-run sync down |
|
|
222
|
+
| "create a new profile called travel" | Create a new profile YAML with empty projects list, ask what to include |
|
|
223
|
+
|
|
224
|
+
## New machine setup
|
|
225
|
+
|
|
226
|
+
First time on a new machine:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# 1. Clone your phren repo
|
|
230
|
+
git clone <your-repo-url> ~/.phren
|
|
231
|
+
|
|
232
|
+
# 2. Name this machine
|
|
233
|
+
mkdir -p ~/.phren && echo "my-machine-name" > ~/.phren/.machine-id
|
|
234
|
+
|
|
235
|
+
# 3. Map it to a profile in machines.yaml
|
|
236
|
+
# Add a line: my-machine-name: work
|
|
237
|
+
|
|
238
|
+
# 4. Run phren-sync
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
If you don't have a phren repo yet, start with `phren-init` to create one from scratch.
|
|
242
|
+
|
|
243
|
+
## Conflict resolution
|
|
244
|
+
|
|
245
|
+
When two machines edit the same phren file before syncing, `git pull` will hit a merge conflict. Here's how to handle each file type:
|
|
246
|
+
|
|
247
|
+
**tasks.md**: Take both changes. Task items from both machines are valid. Concat them, deduplicate if needed, commit.
|
|
248
|
+
|
|
249
|
+
**FINDINGS.md**: Take both changes. Keep entries in chronological order. If both machines added entries on the same date, interleave or group them under the same date heading.
|
|
250
|
+
|
|
251
|
+
**CLAUDE.md**: Manual merge. Ask the user which version they want, or show both and let them pick. These files contain preferences and instructions where intent matters, so don't auto-resolve.
|
|
252
|
+
|
|
253
|
+
**skills/ files**: If the same skill was edited on both machines, show the user a diff and let them choose. If different skills were edited, git handles this automatically (no conflict).
|
|
254
|
+
|
|
255
|
+
**General approach**: Run `git pull --rebase` during sync. If conflicts appear, tell the user which files conflict and apply the rules above. Don't silently drop changes from either side.
|
|
256
|
+
|
|
257
|
+
## Related skills
|
|
258
|
+
|
|
259
|
+
- `phren-init`: create a new project or set up phren from scratch
|
|
260
|
+
- `add_finding()`: capture findings via MCP (synced across machines by `push_changes()`)
|
|
261
|
+
- `phren-consolidate`: synthesize findings across projects
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# My Phren
|
|
2
|
+
|
|
3
|
+
Your personal project store for [phren](https://github.com/alaarab/phren). Phren is your project's memory keeper — he holds what your agents learn and surfaces it when it matters, across sessions and machines.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
Each subdirectory is a project. Add one for every codebase you work on.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
~/.phren/
|
|
11
|
+
├── global/ # context that applies to every project
|
|
12
|
+
│ ├── CLAUDE.md
|
|
13
|
+
│ └── skills/ # personal workflow skills
|
|
14
|
+
├── my-project/
|
|
15
|
+
│ ├── CLAUDE.md # architecture, commands, key patterns
|
|
16
|
+
│ ├── summary.md # five-line project card
|
|
17
|
+
│ ├── FINDINGS.md # fragments accumulated over time
|
|
18
|
+
│ ├── tasks.md # task queue that persists across sessions
|
|
19
|
+
│ └── .claude/
|
|
20
|
+
│ └── skills/ # project-specific skills
|
|
21
|
+
├── profiles/ # YAML files mapping project sets to machine roles
|
|
22
|
+
└── machines.yaml # maps machine hostnames to profiles
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Guided tour
|
|
26
|
+
|
|
27
|
+
New to phren? Here's what each file does and when it matters.
|
|
28
|
+
|
|
29
|
+
**summary.md** is the elevator pitch. Phren shows this to Claude first so it knows what project it's working on. Keep it to 5 lines: what, stack, status, run command, biggest insight.
|
|
30
|
+
|
|
31
|
+
**CLAUDE.md** is the project bible. Commands, architecture, key patterns, things to never do. Claude reads this before making changes. The better this file is, the fewer mistakes Claude makes.
|
|
32
|
+
|
|
33
|
+
**FINDINGS.md** fills itself. As Claude discovers insights, patterns, and decisions during your sessions, it tells phren and entries land here grouped by date. Old entries fade from retrieval over time. Wrong entries can be removed with `remove_finding()`.
|
|
34
|
+
|
|
35
|
+
**tasks.md** is your task board file. It keeps Active (working now), Queue (up next), and Done (finished) in one place so the work history stays with the project. You can also manage it from `npx phren shell`.
|
|
36
|
+
|
|
37
|
+
**global/CLAUDE.md** applies everywhere. Your style preferences, tool choices, things Claude should always know regardless of which project you're in.
|
|
38
|
+
|
|
39
|
+
**profiles/** and **machines.yaml** handle multi-machine setups. Map hostnames to profiles, and profiles to project lists. Your work laptop sees work projects, your home machine sees personal ones.
|
|
40
|
+
|
|
41
|
+
## Getting started
|
|
42
|
+
|
|
43
|
+
If you got here via `npx phren init`, you're already set up. Restart Claude Code and you're good.
|
|
44
|
+
|
|
45
|
+
If you cloned manually:
|
|
46
|
+
|
|
47
|
+
1. Add the MCP server: `claude mcp add phren -- npx phren ~/.phren`
|
|
48
|
+
2. Install skills: `/plugin marketplace add alaarab/phren` then `/plugin install phren@phren`
|
|
49
|
+
3. Restart Claude Code
|
|
50
|
+
4. Add a project: run `/phren-init my-project` or scaffold one with a template such as `npx phren init --template python-project`
|
|
51
|
+
5. Push to a private GitHub repo to sync across machines
|
|
52
|
+
|
|
53
|
+
## Day-to-day workflow
|
|
54
|
+
|
|
55
|
+
1. **Start a session**: phren pulls the latest and feeds relevant context to your agent
|
|
56
|
+
2. **Work normally**: Claude reads your project docs and builds on what phren remembers
|
|
57
|
+
3. **Fragments accumulate**: tell phren what you learned, or he picks up insights automatically
|
|
58
|
+
4. **Session ends**: phren commits and pushes what he collected
|
|
59
|
+
5. **Review occasionally**: run `npx phren shell` to triage what phren queued, manage tasks, and check health
|
|
60
|
+
|
|
61
|
+
## Syncing across machines
|
|
62
|
+
|
|
63
|
+
Edit `machines.yaml` to map each machine's hostname to a profile:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
work-desktop: work
|
|
67
|
+
home-laptop: personal
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Each profile in `profiles/` lists which projects that machine should see. After cloning on a new machine, run `/phren-sync` to pull everything in.
|
|
71
|
+
|
|
72
|
+
## Troubleshooting
|
|
73
|
+
|
|
74
|
+
Run `npx phren doctor --fix` to check and repair your setup.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# User-level instructions
|
|
2
|
+
|
|
3
|
+
<!-- Copy this file to your personal phren instance's global/CLAUDE.md and fill in your own preferences. -->
|
|
4
|
+
<!-- This becomes ~/.claude/CLAUDE.md after syncing. Claude reads it at the start of every session. -->
|
|
5
|
+
|
|
6
|
+
## How I Work
|
|
7
|
+
|
|
8
|
+
<!-- Your non-negotiable rules. Examples: -->
|
|
9
|
+
<!-- "Write human from the start. No em dashes. No double hyphens. No AI buzzwords." -->
|
|
10
|
+
<!-- "Think visually. If it looks like a template, it's not done." -->
|
|
11
|
+
<!-- "Finish the job. Changelog, README, tests. Don't wait to be asked." -->
|
|
12
|
+
|
|
13
|
+
## Skills
|
|
14
|
+
|
|
15
|
+
These skills are available as a full set via phren, or individually from the Claude skills marketplace. You don't need the full phren setup to use skills marked with (standalone).
|
|
16
|
+
|
|
17
|
+
### Phren skills (manage your project store)
|
|
18
|
+
|
|
19
|
+
| Skill | What it does |
|
|
20
|
+
|-------|-------------|
|
|
21
|
+
| `/phren-sync` | Pull phren to a new machine or push config changes back to the repo |
|
|
22
|
+
| `/phren-init` | Scaffold a new project with summary, CLAUDE.md, task |
|
|
23
|
+
| `/phren-discover` | Research what's missing in a project and surface gaps and opportunities |
|
|
24
|
+
| `/phren-consolidate` | Find patterns across all project FINDINGS.md files |
|
|
25
|
+
|
|
26
|
+
### Your own skills
|
|
27
|
+
|
|
28
|
+
Put personal workflow skills in `~/.phren/global/skills/` and list them here. See [phren](https://github.com/alaarab/phren) for examples.
|
|
29
|
+
|
|
30
|
+
<!-- Example:
|
|
31
|
+
| `/humanize` | Strip AI language from writing and code |
|
|
32
|
+
| `/release` | Version bump, changelog, tag, publish |
|
|
33
|
+
-->
|
|
34
|
+
|
|
35
|
+
## Agent coordination
|
|
36
|
+
|
|
37
|
+
<!-- If you use team agents, document your coordination pattern here. Example: -->
|
|
38
|
+
<!-- "Never use fire-and-forget background agents. Always use TeamCreate/TaskCreate/SendMessage." -->
|
|
39
|
+
|
|
40
|
+
- Team agents follow the same phren rules as the primary agent.
|
|
41
|
+
- Before handing work back or stopping, tell phren about non-obvious bugs, patterns, tradeoffs, or decisions with `add_finding(...)`.
|
|
42
|
+
- Do not wait for the user to explicitly say "save this as a finding" if the insight will matter next session.
|
|
43
|
+
|
|
44
|
+
## Project store
|
|
45
|
+
|
|
46
|
+
In shared mode, skills and project config live in `~/.phren` (or wherever `PHREN_DIR` points). This is a git repo that syncs across machines using profiles.
|
|
47
|
+
|
|
48
|
+
If you're using `phren init --mode project-local`, the root is `<repo>/.phren` instead. Project-local mode does not use profiles, machine mappings, or global hooks.
|
|
49
|
+
|
|
50
|
+
- `~/.phren/global/`: skills and config that apply everywhere
|
|
51
|
+
- `~/.phren/<project>/`: per-project CLAUDE.md, skills, task, findings
|
|
52
|
+
- `~/.phren/profiles/`: YAML files mapping project sets to machine roles
|
|
53
|
+
- `~/.phren/machines.yaml`: maps machine hostnames to profiles
|
|
54
|
+
|
|
55
|
+
Run `/phren-sync` to pull everything down or push changes back.
|
|
56
|
+
|
|
57
|
+
## MCP tools
|
|
58
|
+
|
|
59
|
+
The phren MCP server is running. Phren already knows a lot — ask him before asking the user to repeat themselves.
|
|
60
|
+
|
|
61
|
+
- **At session start:** ask phren what's active: `list_projects()`, then `get_project_summary(name)` for the relevant project
|
|
62
|
+
- **When the user mentions a project, codebase, or task:** ask phren first: `search_knowledge(query)` before asking questions
|
|
63
|
+
- **When the user asks about commands, architecture, conventions, or past decisions:** check with phren: `search_knowledge(query)`
|
|
64
|
+
- **When the user mentions a task or todo:** ask phren what's tracked: `get_tasks(project)`
|
|
65
|
+
- **When you discover a non-obvious pattern, bug, or workaround:** tell phren immediately: `add_finding(project, insight)`
|
|
66
|
+
- **When the user says they want to do something later:** tell phren to remember it: `add_task(project, item)` instead of listing it in chat
|
|
67
|
+
- **When a task is finished:** tell phren it's done: `complete_task(project, item)` without being asked
|
|
68
|
+
|
|
69
|
+
**What NOT to tell phren:**
|
|
70
|
+
- Credentials, API keys, tokens, passwords, or anything that looks like a secret
|
|
71
|
+
- Personal or sensitive data: SSNs, financial info, health info, PII of any kind
|
|
72
|
+
- One-off facts that won't apply next session ("the server was down today")
|
|
73
|
+
- Narration of what happened ("fixed the login bug"): only save the actual insight
|
|
74
|
+
- Things obvious from reading the code or docs
|
|
75
|
+
|
|
76
|
+
If you're unsure whether something is worth telling phren, skip it. High-signal entries beat volume.
|
|
77
|
+
|
|
78
|
+
The goal: phren should already have the context before the user has to explain it. Tasks stay in files, not buried in chat history.
|
|
79
|
+
|
|
80
|
+
## Machine context
|
|
81
|
+
|
|
82
|
+
<!-- Claude reads this at session start to know what's active on this machine. -->
|
|
83
|
+
<!-- Auto-generated by /phren-sync. Don't edit manually. -->
|
|
84
|
+
|
|
85
|
+
Read `~/.phren-context.md` at the start of every session for machine-specific context: which profile is active, which projects are linked, and when the last sync happened.
|
|
86
|
+
|
|
87
|
+
## Without MCP server
|
|
88
|
+
|
|
89
|
+
If the MCP server isn't available, phren still helps. Claude reads `~/.phren-context.md` and per-project memory files from `~/.claude/projects/` for context, then fetches details directly from `~/.phren/project-name/` as needed. No MCP required — phren just works a bit more quietly.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: humanize
|
|
3
|
+
description: Strip AI language from writing and code. Kill the AI voice.
|
|
4
|
+
---
|
|
5
|
+
# /humanize - Kill the AI voice
|
|
6
|
+
|
|
7
|
+
Strip out artificial language and make your writing sound like you actually talk.
|
|
8
|
+
|
|
9
|
+
## Rules
|
|
10
|
+
|
|
11
|
+
- No em dashes. Use a colon, comma, or rewrite. "AI wrote this, badly" or "AI wrote this: poorly."
|
|
12
|
+
- No double hyphens used as dashes: "hard--won" should be "hard-won" or rewritten.
|
|
13
|
+
- Banned words: robust, seamless, leverage, comprehensive, utilize, synergize, perplexing, meticulous. Don't use them.
|
|
14
|
+
- No filler comments that restate code: bad: `// increment i`, good: `// only count non-zero`, or just delete it.
|
|
15
|
+
- No "Note that...", "It's worth mentioning...", "One thing to consider..." Just say it.
|
|
16
|
+
- No "arguably", "arguably one of the most". Be direct.
|
|
17
|
+
|
|
18
|
+
## Self-audit
|
|
19
|
+
|
|
20
|
+
Read your output back. If it sounds like AI wrote it, rewrite it. Check:
|
|
21
|
+
- Any sentence feel stiff or overly formal?
|
|
22
|
+
- Any words you wouldn't say in a conversation?
|
|
23
|
+
- Any phrase that sounds like it's trying too hard?
|
|
24
|
+
|
|
25
|
+
## Customize
|
|
26
|
+
|
|
27
|
+
These rules are a starting point. Adjust them to match your actual voice:
|
|
28
|
+
- Add words you hate hearing from AI.
|
|
29
|
+
- Document patterns from your own writing (short sentences, specific cadence, humor style).
|
|
30
|
+
- Share examples of "bad" vs "good" versions so Claude knows your voice.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pipeline
|
|
3
|
+
description: Tell Claude which stage of development you're in and get guidance on what to focus on next.
|
|
4
|
+
---
|
|
5
|
+
# /pipeline - Where am I in the workflow
|
|
6
|
+
|
|
7
|
+
Tell Claude which stage of development you're in, and get guidance on what to focus on next.
|
|
8
|
+
|
|
9
|
+
## Stages
|
|
10
|
+
|
|
11
|
+
1. **planning** - sketching ideas, designing, deciding what to build
|
|
12
|
+
2. **coding** - writing implementation, building features
|
|
13
|
+
3. **testing** - running tests, verifying behavior, catching bugs
|
|
14
|
+
4. **review** - code review, feedback, making sure it's ready
|
|
15
|
+
5. **shipped** - released, deployed, users have it
|
|
16
|
+
|
|
17
|
+
## What to do
|
|
18
|
+
|
|
19
|
+
1. Look at recent git commits to understand what's been done recently.
|
|
20
|
+
2. Check open files in the editor to see what's actively being worked on.
|
|
21
|
+
3. Ask the user: "What stage are you in?" if unclear.
|
|
22
|
+
4. Tell the user:
|
|
23
|
+
- **Current stage**: e.g. "You're in the coding stage"
|
|
24
|
+
- **What to focus on next**: e.g. "Once you finish this component, write tests for it. Don't move to review until tests pass."
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
- "You've got 10 failing tests. You're in testing. Run tests again after each fix, don't batch them."
|
|
29
|
+
- "You've got code ready but no CHANGELOG entry. That's review stage. Update the changelog, then you're ready to ship."
|
|
30
|
+
- "You've got 3 open PRs awaiting feedback. You're in review. Respond to comments or start something new while you wait."
|
|
31
|
+
|
|
32
|
+
## Customize
|
|
33
|
+
|
|
34
|
+
- Adjust the stages to match your workflow (you might have a "documentation" or "deployment" stage)
|
|
35
|
+
- Add what "done" means for each stage in your project
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: release
|
|
3
|
+
description: Get from "code is ready" to "users have it" with a version bump, changelog, tag, and publish checklist.
|
|
4
|
+
---
|
|
5
|
+
# /release - Ship a version
|
|
6
|
+
|
|
7
|
+
Get from "code is ready" to "users have it" with a checklist.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Confirm version bump**: Ask for patch, minor, or major (if not specified). Auto-detect from git history or ask the user.
|
|
12
|
+
2. **Update CHANGELOG.md**: List what changed in this release. Format varies (keep-changelog, conventional commits, etc).
|
|
13
|
+
3. **Bump version**: Update package.json, Cargo.toml, pyproject.toml, or whatever your project uses.
|
|
14
|
+
4. **Git tag**: Create a git tag: `git tag vX.Y.Z` and push it.
|
|
15
|
+
5. **Publish**: Run your publish command (`npm publish`, `cargo publish`, `poetry publish`, etc).
|
|
16
|
+
|
|
17
|
+
## Example flow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
You: "/release"
|
|
21
|
+
Claude: "What version bump? (patch/minor/major)"
|
|
22
|
+
You: "minor"
|
|
23
|
+
Claude: "Got it. You're going from 1.2.3 to 1.3.0.
|
|
24
|
+
- Updated CHANGELOG.md with new features
|
|
25
|
+
- Bumped version in package.json
|
|
26
|
+
- Created tag v1.3.0
|
|
27
|
+
- Published to npm
|
|
28
|
+
Ready to verify it's live?"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Customize
|
|
32
|
+
|
|
33
|
+
- Update the publish command for your stack (e.g. `cargo publish` for Rust, `twine upload` for Python)
|
|
34
|
+
- Adjust changelog format to match your conventions
|
|
35
|
+
- Add any pre-publish checks you need (tests, linting, etc)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Project overview
|
|
4
|
+
|
|
5
|
+
**Purpose**: Backend API. Replace this with a real description of what the service does.
|
|
6
|
+
**Stack**: Node.js, Express, PostgreSQL (or whatever you're using)
|
|
7
|
+
**Status**: active
|
|
8
|
+
**Version**: 0.0.0
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Install: npm install
|
|
14
|
+
# Run: npm run dev
|
|
15
|
+
# Test: npm test
|
|
16
|
+
# Build: npm run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Project skills
|
|
20
|
+
|
|
21
|
+
Source skills live in the phren project `skills/` directory. Phren resolves global + project-local skills and mirrors the effective set into repo-local `.claude/skills/`.
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
<!-- How routes, middleware, and services are organized -->
|
|
26
|
+
|
|
27
|
+
## Key patterns
|
|
28
|
+
|
|
29
|
+
<!-- Naming rules, error handling patterns, things to never do -->
|
|
30
|
+
|
|
31
|
+
<!-- Tip: If this file grows past ~100 lines, split it using @import directives.
|
|
32
|
+
Example: @CLAUDE-architecture.md, @CLAUDE-commands.md, @CLAUDE-conventions.md
|
|
33
|
+
See phren README for details. -->
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# my-api findings
|
|
2
|
+
|
|
3
|
+
Findings accumulated over time. Captured automatically during sessions and committed on exit.
|
|
4
|
+
|
|
5
|
+
<!-- Example entry:
|
|
6
|
+
## 2026-03-04
|
|
7
|
+
- The auth middleware runs before rate limiting: order matters in middleware stack
|
|
8
|
+
- `npm run dev` needs PORT set or it defaults to 3001, not 3000
|
|
9
|
+
-->
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# my-api
|
|
2
|
+
|
|
3
|
+
**What:** REST API backend: replace with what yours actually does
|
|
4
|
+
**Stack:** Node.js, Express, PostgreSQL (or whatever you're using)
|
|
5
|
+
**Status:** active
|
|
6
|
+
**Run:** npm run dev
|
|
7
|
+
**Watch out:** .env not committed: copy .env.example and fill in secrets before first run
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Project overview
|
|
4
|
+
|
|
5
|
+
**Purpose**: One paragraph about what this project is and what it does
|
|
6
|
+
**Stack**: Replace with your tech stack
|
|
7
|
+
**Status**: active
|
|
8
|
+
**Version**: 0.0.0
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Install:
|
|
14
|
+
# Run:
|
|
15
|
+
# Test:
|
|
16
|
+
# Build:
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Project skills
|
|
20
|
+
|
|
21
|
+
Source skills live in the phren project `skills/` directory. Phren resolves global + project-local skills and mirrors the effective set into repo-local `.claude/skills/`.
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
<!-- How the codebase is structured. Example:
|
|
26
|
+
|
|
27
|
+
src/
|
|
28
|
+
routes/ - Express route handlers
|
|
29
|
+
services/ - Business logic, one file per domain
|
|
30
|
+
models/ - Database models (Prisma)
|
|
31
|
+
middleware/ - Auth, rate-limiting, error handling
|
|
32
|
+
utils/ - Shared helpers
|
|
33
|
+
|
|
34
|
+
-->
|
|
35
|
+
|
|
36
|
+
## Key patterns
|
|
37
|
+
|
|
38
|
+
<!-- Project-specific patterns, naming rules, things to never do. Example:
|
|
39
|
+
|
|
40
|
+
- All API responses use `{ ok: boolean, data?, error? }` shape
|
|
41
|
+
- Service functions throw, route handlers catch and format
|
|
42
|
+
- Never import from `src/models` directly in routes, go through services
|
|
43
|
+
- Tests live next to source files as `*.test.ts`
|
|
44
|
+
|
|
45
|
+
-->
|
|
46
|
+
|
|
47
|
+
<!-- Tip: If this file grows past ~100 lines, split it using @import directives.
|
|
48
|
+
Example: @CLAUDE-architecture.md, @CLAUDE-commands.md, @CLAUDE-conventions.md
|
|
49
|
+
See phren README for details. -->
|