portable-agent-layer 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agents/gemini-researcher.md +17 -3
- package/assets/agents/grok-researcher.md +19 -5
- package/assets/agents/multi-perspective-researcher.md +16 -2
- package/assets/agents/perplexity-researcher.md +17 -3
- package/assets/skills/analyze-pdf/SKILL.md +1 -1
- package/assets/skills/analyze-youtube/SKILL.md +1 -1
- package/assets/skills/extract-entities/SKILL.md +1 -1
- package/assets/skills/fyzz-chat-api/SKILL.md +3 -3
- package/assets/skills/reflect/SKILL.md +2 -2
- package/assets/skills/telos/SKILL.md +6 -6
- package/assets/templates/AGENTS.md.template +2 -2
- package/assets/templates/PAL/ALGORITHM.md +74 -10
- package/assets/templates/PAL/CONTEXT_ROUTING.md +17 -17
- package/assets/templates/PAL/MEMORY_SYSTEM.md +5 -5
- package/assets/templates/PAL/README.md +12 -9
- package/assets/templates/PAL/SYSTEM_ARCHITECTURE.md +1 -1
- package/assets/templates/pal-settings.json +6 -3
- package/assets/templates/settings.claude.json +2 -2
- package/package.json +3 -1
- package/src/cli/index.ts +4 -11
- package/src/hooks/handlers/relationship.ts +1 -1
- package/src/hooks/handlers/session-intelligence.ts +324 -0
- package/src/hooks/handlers/session-name.ts +2 -2
- package/src/hooks/handlers/synthesis.ts +36 -0
- package/src/hooks/handlers/update-check.ts +2 -2
- package/src/hooks/handlers/work-learning.ts +1 -1
- package/src/hooks/lib/context.ts +116 -0
- package/src/hooks/lib/paths.ts +4 -12
- package/src/hooks/lib/security.ts +39 -28
- package/src/hooks/lib/stop.ts +6 -6
- package/src/hooks/lib/token-usage.ts +1 -0
- package/src/targets/claude/install.ts +1 -1
- package/src/targets/cursor/install.ts +7 -1
- package/src/targets/cursor/uninstall.ts +7 -0
- package/src/targets/lib.ts +125 -115
- package/src/targets/opencode/install.ts +4 -4
- package/src/tools/agent/algorithm-reflect.ts +2 -0
- package/src/tools/agent/synthesize.ts +361 -0
- 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
|
-
|
|
5
|
-
|
|
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 ~/.
|
|
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
|
-
|
|
5
|
-
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 | `~/.
|
|
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 `~/.
|
|
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 `~/.
|
|
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 `~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 ~/.
|
|
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 `~/.
|
|
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 `~/.
|
|
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
|
-
-
|
|
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.
|
|
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,26 @@ Focus: reasoning approach, problem decomposition, anticipation, blind spots.
|
|
|
148
200
|
**2. Reflection Log** — record algorithm performance:
|
|
149
201
|
|
|
150
202
|
```bash
|
|
151
|
-
bun ~/.
|
|
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.
|
|
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 ~/.
|
|
216
|
+
bun ~/.pal/tools/thread.ts --resolve --id <id>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**4. Wisdom Frame** (Extended+ only) — if the session produced a genuine, reusable insight:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
bun ~/.pal/tools/wisdom-frame.ts --domain <domain> --observation "insight" [--type principle|contextual-rule|anti-pattern|evolution]
|
|
159
223
|
```
|
|
160
224
|
|
|
161
225
|
Domains: `development`, `workflow`, `communication`, `infrastructure`, `integration`, or any fitting domain.
|
|
@@ -166,18 +230,18 @@ Only write if the insight is **genuine and reusable** — not every session prod
|
|
|
166
230
|
```
|
|
167
231
|
♻️ ALGORITHM ═══════════════════════════
|
|
168
232
|
🗒️ TASK: [brief description]
|
|
233
|
+
⏱️ EFFORT: [tier] — [reason]
|
|
169
234
|
|
|
170
235
|
━━━ 👁️ OBSERVE ━━━ 1/5
|
|
171
236
|
🔎 REVERSE ENGINEERING:
|
|
172
237
|
[reverse engineering output]
|
|
173
238
|
|
|
239
|
+
🔬 CONSTRAINTS: [Extended+: EX-1, EX-2... | Standard: inline above]
|
|
240
|
+
|
|
174
241
|
📋 CRITERIA:
|
|
175
242
|
[criteria checklist]
|
|
176
243
|
|
|
177
|
-
🏹 CAPABILITIES
|
|
178
|
-
USE: [#, #] — [reason]
|
|
179
|
-
DECLINE: [#] — [reason]
|
|
180
|
-
N/A: [rest]
|
|
244
|
+
🏹 CAPABILITIES: [format scales by effort level]
|
|
181
245
|
|
|
182
246
|
━━━ 🧠 PLAN ━━━ 2/5
|
|
183
247
|
🧠 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 | `~/.
|
|
10
|
-
| System architecture | `~/.
|
|
11
|
-
| Memory format & guidelines | `~/.
|
|
12
|
-
| Work tracking (projects, sessions) | `~/.
|
|
13
|
-
| Opinion tracking | `~/.
|
|
14
|
-
| Steering rules | `~/.
|
|
15
|
-
| Algorithm (complex work phases) | `~/.
|
|
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 | `~/.
|
|
22
|
-
| Goals (short/medium/long-term) | `~/.
|
|
23
|
-
| Beliefs & principles | `~/.
|
|
24
|
-
| Current challenges | `~/.
|
|
25
|
-
| Mission & direction | `~/.
|
|
26
|
-
| Strategies & approaches | `~/.
|
|
27
|
-
| Ideas to explore | `~/.
|
|
28
|
-
| Key lessons learned | `~/.
|
|
29
|
-
| Mental models | `~/.
|
|
30
|
-
| Narrative context | `~/.
|
|
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**: `~/.
|
|
8
|
-
- **Relationship notes**: `~/.
|
|
9
|
-
- **Session learnings**: `~/.
|
|
10
|
-
- **Failure captures**: `~/.
|
|
11
|
-
- **Signals**: `~/.
|
|
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 (`~/.
|
|
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
|
-
~/.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 `~/.
|
|
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 | `~/.
|
|
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
|
-
"~/.
|
|
18
|
-
"~/.
|
|
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 ~/.
|
|
23
|
-
"Bash(bun ~/.
|
|
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.
|
|
3
|
+
"version": "0.23.0",
|
|
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",
|