portable-agent-layer 0.22.0 → 0.23.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.
Files changed (42) hide show
  1. package/assets/agents/gemini-researcher.md +17 -3
  2. package/assets/agents/grok-researcher.md +19 -5
  3. package/assets/agents/multi-perspective-researcher.md +16 -2
  4. package/assets/agents/perplexity-researcher.md +17 -3
  5. package/assets/skills/analyze-pdf/SKILL.md +1 -1
  6. package/assets/skills/analyze-youtube/SKILL.md +1 -1
  7. package/assets/skills/extract-entities/SKILL.md +1 -1
  8. package/assets/skills/fyzz-chat-api/SKILL.md +3 -3
  9. package/assets/skills/reflect/SKILL.md +2 -2
  10. package/assets/skills/telos/SKILL.md +6 -6
  11. package/assets/templates/AGENTS.md.template +2 -2
  12. package/assets/templates/PAL/ALGORITHM.md +93 -10
  13. package/assets/templates/PAL/CONTEXT_ROUTING.md +17 -17
  14. package/assets/templates/PAL/MEMORY_SYSTEM.md +5 -5
  15. package/assets/templates/PAL/README.md +12 -9
  16. package/assets/templates/PAL/SYSTEM_ARCHITECTURE.md +1 -1
  17. package/assets/templates/pal-settings.json +6 -3
  18. package/assets/templates/settings.claude.json +2 -2
  19. package/package.json +3 -1
  20. package/src/cli/index.ts +4 -11
  21. package/src/hooks/handlers/failure.ts +3 -1
  22. package/src/hooks/handlers/rating.ts +17 -2
  23. package/src/hooks/handlers/reflect-trigger.ts +4 -4
  24. package/src/hooks/handlers/relationship.ts +1 -1
  25. package/src/hooks/handlers/session-intelligence.ts +324 -0
  26. package/src/hooks/handlers/session-name.ts +2 -2
  27. package/src/hooks/handlers/synthesis.ts +36 -0
  28. package/src/hooks/handlers/update-check.ts +2 -2
  29. package/src/hooks/handlers/work-learning.ts +1 -1
  30. package/src/hooks/lib/context.ts +119 -2
  31. package/src/hooks/lib/paths.ts +4 -12
  32. package/src/hooks/lib/security.ts +39 -28
  33. package/src/hooks/lib/stop.ts +56 -7
  34. package/src/hooks/lib/token-usage.ts +1 -0
  35. package/src/targets/claude/install.ts +1 -1
  36. package/src/targets/cursor/install.ts +7 -1
  37. package/src/targets/cursor/uninstall.ts +7 -0
  38. package/src/targets/lib.ts +125 -115
  39. package/src/targets/opencode/install.ts +4 -4
  40. package/src/tools/agent/algorithm-reflect.ts +2 -0
  41. package/src/tools/agent/synthesize.ts +361 -0
  42. package/src/tools/agent/thread.ts +162 -0
@@ -1,8 +1,22 @@
1
1
  ---
2
2
  name: gemini-researcher
3
3
  description: Deep research with academic rigor — Gemini-grounded search with scholarly focus, query decomposition, multi-source synthesis. Falls back to WebSearch if no API key.
4
- tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
5
- model: sonnet
4
+
5
+ claude:
6
+ tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
7
+ model: sonnet
8
+
9
+ opencode:
10
+ mode: subagent
11
+ permission:
12
+ read: allow
13
+ webfetch: allow
14
+ bash: allow
15
+
16
+ cursor:
17
+ model: inherit
18
+ readonly: false
19
+ is_background: false
6
20
  ---
7
21
 
8
22
  You are a research specialist focused on **depth and academic rigor**.
@@ -11,7 +25,7 @@ You are a research specialist focused on **depth and academic rigor**.
11
25
 
12
26
  **Always start with Gemini Search.** Use the grounded search tool for your first sub-question:
13
27
  ```bash
14
- bun ~/.agents/skills/research/tools/gemini-search.ts -- "<query>"
28
+ bun ~/.pal/skills/research/tools/gemini-search.ts -- "<query>"
15
29
  ```
16
30
 
17
31
  - If it returns results → **continue using Gemini Search** for remaining queries
@@ -1,8 +1,22 @@
1
1
  ---
2
2
  name: grok-researcher
3
3
  description: Real-time research via Grok/X API — fetches live data from X (Twitter), trending topics, and breaking news. Use for research requiring up-to-the-minute information about current events, public sentiment, or rapidly evolving situations.
4
- tools: WebSearch, WebFetch, Bash, Read, Grep, Glob
5
- model: sonnet
4
+
5
+ claude:
6
+ tools: WebSearch, WebFetch, Bash, Read, Grep, Glob
7
+ model: sonnet
8
+
9
+ opencode:
10
+ mode: subagent
11
+ permission:
12
+ read: allow
13
+ webfetch: allow
14
+ bash: allow
15
+
16
+ cursor:
17
+ model: inherit
18
+ readonly: false
19
+ is_background: false
6
20
  ---
7
21
 
8
22
  You are a research specialist focused on **real-time information and current events** using the Grok API and X (Twitter) data.
@@ -14,19 +28,19 @@ Use the `grok-search` tool to query the Grok API with real-time search grounding
14
28
  ### Current events / breaking news (web + X sources)
15
29
 
16
30
  ```bash
17
- bun ~/.agents/skills/research/tools/grok-search.ts -- "<your research query>" --sources web,x
31
+ bun ~/.pal/skills/research/tools/grok-search.ts -- "<your research query>" --sources web,x
18
32
  ```
19
33
 
20
34
  ### Social sentiment / trending topics (X only)
21
35
 
22
36
  ```bash
23
- bun ~/.agents/skills/research/tools/grok-search.ts -- "Search X for recent posts about: <topic>. Summarize key themes, notable accounts, and overall sentiment." --sources x
37
+ bun ~/.pal/skills/research/tools/grok-search.ts -- "Search X for recent posts about: <topic>. Summarize key themes, notable accounts, and overall sentiment." --sources x
24
38
  ```
25
39
 
26
40
  ### Web-only search
27
41
 
28
42
  ```bash
29
- bun ~/.agents/skills/research/tools/grok-search.ts -- "<query>" --sources web
43
+ bun ~/.pal/skills/research/tools/grok-search.ts -- "<query>" --sources web
30
44
  ```
31
45
 
32
46
  The tool outputs findings as markdown with a `## Sources` section listing URLs and X posts.
@@ -1,8 +1,22 @@
1
1
  ---
2
2
  name: multi-perspective-researcher
3
3
  description: Breadth-focused research — generates multiple query variations, explores different angles, synthesizes diverse viewpoints. Use for research needing perspective diversity.
4
- tools: WebSearch, WebFetch, Read, Grep, Glob
5
- model: sonnet
4
+
5
+ claude:
6
+ tools: WebSearch, WebFetch, Read, Grep, Glob
7
+ model: sonnet
8
+
9
+ opencode:
10
+ mode: subagent
11
+ permission:
12
+ read: allow
13
+ webfetch: allow
14
+ bash: allow
15
+
16
+ cursor:
17
+ model: inherit
18
+ readonly: false
19
+ is_background: false
6
20
  ---
7
21
 
8
22
  You are a research specialist focused on **breadth and perspective diversity**.
@@ -1,8 +1,22 @@
1
1
  ---
2
2
  name: perplexity-researcher
3
3
  description: Investigative research with verification rigor — Perplexity-grounded search with source cross-referencing, credibility assessment, and evidence chains. Falls back to WebSearch if no API key.
4
- tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
5
- model: sonnet
4
+
5
+ claude:
6
+ tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
7
+ model: sonnet
8
+
9
+ opencode:
10
+ mode: subagent
11
+ permission:
12
+ read: allow
13
+ webfetch: allow
14
+ bash: allow
15
+
16
+ cursor:
17
+ model: inherit
18
+ readonly: false
19
+ is_background: false
6
20
  ---
7
21
 
8
22
  You are a research specialist focused on **investigative rigor and source verification**.
@@ -11,7 +25,7 @@ You are a research specialist focused on **investigative rigor and source verifi
11
25
 
12
26
  **Always start with Perplexity Search.** Use the grounded search tool for your first sub-question:
13
27
  ```bash
14
- bun ~/.agents/skills/research/tools/perplexity-search.ts -- "<query>"
28
+ bun ~/.pal/skills/research/tools/perplexity-search.ts -- "<query>"
15
29
  ```
16
30
 
17
31
  - If it returns results → **continue using Perplexity Search** for remaining queries
@@ -10,7 +10,7 @@ When the user asks to analyze, read, or extract information from a PDF:
10
10
 
11
11
  - **URL**: Use the `pdf-download` CLI tool to download and archive the PDF:
12
12
  ```bash
13
- bun ~/.agents/skills/analyze-pdf/tools/pdf-download.ts -- <url> [--filename <name.pdf>]
13
+ bun ~/.pal/skills/analyze-pdf/tools/pdf-download.ts -- <url> [--filename <name.pdf>]
14
14
  ```
15
15
  The tool downloads the file, saves it to `memory/downloads/{YYYY}/{MM}/{DD}/{filename}.pdf`, and returns JSON with the saved `path`.
16
16
 
@@ -11,7 +11,7 @@ When the user asks to analyze, summarize, or extract information from a YouTube
11
11
  Use the `youtube-analyze` CLI tool. It sends the video to Gemini, which processes both visual and audio content natively.
12
12
 
13
13
  ```bash
14
- bun ~/.agents/skills/analyze-youtube/tools/youtube-analyze.ts -- <youtube-url> [--prompt "your question"]
14
+ bun ~/.pal/skills/analyze-youtube/tools/youtube-analyze.ts -- <youtube-url> [--prompt "your question"]
15
15
  ```
16
16
 
17
17
  - Without `--prompt`, it returns a structured summary with key insights, topics, people, and quotes.
@@ -56,7 +56,7 @@ Return structured JSON:
56
56
  After displaying results, ask the user if they want to save. When saving, pipe the JSON output through the entity-save tool which handles deduplication automatically:
57
57
 
58
58
  ```bash
59
- echo '<the JSON output>' | bun ~/.agents/skills/extract-entities/tools/entity-save.ts -- --source "<URL or content origin>"
59
+ echo '<the JSON output>' | bun ~/.pal/skills/extract-entities/tools/entity-save.ts -- --source "<URL or content origin>"
60
60
  ```
61
61
 
62
62
  The tool deduplicates against the entity index (`memory/entities/entity-index.json`), assigns stable UUIDs, tracks occurrences, and reports what was new vs existing.
@@ -11,19 +11,19 @@ When you need to access the user's Fyzz Chat conversations or projects, use the
11
11
  ### List conversations
12
12
 
13
13
  ```bash
14
- bun ~/.agents/skills/fyzz-chat-api/tools/fyzz-api.ts -- conversations [--limit 20] [--search "query"] [--project-id <id>] [--cursor <cursor>]
14
+ bun ~/.pal/skills/fyzz-chat-api/tools/fyzz-api.ts -- conversations [--limit 20] [--search "query"] [--project-id <id>] [--cursor <cursor>]
15
15
  ```
16
16
 
17
17
  ### Get a single conversation with messages
18
18
 
19
19
  ```bash
20
- bun ~/.agents/skills/fyzz-chat-api/tools/fyzz-api.ts -- conversations <conversation-id>
20
+ bun ~/.pal/skills/fyzz-chat-api/tools/fyzz-api.ts -- conversations <conversation-id>
21
21
  ```
22
22
 
23
23
  ### List projects
24
24
 
25
25
  ```bash
26
- bun ~/.agents/skills/fyzz-chat-api/tools/fyzz-api.ts -- projects
26
+ bun ~/.pal/skills/fyzz-chat-api/tools/fyzz-api.ts -- projects
27
27
  ```
28
28
 
29
29
  ## Setup
@@ -23,7 +23,7 @@ Determine which PAL subsystem owns this behavior:
23
23
  | **Hook-automated** | Runs automatically via StopOrchestrator or UserPromptOrchestrator | `hooks/StopOrchestrator.ts`, `hooks/UserPromptOrchestrator.ts`, `hooks/lib/stop.ts` |
24
24
  | **Instruction-driven** | AI is told to do it via CLAUDE.md / AGENTS.md instructions | `~/.claude/CLAUDE.md`, project CLAUDE.md files |
25
25
  | **Context-dependent** | Requires specific context to be loaded at session start | `hooks/LoadContext.ts`, `hooks/lib/context.ts` |
26
- | **Skill-triggered** | Should have been invoked via a skill | `~/.agents/skills/*/SKILL.md` |
26
+ | **Skill-triggered** | Should have been invoked via a skill | `~/.pal/skills/*/SKILL.md` |
27
27
 
28
28
  ## 3. Trace the execution path
29
29
 
@@ -48,7 +48,7 @@ Based on the type, investigate the relevant chain:
48
48
  3. Check if context was truncated or missing
49
49
 
50
50
  ### For skill-triggered behaviors:
51
- 1. Verify the skill exists in `~/.agents/skills/`
51
+ 1. Verify the skill exists in `~/.pal/skills/`
52
52
  2. Check if SkillGuard blocked it
53
53
  3. Check if the skill's trigger conditions match what happened
54
54
 
@@ -8,7 +8,7 @@ Manage the user's TELOS files — the persistent personal context that drives PA
8
8
 
9
9
  ## TELOS Files
10
10
 
11
- All files live in `~/.agents/PAL/telos/`:
11
+ All files live in `~/.pal/telos/`:
12
12
 
13
13
  | File | Contains |
14
14
  |------|----------|
@@ -25,7 +25,7 @@ All files live in `~/.agents/PAL/telos/`:
25
25
 
26
26
  ## Reading
27
27
 
28
- Read the file directly from `~/.agents/PAL/telos/` when the user asks about any area. Summarize what's relevant — don't dump the entire file unless asked.
28
+ Read the file directly from `~/.pal/telos/` when the user asks about any area. Summarize what's relevant — don't dump the entire file unless asked.
29
29
 
30
30
  ## Updating
31
31
 
@@ -34,7 +34,7 @@ Read the file directly from `~/.agents/PAL/telos/` when the user asks about any
34
34
  For all files except PROJECTS.md — appends content, creates backup, logs the change:
35
35
 
36
36
  ```bash
37
- bun ~/.agents/skills/telos/tools/update-telos.ts <FILE> "<content>" "<description>"
37
+ bun ~/.pal/skills/telos/tools/update-telos.ts <FILE> "<content>" "<description>"
38
38
  ```
39
39
 
40
40
  ### Projects (upsert by ID)
@@ -42,7 +42,7 @@ bun ~/.agents/skills/telos/tools/update-telos.ts <FILE> "<content>" "<descriptio
42
42
  For PROJECTS.md — upserts a row by the ID column. Replaces if the ID exists, appends if new:
43
43
 
44
44
  ```bash
45
- bun ~/.agents/skills/telos/tools/update-projects.ts <id> "<row>" "<description>"
45
+ bun ~/.pal/skills/telos/tools/update-projects.ts <id> "<row>" "<description>"
46
46
  ```
47
47
 
48
48
  The ID is the first column of the table. Use short, lowercase, kebab-case slugs (e.g., `my-project`, `side-gig`).
@@ -78,7 +78,7 @@ User: "add my new side project"
78
78
  → Ask: "What's the project name, status, and priority?"
79
79
  → User provides details
80
80
  → Show the row you'll add, confirm
81
- → Run: bun ~/.agents/skills/telos/tools/update-projects.ts side-project "| side-project | Side Project | In progress | Medium | Description |" "Added Side Project"
81
+ → Run: bun ~/.pal/skills/telos/tools/update-projects.ts side-project "| side-project | Side Project | In progress | Medium | Description |" "Added Side Project"
82
82
  ```
83
83
 
84
84
  **Example 3: Updating a project**
@@ -86,7 +86,7 @@ User: "add my new side project"
86
86
  User: "mark X as complete"
87
87
  → Read PROJECTS.md, find the entry and its ID
88
88
  → Show updated row, confirm
89
- → Run: bun ~/.agents/skills/telos/tools/update-projects.ts some-id "| some-id | Project Name | Complete | High | ... |" "Marked project as complete"
89
+ → Run: bun ~/.pal/skills/telos/tools/update-projects.ts some-id "| some-id | Project Name | Complete | High | ... |" "Marked project as complete"
90
90
  → The existing row is replaced, not duplicated
91
91
  ```
92
92
 
@@ -44,7 +44,7 @@ On follow-ups, include the ITERATION line. On first response to a new request, o
44
44
 
45
45
  FOR: Multi-step, complex, or difficult work. Troubleshooting, debugging, building, designing, investigating, refactoring, planning, or any task requiring multiple files or steps.
46
46
 
47
- **MANDATORY FIRST ACTION:** Read `~/.agents/PAL/ALGORITHM.md` and follow its instructions exactly.
47
+ **MANDATORY FIRST ACTION:** Read `~/.pal/docs/ALGORITHM.md` and follow its instructions exactly.
48
48
 
49
49
  Start your response with the following header in this mode:
50
50
  ══════ PAL | ALGORITHM ══════
@@ -61,7 +61,7 @@ Start your response with the following header in this mode:
61
61
  {{SETUP_PROMPT}}
62
62
  ## Context Routing
63
63
 
64
- When you need context about any of these topics, read `~/.agents/PAL/CONTEXT_ROUTING.md` for the file path:
64
+ When you need context about any of these topics, read `~/.pal/docs/CONTEXT_ROUTING.md` for the file path:
65
65
 
66
66
  - PAL internals
67
67
  - The user, their life and work, etc
@@ -2,6 +2,26 @@
2
2
 
3
3
  Core: transition from CURRENT STATE to IDEAL STATE using verifiable criteria. Every criterion is atomic, binary testable, and checked off with evidence.
4
4
 
5
+ ## Effort Levels
6
+
7
+ Assign ONE tier at the start of OBSERVE. Default is Standard — only escalate if the request demands depth.
8
+
9
+ | Tier | Criteria | Min Capabilities | When |
10
+ |------|----------|-----------------|------|
11
+ | **Standard** | 3-8 | 1-2 | Normal request, single concern |
12
+ | **Extended** | 8-16 | 3-5 | Multi-file, quality must be high |
13
+ | **Advanced** | 16-32 | 5-8 | Substantial design or refactoring |
14
+ | **Deep** | 32+ | 8+ | Complex architecture, no time pressure |
15
+
16
+ **What scales by effort level:**
17
+
18
+ | Element | Standard | Extended+ |
19
+ |---------|----------|-----------|
20
+ | Capability audit format | One-line summary | Full USE/DECLINE/N/A |
21
+ | Plan Mode (EnterPlanMode) | Skip | Use for user alignment |
22
+ | LEARN phase | Reflection log + threads | + Wisdom frame |
23
+ | Constraint extraction | Inline in reverse engineering | Numbered [EX-N] list |
24
+
5
25
  ## The Five Phases
6
26
 
7
27
  All work happens inside these phases. No work outside the phase structure until the Algorithm completes.
@@ -10,6 +30,11 @@ All work happens inside these phases. No work outside the phase structure until
10
30
 
11
31
  Thinking-only. No tool calls except context recovery (Grep/Glob/Read).
12
32
 
33
+ **0. Assign effort level** — classify the request using the table above. Output:
34
+ ```
35
+ ⏱️ EFFORT: [Standard | Extended | Advanced | Deep] — [one-line reason]
36
+ ```
37
+
13
38
  **1. Reverse engineer the request:**
14
39
 
15
40
  🔎 REVERSE ENGINEERING:
@@ -19,6 +44,24 @@ Thinking-only. No tool calls except context recovery (Grep/Glob/Read).
19
44
  - What is obvious they don't want that they didn't say?
20
45
  - What are common gotchas for this type of work?
21
46
 
47
+ **1.5. Extract constraints:**
48
+
49
+ **Standard:** Note constraints inline in the reverse engineering bullets above — e.g. "[Constraint: max 3 retries, timeout 30s]". No separate section needed.
50
+
51
+ **Extended+:** Extract numbered constraints from the request. Scan for:
52
+ - **Quantitative** — numbers, limits, thresholds, ranges
53
+ - **Prohibitions** — "don't", "never", "must not", "avoid"
54
+ - **Requirements** — "must", "always", "required", "needs to"
55
+ - **Implicit** — conventions, patterns, or standards obvious from context
56
+
57
+ ```
58
+ 🔬 CONSTRAINTS:
59
+ - [EX-1]: [constraint]
60
+ - [EX-2]: [constraint]
61
+ ```
62
+
63
+ Every constraint must map to at least one criterion in step 2. A constraint without a covering criterion is a gap.
64
+
22
65
  **2. Define verifiable criteria:**
23
66
 
24
67
  Write atomic criteria — each one is a single testable end-state. Apply the splitting test:
@@ -78,7 +121,14 @@ Scan ALL 14 capabilities below. For each, assign exactly one disposition:
78
121
 
79
122
  **Capability #3 (Skills) requires active scanning.** Read `skill-index.json` and match the task against skill triggers. "Skills — N/A" without evidence of scanning is an error.
80
123
 
81
- Output:
124
+ Output — scales by effort level:
125
+
126
+ **Standard:**
127
+ ```
128
+ 🏹 CAPABILITIES: #1 Task, #3 Skills (matched: research) | 14/14 scanned, USE: 2
129
+ ```
130
+
131
+ **Extended+:**
82
132
  ```
83
133
  🏹 CAPABILITIES (14/14):
84
134
  USE: [#, #, #] — [reason (phase: WHICH)]
@@ -99,7 +149,7 @@ Refine criteria if the pressure test reveals gaps. Add criteria for uncovered fa
99
149
  **Plan the execution:**
100
150
  - Validate prerequisites (env vars, dependencies, files, state)
101
151
  - Decide execution order — what's serial, what can parallelize
102
- - If Advanced+ complexity, use EnterPlanMode for user alignment
152
+ - **Extended+:** use EnterPlanMode for user alignment before executing
103
153
 
104
154
  ### ━━━ ⚡ EXECUTE ━━━ 3/5
105
155
 
@@ -132,7 +182,9 @@ If any criteria failed, fix and re-verify before completing.
132
182
 
133
183
  ### ━━━ 📚 LEARN ━━━ 5/5
134
184
 
135
- Reflect on the work and capture reusable knowledge. Skip this phase when the work was trivial or purely mechanical.
185
+ Reflect on the work and capture reusable knowledge.
186
+
187
+ **Skip only if:** the entire task was a single edit or lookup with zero decisions made (e.g. a typo fix, reading a file). Any task involving planning, debugging, multiple steps, or judgment calls requires LEARN — no exceptions.
136
188
 
137
189
  **1. Algorithm Reflection** (one sentence each — reflect on ALGORITHM PERFORMANCE, not task subject matter):
138
190
 
@@ -148,14 +200,45 @@ Focus: reasoning approach, problem decomposition, anticipation, blind spots.
148
200
  **2. Reflection Log** — record algorithm performance:
149
201
 
150
202
  ```bash
151
- bun ~/.agents/PAL/tools/algorithm-reflect.ts --task "description" --criteria N --passed N --failed N --sentiment 1-10 \
203
+ bun ~/.pal/tools/algorithm-reflect.ts --task "description" --criteria N --passed N --failed N --sentiment 1-10 \
152
204
  --q1 "self reflection" --q2 "algorithm reflection" --q3 "AI reflection"
153
205
  ```
154
206
 
155
- **3. Wisdom Frame** — if the session produced a genuine, reusable insight:
207
+ **3. Open Threads** — for each unresolved question, decision, or follow-up that came up during this session:
208
+
209
+ ```bash
210
+ bun ~/.pal/tools/thread.ts --add --title "brief title" --context "why it matters, what needs to happen"
211
+ ```
212
+
213
+ Only add threads that genuinely need follow-up. Resolve existing threads if this session closed them:
156
214
 
157
215
  ```bash
158
- bun ~/.agents/PAL/tools/wisdom-frame.ts --domain <domain> --observation "insight" [--type principle|contextual-rule|anti-pattern|evolution]
216
+ bun ~/.pal/tools/thread.ts --resolve --id <id>
217
+ ```
218
+
219
+ **4. Opinion capture** — scan the conversation for moments where the user:
220
+ - Confirmed something you did: "yes exactly", "keep doing that", "10 rated", accepted without pushback
221
+ - Corrected something you did: "no", "don't do that", "stop", "that's not what I meant"
222
+ - Revealed a preference by repeating a pattern (asked for concise answers twice, always checked PAI first, etc.)
223
+
224
+ For each, invoke the opinion tool:
225
+ ```bash
226
+ # User confirmed a preference
227
+ bun ~/.pal/skills/opinion/tools/opinion.ts evidence "matching keywords" --confirmation "what they confirmed"
228
+
229
+ # User corrected a preference
230
+ bun ~/.pal/skills/opinion/tools/opinion.ts evidence "matching keywords" --contradiction "what they corrected"
231
+
232
+ # New pattern observed (no existing opinion matches)
233
+ bun ~/.pal/skills/opinion/tools/opinion.ts add "the preference" --category communication|technical|workflow|general
234
+ ```
235
+
236
+ Skip if nothing in the conversation touched preferences or working style.
237
+
238
+ **5. Wisdom Frame** (Extended+ only) — if the session produced a genuine, reusable insight:
239
+
240
+ ```bash
241
+ bun ~/.pal/tools/wisdom-frame.ts --domain <domain> --observation "insight" [--type principle|contextual-rule|anti-pattern|evolution]
159
242
  ```
160
243
 
161
244
  Domains: `development`, `workflow`, `communication`, `infrastructure`, `integration`, or any fitting domain.
@@ -166,18 +249,18 @@ Only write if the insight is **genuine and reusable** — not every session prod
166
249
  ```
167
250
  ♻️ ALGORITHM ═══════════════════════════
168
251
  🗒️ TASK: [brief description]
252
+ ⏱️ EFFORT: [tier] — [reason]
169
253
 
170
254
  ━━━ 👁️ OBSERVE ━━━ 1/5
171
255
  🔎 REVERSE ENGINEERING:
172
256
  [reverse engineering output]
173
257
 
258
+ 🔬 CONSTRAINTS: [Extended+: EX-1, EX-2... | Standard: inline above]
259
+
174
260
  📋 CRITERIA:
175
261
  [criteria checklist]
176
262
 
177
- 🏹 CAPABILITIES (14/14):
178
- USE: [#, #] — [reason]
179
- DECLINE: [#] — [reason]
180
- N/A: [rest]
263
+ 🏹 CAPABILITIES: [format scales by effort level]
181
264
 
182
265
  ━━━ 🧠 PLAN ━━━ 2/5
183
266
  🧠 RISKS: [risks]
@@ -6,25 +6,25 @@ Load context on-demand by reading the file at the path listed. Only load what th
6
6
 
7
7
  | Topic | Path |
8
8
  |-------|------|
9
- | PAL system overview | `~/.agents/PAL/README.md` |
10
- | System architecture | `~/.agents/PAL/SYSTEM_ARCHITECTURE.md` |
11
- | Memory format & guidelines | `~/.agents/PAL/MEMORY_SYSTEM.md` |
12
- | Work tracking (projects, sessions) | `~/.agents/PAL/WORK_TRACKING.md` |
13
- | Opinion tracking | `~/.agents/PAL/OPINION_TRACKING.md` |
14
- | Steering rules | `~/.agents/PAL/STEERING_RULES.md` |
15
- | Algorithm (complex work phases) | `~/.agents/PAL/ALGORITHM.md` |
9
+ | PAL system overview | `~/.pal/docs/README.md` |
10
+ | System architecture | `~/.pal/docs/SYSTEM_ARCHITECTURE.md` |
11
+ | Memory format & guidelines | `~/.pal/docs/MEMORY_SYSTEM.md` |
12
+ | Work tracking (projects, sessions) | `~/.pal/docs/WORK_TRACKING.md` |
13
+ | Opinion tracking | `~/.pal/docs/OPINION_TRACKING.md` |
14
+ | Steering rules | `~/.pal/docs/STEERING_RULES.md` |
15
+ | Algorithm (complex work phases) | `~/.pal/docs/ALGORITHM.md` |
16
16
 
17
17
  ## User Context (TELOS)
18
18
 
19
19
  | Topic | Path |
20
20
  |-------|------|
21
- | Projects & priorities | `~/.agents/PAL/telos/PROJECTS.md` |
22
- | Goals (short/medium/long-term) | `~/.agents/PAL/telos/GOALS.md` |
23
- | Beliefs & principles | `~/.agents/PAL/telos/BELIEFS.md` |
24
- | Current challenges | `~/.agents/PAL/telos/CHALLENGES.md` |
25
- | Mission & direction | `~/.agents/PAL/telos/MISSION.md` |
26
- | Strategies & approaches | `~/.agents/PAL/telos/STRATEGIES.md` |
27
- | Ideas to explore | `~/.agents/PAL/telos/IDEAS.md` |
28
- | Key lessons learned | `~/.agents/PAL/telos/LEARNED.md` |
29
- | Mental models | `~/.agents/PAL/telos/MODELS.md` |
30
- | Narrative context | `~/.agents/PAL/telos/NARRATIVES.md` |
21
+ | Projects & priorities | `~/.pal/telos/PROJECTS.md` |
22
+ | Goals (short/medium/long-term) | `~/.pal/telos/GOALS.md` |
23
+ | Beliefs & principles | `~/.pal/telos/BELIEFS.md` |
24
+ | Current challenges | `~/.pal/telos/CHALLENGES.md` |
25
+ | Mission & direction | `~/.pal/telos/MISSION.md` |
26
+ | Strategies & approaches | `~/.pal/telos/STRATEGIES.md` |
27
+ | Ideas to explore | `~/.pal/telos/IDEAS.md` |
28
+ | Key lessons learned | `~/.pal/telos/LEARNED.md` |
29
+ | Mental models | `~/.pal/telos/MODELS.md` |
30
+ | Narrative context | `~/.pal/telos/NARRATIVES.md` |
@@ -4,11 +4,11 @@ PAL has its own memory system that persists across sessions AND across tools (Cl
4
4
 
5
5
  ## Where to write
6
6
 
7
- - **Wisdom frames**: `~/.agents/PAL/memory/wisdom/frames/` — crystallized principles per domain (loaded every session)
8
- - **Relationship notes**: `~/.agents/PAL/memory/relationship/YYYY-MM/YYYY-MM-DD.md` — daily interaction observations (loaded every session)
9
- - **Session learnings**: `~/.agents/PAL/memory/learning/session/YYYY-MM/*.md` — reusable insights from sessions (loaded every session)
10
- - **Failure captures**: `~/.agents/PAL/memory/learning/failures/YYYY-MM/{timestamp}_{slug}/capture.md` — what went wrong and why
11
- - **Signals**: `~/.agents/PAL/memory/signals/ratings.jsonl` — append-only rating signal log (do not edit directly)
7
+ - **Wisdom frames**: `~/.pal/memory/wisdom/frames/` — crystallized principles per domain (loaded every session)
8
+ - **Relationship notes**: `~/.pal/memory/relationship/YYYY-MM/YYYY-MM-DD.md` — daily interaction observations (loaded every session)
9
+ - **Session learnings**: `~/.pal/memory/learning/session/YYYY-MM/*.md` — reusable insights from sessions (loaded every session)
10
+ - **Failure captures**: `~/.pal/memory/learning/failures/YYYY-MM/{timestamp}_{slug}/capture.md` — what went wrong and why
11
+ - **Signals**: `~/.pal/memory/signals/ratings.jsonl` — append-only rating signal log (do not edit directly)
12
12
 
13
13
  ## Format
14
14
 
@@ -6,18 +6,21 @@ PAL is a persistent, cross-platform, cross-agent layer for portable AI workflows
6
6
 
7
7
  **CLAUDE.md** (or the agent equivalent) is the entry point — generated from a template by the CLI installer. It defines execution modes, The Algorithm routing, and the context routing table. The agent loads it natively every session. A SessionStart hook keeps it fresh automatically.
8
8
 
9
- **The PAL home directory (`~/.agents/PAL/`)** contains all system documentation, user context (TELOS), and routing files. The rest of the system lives in the PAL package (`src/`) and the agent's config directory (`~/.claude/`, `~/.config/opencode/`, `~/.cursor/`, or `~/.codex/`).
9
+ **The PAL home directory (`~/.pal/`)** contains all system documentation, user context (TELOS), memory, and tools. The rest of the system lives in the PAL package (`src/`) and the agent's config directory (`~/.claude/`, `~/.config/opencode/`, `~/.cursor/`, or `~/.codex/`).
10
10
 
11
11
  ## Directory Structure
12
12
 
13
13
  ```
14
- ~/.agents/PAL/ # PAL home — user context + routing
15
- ALGORITHM.md # The execution engine (4-phase)
16
- CONTEXT_ROUTING.md # On-demand context routing table
17
- MEMORY_SYSTEM.md # Memory guidelines
18
- OPINION_TRACKING.md # Opinion system reference
19
- STEERING_RULES.md # Behavioral rules
20
- WORK_TRACKING.md # Work tracking reference
14
+ ~/.pal/ # PAL home
15
+ docs/ # System documentation (engine-managed)
16
+ ALGORITHM.md # The execution engine (4-phase)
17
+ CONTEXT_ROUTING.md # On-demand context routing table
18
+ MEMORY_SYSTEM.md # Memory guidelines
19
+ OPINION_TRACKING.md # Opinion system reference
20
+ STEERING_RULES.md # Behavioral rules
21
+ WORK_TRACKING.md # Work tracking reference
22
+ tools/ # Agent CLI tools (symlink → repo src/tools/agent/)
23
+ skills/ # Installed skills (symlinks → assets/skills/)
21
24
  telos/ # User life context (TELOS)
22
25
  MISSION.md, GOALS.md, PROJECTS.md, BELIEFS.md,
23
26
  CHALLENGES.md, STRATEGIES.md, IDEAS.md, LEARNED.md,
@@ -124,5 +127,5 @@ PAL is designed to work identically across:
124
127
 
125
128
  - **Add a skill:** Use the `create-skill` skill or manually create `assets/skills/<name>/SKILL.md`
126
129
  - **Add startup files:** Append to `pal-settings.json → loadAtStartup.files`
127
- - **Add user context:** Create files in `~/.agents/PAL/telos/`
130
+ - **Add user context:** Create files in `~/.pal/telos/`
128
131
  - **Toggle dynamic context:** Set keys in `pal-settings.json → dynamicContext` to `false`
@@ -447,7 +447,7 @@ All paths resolve through `src/hooks/lib/paths.ts`:
447
447
 
448
448
  | Path | Default | Override |
449
449
  |------|---------|----------|
450
- | PAL home | `~/.agents/PAL` | `PAL_HOME` |
450
+ | PAL home | `~/.pal` | `PAL_HOME` |
451
451
  | PAL package | Auto-detected from source | `PAL_PKG` |
452
452
  | Claude config | `~/.claude` | `PAL_CLAUDE_DIR` |
453
453
  | opencode config | `~/.config/opencode` | `PAL_OPENCODE_DIR` |
@@ -14,8 +14,8 @@
14
14
  "loadAtStartup": {
15
15
  "_docs": "Files force-loaded into session context at startup. Injected as <system-reminder> blocks.",
16
16
  "files": [
17
- "~/.agents/PAL/STEERING_RULES.md",
18
- "~/.agents/PAL/telos/PROJECTS.md"
17
+ "~/.pal/docs/STEERING_RULES.md",
18
+ "~/.pal/telos/PROJECTS.md"
19
19
  ]
20
20
  },
21
21
  "dynamicContext": {
@@ -27,6 +27,9 @@
27
27
  "synthesis": true,
28
28
  "signalTrends": true,
29
29
  "failurePatterns": true,
30
- "activeWork": true
30
+ "activeWork": true,
31
+ "projectHistory": true,
32
+ "sessionIntelligence": true,
33
+ "handoff": true
31
34
  }
32
35
  }
@@ -19,8 +19,8 @@
19
19
  "Bash(file //*)",
20
20
  "Bash(stat //*)",
21
21
  "Bash(readlink //*)",
22
- "Bash(bun ~/.agents/skills/*/tools/*.ts *)",
23
- "Bash(bun ~/.agents/PAL/tools/*.ts *)"
22
+ "Bash(bun ~/.pal/skills/*/tools/*.ts *)",
23
+ "Bash(bun ~/.pal/tools/*.ts *)"
24
24
  ]
25
25
  },
26
26
  "hooks": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.22.0",
3
+ "version": "0.23.1",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,6 +44,8 @@
44
44
  "prepare": "husky",
45
45
  "install:all": "bun run src/cli/index.ts cli install",
46
46
  "uninstall": "bun run src/cli/index.ts cli uninstall",
47
+ "tool:synthesize": "bun run src/tools/agent/synthesize.ts",
48
+ "tool:thread": "bun run src/tools/agent/thread.ts",
47
49
  "tool:analyze": "bun run src/tools/agent/analyze.ts",
48
50
  "tool:wisdom-frame": "bun run src/tools/agent/wisdom-frame.ts",
49
51
  "tool:reflect": "bun run src/tools/relationship-reflect.ts",