portable-agent-layer 0.21.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/README.md +3 -2
- 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 +6 -6
- package/assets/skills/fyzz-chat-api/tools/fyzz-api.ts +4 -4
- 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 +139 -13
- 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/WORK_TRACKING.md +2 -9
- 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 +7 -14
- package/src/hooks/handlers/rating.ts +1 -1
- package/src/hooks/handlers/relationship.ts +3 -3
- package/src/hooks/handlers/session-intelligence.ts +324 -0
- package/src/hooks/handlers/session-name.ts +3 -3
- 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 +123 -41
- package/src/hooks/lib/graduation.ts +1 -1
- package/src/hooks/lib/inference.ts +1 -1
- package/src/hooks/lib/paths.ts +4 -12
- package/src/hooks/lib/readme-sync.ts +3 -3
- package/src/hooks/lib/security.ts +41 -27
- package/src/hooks/lib/stop.ts +6 -6
- package/src/hooks/lib/token-usage.ts +1 -0
- package/src/hooks/lib/work-tracking.ts +1 -51
- package/src/targets/claude/install.ts +3 -1
- package/src/targets/cursor/install.ts +9 -1
- package/src/targets/cursor/uninstall.ts +7 -0
- package/src/targets/lib.ts +214 -111
- package/src/targets/opencode/install.ts +6 -4
- package/src/tools/agent/algorithm-reflect.ts +122 -0
- package/src/tools/agent/synthesize.ts +361 -0
- package/src/tools/agent/thread.ts +162 -0
package/README.md
CHANGED
|
@@ -111,14 +111,15 @@ pal cli install # all available (default)
|
|
|
111
111
|
|
|
112
112
|
| Variable | Description |
|
|
113
113
|
|----------|-------------|
|
|
114
|
-
| `
|
|
114
|
+
| `PAL_ANTHROPIC_API_KEY` | Required for PAL's hook inference (sentiment analysis, session naming). Uses Haiku for low-cost background calls. |
|
|
115
115
|
|
|
116
116
|
### Optional
|
|
117
117
|
|
|
118
118
|
| Variable | Description |
|
|
119
119
|
|----------|-------------|
|
|
120
|
-
| `PAL_GEMINI_API_KEY` | For YouTube video analysis skill
|
|
120
|
+
| `PAL_GEMINI_API_KEY` | For YouTube video analysis and web search skill |
|
|
121
121
|
| `PAL_XAI_API_KEY` | For Grok real-time research skill (X/web search) |
|
|
122
|
+
| `PAL_PERPLEXITY_API_KEY` | For Perplexity deep research skill |
|
|
122
123
|
| `PAL_HOME` | Override user state directory (default: `~/.pal` or repo root) |
|
|
123
124
|
| `PAL_PKG` | Override package root |
|
|
124
125
|
| `PAL_CLAUDE_DIR` | Override Claude config dir (default: `~/.claude`) |
|
|
@@ -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.
|
|
@@ -4,26 +4,26 @@ description: Query Fyzz Chat conversations and projects via the REST API. Use wh
|
|
|
4
4
|
argument-hint: <conversations|projects> [options]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
When you need to access the user's Fyzz Chat conversations or projects, use the `fyzz-api` CLI tool. The tool reads the API key from the `
|
|
7
|
+
When you need to access the user's Fyzz Chat conversations or projects, use the `fyzz-api` CLI tool. The tool reads the API key from the `PAL_FYZZ_API_KEY` environment variable automatically — never attempt to read, print, or reference the API key or the env var directly.
|
|
8
8
|
|
|
9
9
|
## Available commands
|
|
10
10
|
|
|
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
|
|
@@ -31,8 +31,8 @@ bun ~/.agents/skills/fyzz-chat-api/tools/fyzz-api.ts -- projects
|
|
|
31
31
|
If the tool reports a missing API key:
|
|
32
32
|
|
|
33
33
|
1. Ask the user to create one in Fyzz Chat → Settings → API Keys
|
|
34
|
-
2. They should set `
|
|
35
|
-
3. Optionally set `
|
|
34
|
+
2. They should set `PAL_FYZZ_API_KEY` in their shell profile or in PAL's `settings.json` env section
|
|
35
|
+
3. Optionally set `PAL_FYZZ_BASE_URL` (defaults to `http://localhost:3000`)
|
|
36
36
|
|
|
37
37
|
## Guidelines
|
|
38
38
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Fyzz Chat API — CLI wrapper for programmatic conversation access.
|
|
4
4
|
*
|
|
5
|
-
* Reads the API key from
|
|
5
|
+
* Reads the API key from PAL_FYZZ_API_KEY env var (never printed to stdout).
|
|
6
6
|
* Returns JSON responses from the Fyzz Chat REST API.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
import { parseArgs } from "node:util";
|
|
15
15
|
|
|
16
16
|
function loadApiKey(): string {
|
|
17
|
-
const key = process.env.
|
|
17
|
+
const key = process.env.PAL_FYZZ_API_KEY;
|
|
18
18
|
if (!key) {
|
|
19
|
-
console.error("Error:
|
|
19
|
+
console.error("Error: PAL_FYZZ_API_KEY environment variable is not set.");
|
|
20
20
|
console.error("Set it in your shell profile or PAL settings.json env section.");
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
@@ -25,7 +25,7 @@ function loadApiKey(): string {
|
|
|
25
25
|
|
|
26
26
|
async function apiFetch(path: string, params?: Record<string, string>): Promise<unknown> {
|
|
27
27
|
const apiKey = loadApiKey();
|
|
28
|
-
const baseUrl = process.env.
|
|
28
|
+
const baseUrl = process.env.PAL_FYZZ_BASE_URL ?? "http://localhost:3000";
|
|
29
29
|
|
|
30
30
|
const url = new URL(`/api/v1${path}`, baseUrl);
|
|
31
31
|
if (params) {
|
|
@@ -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:
|
|
@@ -35,13 +78,62 @@ Format:
|
|
|
35
78
|
|
|
36
79
|
Include at least one anti-criterion (C-A prefix).
|
|
37
80
|
|
|
38
|
-
**3.
|
|
81
|
+
**3. Capability audit:**
|
|
82
|
+
|
|
83
|
+
Scan ALL 14 capabilities below. For each, assign exactly one disposition:
|
|
84
|
+
- **USE** — will invoke during a specific phase. State which.
|
|
85
|
+
- **DECLINE** — would help but not worth it for this task's scope.
|
|
86
|
+
- **N/A** — genuinely irrelevant to this task.
|
|
87
|
+
|
|
88
|
+
**A: Foundation**
|
|
89
|
+
|
|
90
|
+
| # | Capability | Invocation |
|
|
91
|
+
|---|-----------|------------|
|
|
92
|
+
| 1 | Task Tool | TaskCreate, TaskUpdate, TaskList |
|
|
93
|
+
| 2 | AskUserQuestion | Built-in tool |
|
|
94
|
+
| 3 | Skills (ACTIVE SCAN) | Read `skill-index.json`, match triggers against task |
|
|
95
|
+
|
|
96
|
+
**B: Thinking & Analysis**
|
|
97
|
+
|
|
98
|
+
| # | Capability | Invocation |
|
|
99
|
+
|---|-----------|------------|
|
|
100
|
+
| 4 | Think (analysis router) | `think` skill |
|
|
101
|
+
| 5 | First Principles | `first-principles` skill |
|
|
102
|
+
| 6 | Council (multi-perspective) | `council` skill |
|
|
103
|
+
| 7 | Plan Mode | EnterPlanMode tool |
|
|
104
|
+
|
|
105
|
+
**C: Agents & Research**
|
|
106
|
+
|
|
107
|
+
| # | Capability | Invocation |
|
|
108
|
+
|---|-----------|------------|
|
|
109
|
+
| 8 | Research (multi-agent) | `research` skill |
|
|
110
|
+
| 9 | Subagents | Agent tool (Explore, Plan, general-purpose) |
|
|
111
|
+
| 10 | Background agents | Agent tool with `run_in_background: true` |
|
|
112
|
+
|
|
113
|
+
**D: Execution & Verification**
|
|
39
114
|
|
|
40
|
-
|
|
115
|
+
| # | Capability | Invocation |
|
|
116
|
+
|---|-----------|------------|
|
|
117
|
+
| 11 | Git worktree isolation | `isolation: "worktree"` on Agent |
|
|
118
|
+
| 12 | Test runner | `bun test`, vitest, jest, pytest |
|
|
119
|
+
| 13 | Static analysis | `tsc --noEmit`, biome, eslint |
|
|
120
|
+
| 14 | CLI probes | curl, diff, jq, exit codes |
|
|
41
121
|
|
|
42
|
-
|
|
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.
|
|
123
|
+
|
|
124
|
+
Output — scales by effort level:
|
|
125
|
+
|
|
126
|
+
**Standard:**
|
|
127
|
+
```
|
|
128
|
+
🏹 CAPABILITIES: #1 Task, #3 Skills (matched: research) | 14/14 scanned, USE: 2
|
|
43
129
|
```
|
|
44
|
-
|
|
130
|
+
|
|
131
|
+
**Extended+:**
|
|
132
|
+
```
|
|
133
|
+
🏹 CAPABILITIES (14/14):
|
|
134
|
+
USE: [#, #, #] — [reason (phase: WHICH)]
|
|
135
|
+
DECLINE: [#, #] — [reason]
|
|
136
|
+
N/A: [rest]
|
|
45
137
|
```
|
|
46
138
|
|
|
47
139
|
### ━━━ 🧠 PLAN ━━━ 2/5
|
|
@@ -57,7 +149,7 @@ Refine criteria if the pressure test reveals gaps. Add criteria for uncovered fa
|
|
|
57
149
|
**Plan the execution:**
|
|
58
150
|
- Validate prerequisites (env vars, dependencies, files, state)
|
|
59
151
|
- Decide execution order — what's serial, what can parallelize
|
|
60
|
-
-
|
|
152
|
+
- **Extended+:** use EnterPlanMode for user alignment before executing
|
|
61
153
|
|
|
62
154
|
### ━━━ ⚡ EXECUTE ━━━ 3/5
|
|
63
155
|
|
|
@@ -90,16 +182,44 @@ If any criteria failed, fix and re-verify before completing.
|
|
|
90
182
|
|
|
91
183
|
### ━━━ 📚 LEARN ━━━ 5/5
|
|
92
184
|
|
|
93
|
-
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.
|
|
188
|
+
|
|
189
|
+
**1. Algorithm Reflection** (one sentence each — reflect on ALGORITHM PERFORMANCE, not task subject matter):
|
|
190
|
+
|
|
191
|
+
**Q1 — Self:** "What would I have done differently in this Algorithm run?"
|
|
192
|
+
Focus: phase execution, criteria quality, capability selection decisions.
|
|
193
|
+
|
|
194
|
+
**Q2 — Algorithm:** "What would a smarter algorithm have done differently?"
|
|
195
|
+
Focus: structural improvements — missing phases, better gating, capability triggers, ISC patterns.
|
|
196
|
+
|
|
197
|
+
**Q3 — AI:** "What would a fundamentally smarter AI have done differently?"
|
|
198
|
+
Focus: reasoning approach, problem decomposition, anticipation, blind spots.
|
|
199
|
+
|
|
200
|
+
**2. Reflection Log** — record algorithm performance:
|
|
94
201
|
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
|
|
202
|
+
```bash
|
|
203
|
+
bun ~/.pal/tools/algorithm-reflect.ts --task "description" --criteria N --passed N --failed N --sentiment 1-10 \
|
|
204
|
+
--q1 "self reflection" --q2 "algorithm reflection" --q3 "AI reflection"
|
|
205
|
+
```
|
|
206
|
+
|
|
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
|
+
```
|
|
98
212
|
|
|
99
|
-
|
|
213
|
+
Only add threads that genuinely need follow-up. Resolve existing threads if this session closed them:
|
|
100
214
|
|
|
101
215
|
```bash
|
|
102
|
-
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]
|
|
103
223
|
```
|
|
104
224
|
|
|
105
225
|
Domains: `development`, `workflow`, `communication`, `infrastructure`, `integration`, or any fitting domain.
|
|
@@ -110,15 +230,18 @@ Only write if the insight is **genuine and reusable** — not every session prod
|
|
|
110
230
|
```
|
|
111
231
|
♻️ ALGORITHM ═══════════════════════════
|
|
112
232
|
🗒️ TASK: [brief description]
|
|
233
|
+
⏱️ EFFORT: [tier] — [reason]
|
|
113
234
|
|
|
114
235
|
━━━ 👁️ OBSERVE ━━━ 1/5
|
|
115
236
|
🔎 REVERSE ENGINEERING:
|
|
116
237
|
[reverse engineering output]
|
|
117
238
|
|
|
239
|
+
🔬 CONSTRAINTS: [Extended+: EX-1, EX-2... | Standard: inline above]
|
|
240
|
+
|
|
118
241
|
📋 CRITERIA:
|
|
119
242
|
[criteria checklist]
|
|
120
243
|
|
|
121
|
-
🏹 CAPABILITIES: [
|
|
244
|
+
🏹 CAPABILITIES: [format scales by effort level]
|
|
122
245
|
|
|
123
246
|
━━━ 🧠 PLAN ━━━ 2/5
|
|
124
247
|
🧠 RISKS: [risks]
|
|
@@ -136,6 +259,9 @@ Only write if the insight is **genuine and reusable** — not every session prod
|
|
|
136
259
|
🗣️ {{IDENTITY_NAME}}: [summary]
|
|
137
260
|
|
|
138
261
|
━━━ 📚 LEARN ━━━ 5/5
|
|
139
|
-
🪞
|
|
262
|
+
🪞 Q1 — Self: [what I'd do differently]
|
|
263
|
+
🪞 Q2 — Algorithm: [structural improvement]
|
|
264
|
+
🪞 Q3 — AI: [reasoning blind spot]
|
|
265
|
+
📊 REFLECTION LOG: [appended to algorithm-reflections.jsonl]
|
|
140
266
|
📝 WISDOM: [frame update if genuine insight, or "No new insight"]
|
|
141
267
|
```
|
|
@@ -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
|
|