portable-agent-layer 0.16.0 → 0.17.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
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A cross-platform, cross-agent layer for portable AI workflows, memory, and accumulated knowledge.
|
|
4
4
|
|
|
5
|
-
PAL lets you carry your agent context across **Windows**, **macOS**, and **Linux**, and work across different agent runtimes and interfaces such as **Claude** and **
|
|
5
|
+
PAL lets you carry your agent context across **Windows**, **macOS**, and **Linux**, and work across different agent runtimes and interfaces such as **Claude Code**, **opencode**, **Cursor**, and **Codex**. Its core idea is simple: your knowledge and workflows should belong to **you**, not to a single machine, tool, or vendor.
|
|
6
6
|
|
|
7
7
|
> Inspired in part by [Daniel Miessler](https://danielmiessler.com)'s work on [Personal AI Infrastructure](https://github.com/danielmiessler/Personal_AI_Infrastructure). PAL is an independent open-source implementation focused on portability across platforms and agents. It is not affiliated with or endorsed by Daniel Miessler.
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ With PAL, you can:
|
|
|
33
33
|
> **Bun is required.** PAL is built on [Bun](https://bun.sh) and will not work with Node.js or other runtimes. Install it with `curl -fsSL https://bun.sh/install | bash`.
|
|
34
34
|
|
|
35
35
|
- [Bun](https://bun.sh) >= 1.3.0
|
|
36
|
-
- At least one of: [Claude Code](https://claude.ai/code)
|
|
36
|
+
- At least one of: [Claude Code](https://claude.ai/code), [opencode](https://opencode.ai), [Cursor](https://cursor.com), or [Codex](https://openai.com/index/introducing-codex/)
|
|
37
37
|
|
|
38
38
|
### Package mode (recommended)
|
|
39
39
|
|
|
@@ -94,6 +94,15 @@ pal cli install --cursor # Cursor only
|
|
|
94
94
|
pal cli install # all available (default)
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
### Supported agents
|
|
98
|
+
|
|
99
|
+
| Agent | Support | Skills | Hooks | AGENTS.md | Subagents |
|
|
100
|
+
|-------|---------|--------|-------|-----------|-----------|
|
|
101
|
+
| Claude Code | Full | Yes | Yes | Yes | Yes |
|
|
102
|
+
| opencode | Full | Yes | Yes (plugin) | Yes | Yes |
|
|
103
|
+
| Cursor | Full | Yes | Yes | Yes (injected via hook) | Yes |
|
|
104
|
+
| Codex | Partial | Yes | No | Yes | No |
|
|
105
|
+
|
|
97
106
|
---
|
|
98
107
|
|
|
99
108
|
## Environment variables
|
|
@@ -114,6 +123,7 @@ pal cli install # all available (default)
|
|
|
114
123
|
| `PAL_CLAUDE_DIR` | Override Claude config dir (default: `~/.claude`) |
|
|
115
124
|
| `PAL_OPENCODE_DIR` | Override opencode config dir (default: `~/.config/opencode`) |
|
|
116
125
|
| `PAL_CURSOR_DIR` | Override Cursor config dir (default: `~/.cursor`) |
|
|
126
|
+
| `PAL_CODEX_DIR` | Override Codex config dir (default: `~/.codex`) |
|
|
117
127
|
| `PAL_AGENTS_DIR` | Override agents dir (default: `~/.agents`) |
|
|
118
128
|
|
|
119
129
|
---
|
|
@@ -162,7 +172,7 @@ Your setup should be able to travel with you.
|
|
|
162
172
|
## Features
|
|
163
173
|
|
|
164
174
|
- **Cross-platform**: works on Windows, macOS, and Linux
|
|
165
|
-
- **Cross-agent**:
|
|
175
|
+
- **Cross-agent**: full support for Claude Code, opencode, and Cursor; partial support for Codex
|
|
166
176
|
- **Portable knowledge**: export and import accumulated knowledge
|
|
167
177
|
- **TypeScript-first**: built in TypeScript from day one
|
|
168
178
|
- **Open source**: hackable, inspectable, extensible
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# PAL — Portable Agent Layer
|
|
2
2
|
|
|
3
|
-
PAL is a persistent, cross-platform, cross-agent layer for portable AI workflows, memory, and accumulated knowledge. It runs inside any compatible AI coding agent (Claude Code, opencode) as an interconnected set of skills, hooks, tools, memory, and configuration — all orchestrated by The Algorithm.
|
|
3
|
+
PAL is a persistent, cross-platform, cross-agent layer for portable AI workflows, memory, and accumulated knowledge. It runs inside any compatible AI coding agent (Claude Code, opencode, Cursor, Codex) as an interconnected set of skills, hooks, tools, memory, and configuration — all orchestrated by The Algorithm.
|
|
4
4
|
|
|
5
5
|
## How It Works
|
|
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
|
|
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/`).
|
|
10
10
|
|
|
11
11
|
## Directory Structure
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ PAL is a persistent, cross-platform, cross-agent layer for portable AI workflows
|
|
|
29
29
|
hooks/ # Session lifecycle hooks
|
|
30
30
|
handlers/ # Individual stop/prompt handlers
|
|
31
31
|
lib/ # Shared utilities
|
|
32
|
-
targets/ # Agent-specific installers (Claude, opencode)
|
|
32
|
+
targets/ # Agent-specific installers (Claude, opencode, Cursor)
|
|
33
33
|
tools/ # Standalone CLI tools
|
|
34
34
|
assets/
|
|
35
35
|
skills/ # Bundled skills (16+)
|
|
@@ -104,6 +104,7 @@ pal # Start agent session with auto-summary on exit
|
|
|
104
104
|
pal cli init # Scaffold PAL home + install hooks
|
|
105
105
|
pal cli install [--claude] # Register hooks/skills for Claude Code
|
|
106
106
|
pal cli install [--opencode] # Register hooks/skills for opencode
|
|
107
|
+
pal cli install [--cursor] # Register hooks/skills for Cursor
|
|
107
108
|
pal cli uninstall # Remove hooks/skills
|
|
108
109
|
pal cli status # Show configuration
|
|
109
110
|
pal cli doctor # Check prerequisites and health
|
|
@@ -116,8 +117,8 @@ pal cli update # Update PAL
|
|
|
116
117
|
|
|
117
118
|
PAL is designed to work identically across:
|
|
118
119
|
- **Platforms:** macOS, Linux, Windows
|
|
119
|
-
- **Agents:** Claude Code, opencode (and
|
|
120
|
-
- **Environment overrides:** `PAL_HOME`, `PAL_PKG`, `PAL_CLAUDE_DIR`, `PAL_OPENCODE_DIR`, `PAL_AGENTS_DIR`
|
|
120
|
+
- **Agents:** Claude Code (full), opencode (full), Cursor (full), Codex (partial — AGENTS.md and skills only, no hooks or subagents)
|
|
121
|
+
- **Environment overrides:** `PAL_HOME`, `PAL_PKG`, `PAL_CLAUDE_DIR`, `PAL_OPENCODE_DIR`, `PAL_CURSOR_DIR`, `PAL_CODEX_DIR`, `PAL_AGENTS_DIR`
|
|
121
122
|
|
|
122
123
|
## Extending PAL
|
|
123
124
|
|
|
@@ -433,9 +433,14 @@ src/targets/
|
|
|
433
433
|
│ ├── install.ts # Register hooks + skills in opencode config
|
|
434
434
|
│ ├── uninstall.ts
|
|
435
435
|
│ └── plugin.ts # opencode plugin interface
|
|
436
|
+
├── cursor/ # Cursor specific
|
|
437
|
+
│ ├── install.ts # Register hooks + skills in ~/.cursor/
|
|
438
|
+
│ └── uninstall.ts
|
|
436
439
|
└── lib.ts # Shared: JSON read/write, settings merge, TELOS scaffold
|
|
437
440
|
```
|
|
438
441
|
|
|
442
|
+
Codex support is partial — AGENTS.md is symlinked to `~/.codex/AGENTS.md` automatically (no dedicated target installer needed).
|
|
443
|
+
|
|
439
444
|
### Path Resolution
|
|
440
445
|
|
|
441
446
|
All paths resolve through `src/hooks/lib/paths.ts`:
|
|
@@ -446,6 +451,8 @@ All paths resolve through `src/hooks/lib/paths.ts`:
|
|
|
446
451
|
| PAL package | Auto-detected from source | `PAL_PKG` |
|
|
447
452
|
| Claude config | `~/.claude` | `PAL_CLAUDE_DIR` |
|
|
448
453
|
| opencode config | `~/.config/opencode` | `PAL_OPENCODE_DIR` |
|
|
454
|
+
| Cursor config | `~/.cursor` | `PAL_CURSOR_DIR` |
|
|
455
|
+
| Codex config | `~/.codex` | `PAL_CODEX_DIR` |
|
|
449
456
|
| Agents dir | `~/.agents` | `PAL_AGENTS_DIR` |
|
|
450
457
|
|
|
451
458
|
### Portability Contract
|
package/package.json
CHANGED
|
@@ -48,19 +48,25 @@ function latestMtime(...filePaths: string[]): number {
|
|
|
48
48
|
return latest;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/**
|
|
52
|
-
function
|
|
53
|
-
const { outputPath, symlinkPath } = getOutputPaths();
|
|
51
|
+
/** Create or verify a symlink pointing to AGENTS.md */
|
|
52
|
+
function ensureOneSymlink(linkPath: string, targetPath: string): void {
|
|
54
53
|
try {
|
|
55
|
-
const stat = lstatSync(
|
|
56
|
-
|
|
57
|
-
if (!stat.isSymbolicLink()) unlinkSync(symlinkPath);
|
|
54
|
+
const stat = lstatSync(linkPath);
|
|
55
|
+
if (!stat.isSymbolicLink()) unlinkSync(linkPath);
|
|
58
56
|
else return; // already a symlink, leave it
|
|
59
57
|
} catch {
|
|
60
58
|
// doesn't exist — create it
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
ensureDir(dirname(linkPath));
|
|
61
|
+
const relTarget = relative(dirname(linkPath), targetPath).replaceAll("\\", "/");
|
|
62
|
+
symlinkSync(relTarget, linkPath);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Ensure all agent symlinks point to the canonical AGENTS.md */
|
|
66
|
+
function ensureSymlinks(): void {
|
|
67
|
+
const { outputPath, symlinkPath } = getOutputPaths();
|
|
68
|
+
ensureOneSymlink(symlinkPath, outputPath);
|
|
69
|
+
ensureOneSymlink(resolve(platform.codexDir(), "AGENTS.md"), outputPath);
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
/** Returns true if AGENTS.md needs to be regenerated */
|
|
@@ -150,7 +156,7 @@ export function buildClaudeMd(): string {
|
|
|
150
156
|
/** Regenerate AGENTS.md if any source file is newer, and ensure CLAUDE.md symlink exists. Returns true if rebuilt. */
|
|
151
157
|
export function regenerateIfNeeded(): boolean {
|
|
152
158
|
const { outputPath } = getOutputPaths();
|
|
153
|
-
|
|
159
|
+
ensureSymlinks();
|
|
154
160
|
if (!needsRebuild()) return false;
|
|
155
161
|
ensureDir(dirname(outputPath));
|
|
156
162
|
writeFileSync(outputPath, buildClaudeMd(), "utf-8");
|
package/src/hooks/lib/paths.ts
CHANGED
|
@@ -68,6 +68,7 @@ export const platform = {
|
|
|
68
68
|
claudeDir: () => process.env.PAL_CLAUDE_DIR || resolve(h, ".claude"),
|
|
69
69
|
opencodeDir: () => process.env.PAL_OPENCODE_DIR || resolve(h, ".config", "opencode"),
|
|
70
70
|
cursorDir: () => process.env.PAL_CURSOR_DIR || resolve(h, ".cursor"),
|
|
71
|
+
codexDir: () => process.env.PAL_CODEX_DIR || resolve(h, ".codex"),
|
|
71
72
|
agentsDir: () => process.env.PAL_AGENTS_DIR || resolve(h, ".agents"),
|
|
72
73
|
} as const;
|
|
73
74
|
|