portable-agent-layer 0.41.1 → 0.43.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/.husky/install.mjs +8 -0
- package/README.md +2 -1
- package/assets/skills/analyze-youtube/SKILL.md +1 -1
- package/assets/skills/consulting-report/template/components/code-block.tsx +21 -0
- package/assets/skills/consulting-report/template/components/cover-page.tsx +88 -27
- package/assets/skills/consulting-report/template/components/decision-table.tsx +62 -0
- package/assets/skills/consulting-report/template/components/process-stage.tsx +28 -0
- package/assets/skills/consulting-report/template/components/tier-matrix.tsx +102 -0
- package/assets/skills/consulting-report/template/lib/types.ts +49 -1
- package/assets/skills/consulting-report/tools/generate-pdf.ts +99 -16
- package/assets/skills/entities/SKILL.md +95 -0
- package/assets/skills/telos/SKILL.md +1 -1
- package/assets/templates/PAL/ALGORITHM.md +1 -1
- package/assets/templates/PAL/README.md +2 -2
- package/assets/templates/PAL/SYSTEM_ARCHITECTURE.md +1 -1
- package/assets/templates/rules.codex.rules +64 -0
- package/assets/templates/settings.claude.json +2 -1
- package/package.json +11 -12
- package/src/cli/index.ts +8 -0
- package/src/cli/knowledge.ts +620 -0
- package/src/cli/migrate.ts +188 -3
- package/src/hooks/lib/claude-md.ts +6 -2
- package/src/hooks/lib/export.ts +1 -1
- package/src/hooks/lib/paths.ts +3 -1
- package/src/targets/codex/install.ts +14 -0
- package/src/targets/codex/uninstall.ts +14 -0
- package/src/targets/lib.ts +53 -36
- package/src/tools/knowledge/graph.ts +395 -0
- package/src/tools/knowledge/ingest.ts +409 -0
- package/src/tools/knowledge/lib.ts +493 -0
- package/assets/skills/extract-entities/SKILL.md +0 -62
- package/assets/skills/extract-entities/tools/entity-save.ts +0 -110
- package/src/hooks/lib/entities.ts +0 -304
- package/src/tools/export.ts +0 -40
- package/src/tools/import.ts +0 -111
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: entities
|
|
3
|
+
description: Maintain the personal knowledge graph of people and companies. Detect named entities in any content (article, video, paste, conversation), upsert them to ~/.pal/memory/knowledge/, and surface what's already known. Use proactively whenever named entities appear — don't wait to be asked.
|
|
4
|
+
argument-hint: <content, URL, or pasted text>
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Detect, persist, and query people and companies referenced in $ARGUMENTS.
|
|
8
|
+
|
|
9
|
+
The default workflow is **extract → save → show summary**, in that order. Saving is not optional: persistence is the point of the skill. Skip the save step only if the user explicitly said "don't save", "just look", or similar.
|
|
10
|
+
|
|
11
|
+
## 1. Extract
|
|
12
|
+
|
|
13
|
+
Read/fetch the content and extract ALL people and companies mentioned.
|
|
14
|
+
|
|
15
|
+
### People
|
|
16
|
+
|
|
17
|
+
For each person, extract:
|
|
18
|
+
- **name**: Full name
|
|
19
|
+
- **role**: author | subject | mentioned | quoted | expert | interviewer | interviewee
|
|
20
|
+
- **title**: Job title (null if unknown)
|
|
21
|
+
- **company**: Company affiliation (null if unknown)
|
|
22
|
+
- **social**: twitter (@handle), linkedin (URL), email, website — null if unknown
|
|
23
|
+
- **context**: Why this person is mentioned and their relevance
|
|
24
|
+
- **importance**: primary (central to content) | secondary (supporting) | minor (brief mention)
|
|
25
|
+
|
|
26
|
+
### Companies
|
|
27
|
+
|
|
28
|
+
For each company/organization, extract:
|
|
29
|
+
- **name**: Official name
|
|
30
|
+
- **domain**: Primary website domain (e.g. "anthropic.com", null if unknown)
|
|
31
|
+
- **industry**: Classification (AI, security, fintech, healthcare, etc.)
|
|
32
|
+
- **context**: How and why mentioned
|
|
33
|
+
- **mentioned_as**: subject | source | example | competitor | partner | acquisition | product | other
|
|
34
|
+
- **sentiment**: positive | neutral | negative | mixed
|
|
35
|
+
|
|
36
|
+
### Extraction guidelines
|
|
37
|
+
|
|
38
|
+
- Accuracy over quantity — use null for unknown fields, never guess
|
|
39
|
+
- Include authors, subjects, quoted individuals, and anyone significantly mentioned
|
|
40
|
+
- For research papers: all authors get "author" role
|
|
41
|
+
- For interviews: distinguish interviewer vs interviewee
|
|
42
|
+
- Universities and research institutions count as companies
|
|
43
|
+
- Extract social handles from bios, signatures, or text body
|
|
44
|
+
- Context fields should explain relevance, not just repeat the mention
|
|
45
|
+
|
|
46
|
+
### Output shape
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"people": [...],
|
|
51
|
+
"companies": [...]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 2. Save (default)
|
|
56
|
+
|
|
57
|
+
Immediately persist the extracted JSON. Do not ask first — saving is the default:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
echo '<the JSON output>' | pal cli knowledge ingest --source "<URL or content origin>"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The CLI writes one markdown file per entity under `~/.pal/memory/knowledge/{People,Companies}/<slug>.md`, preserving every extracted field (role, title, social, context, importance for people; domain, industry, sentiment, mentioned_as for companies) as frontmatter. When a person record includes a `company`, a `part-of` typed edge is auto-created from the person to the company (the company is stub-created if it doesn't exist yet). Each ingestion appends a per-source log section to the entity's body so the same source can be re-ingested safely (idempotent on `--source`).
|
|
64
|
+
|
|
65
|
+
The CLI prints a JSON summary of `{created, updated, slugs}` counts per domain.
|
|
66
|
+
|
|
67
|
+
**Opt-out:** if the user explicitly said not to save (e.g. "who's mentioned in this email — don't store anything"), skip step 2 entirely and just show the extracted JSON.
|
|
68
|
+
|
|
69
|
+
## 3. Query (read-back)
|
|
70
|
+
|
|
71
|
+
Before scraping a known source, or after saving, surface what's already on file:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pal cli knowledge search "<name>" # substring across title, tags, body
|
|
75
|
+
pal cli knowledge show <slug> # full entity (frontmatter + body)
|
|
76
|
+
pal cli knowledge graph <slug> # related entities (BFS, default 2 hops)
|
|
77
|
+
pal cli knowledge ls People # list a domain
|
|
78
|
+
pal cli knowledge stats # counts, hubs, isolated nodes
|
|
79
|
+
pal cli knowledge find <tag> # entities tagged with <tag> (topic: prefix transparent)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use `search` before extracting to detect duplicates; use `show` to confirm a save landed correctly; use `graph` to surface relationships the user may have forgotten.
|
|
83
|
+
|
|
84
|
+
## Tag conventions (important)
|
|
85
|
+
|
|
86
|
+
Tags do two different jobs in the store, and PAL keeps them separated so the graph stays meaningful:
|
|
87
|
+
|
|
88
|
+
| Tag form | Purpose | Example | Generates graph edges? |
|
|
89
|
+
|---|---|---|---|
|
|
90
|
+
| `topic:<token>` | **Facet** — for filtering / `find` | `topic:ai`, `topic:consulting` | **No** — two entities sharing `topic:ai` do NOT get linked |
|
|
91
|
+
| Unprefixed | **Structural** — for navigation | `acme-labs`, `customer` | Yes — co-occurrence creates tag edges |
|
|
92
|
+
|
|
93
|
+
**Industry inheritance.** When ingest sees a company `industry`, it splits the string on whitespace and `/` and writes `topic:<token>` tags for each piece. When a person is linked to a company, the person inherits **only** the company's `topic:*` tags — never structural ones. This keeps `find ai` useful (it surfaces every AI-industry company + their employees) without creating phantom graph edges between unrelated entities that merely share an industry word.
|
|
94
|
+
|
|
95
|
+
Users can query with or without the prefix — `find ai` and `find topic:ai` are equivalent.
|
|
@@ -4,7 +4,7 @@ description: Personal context management. Use when discussing goals, beliefs, ch
|
|
|
4
4
|
argument-hint: [area to view or update]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Manage the user's TELOS files —
|
|
7
|
+
Manage the user's TELOS files — from Greek τέλος (télos), meaning end/purpose/goal. The persistent personal context that orients PAL around who the user is and what they're working toward.
|
|
8
8
|
|
|
9
9
|
## TELOS Files
|
|
10
10
|
|
|
@@ -38,7 +38,7 @@ Thinking-only. No tool calls except context recovery (Grep/Glob/Read).
|
|
|
38
38
|
**0.5. ISA context** — before reverse engineering, orient against the ISA:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
# If cwd matches a registered project — read its open ISCs:
|
|
41
|
+
# If cwd matches a registered project — read its open ISCs (Ideal State Criteria):
|
|
42
42
|
bun ~/.pal/tools/project.ts list-isc <project-name>
|
|
43
43
|
|
|
44
44
|
# If this is ad-hoc work with no registered project — scaffold a task ISA:
|
|
@@ -82,10 +82,10 @@ Persistent storage across sessions:
|
|
|
82
82
|
- **state/** — Session registry, counts cache, debug logs
|
|
83
83
|
|
|
84
84
|
### Tools (`src/tools/`)
|
|
85
|
-
CLI utilities: `tool:opinion` (manage opinions), `tool:reflect` (relationship reflection), `tool:analyze` (learning analysis), `pal cli usage` (token usage tracking), `
|
|
85
|
+
CLI utilities: `tool:opinion` (manage opinions), `tool:reflect` (relationship reflection), `tool:analyze` (learning analysis), `pal cli usage` (token usage tracking), `pal cli export` / `pal cli import` (state portability).
|
|
86
86
|
|
|
87
87
|
### TELOS (`telos/`)
|
|
88
|
-
|
|
88
|
+
From Greek τέλος (télos) — end, purpose, goal. The persistent personal context that orients PAL around who the user is and what they're working toward: mission, goals, beliefs, challenges, strategies, ideas, learnings, mental models, narratives. Managed via the telos skill.
|
|
89
89
|
|
|
90
90
|
### Security (`SecurityValidator.ts`)
|
|
91
91
|
Hook-based security: validates Bash commands and file operations against dangerous patterns. Fail-open design — blocks known-dangerous operations without breaking legitimate work.
|
|
@@ -41,7 +41,7 @@ AI agents come and go. Your accumulated knowledge, preferences, and workflows sh
|
|
|
41
41
|
**What portability means in practice:**
|
|
42
42
|
- No agent-specific assumptions in core logic
|
|
43
43
|
- Agent-specific code isolated in `src/targets/`
|
|
44
|
-
- Skills, memory, and TELOS are agent-agnostic
|
|
44
|
+
- Skills, memory, and TELOS (Greek: τέλος — end/purpose/goal; the user's persistent life context) are agent-agnostic
|
|
45
45
|
- A single `pal cli install --<agent>` registers everything
|
|
46
46
|
|
|
47
47
|
### 2. Cross-Platform by Default
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# BEGIN PAL MANAGED CODEX RULES
|
|
2
|
+
# Managed by PAL. Install replaces this block; uninstall removes only this block.
|
|
3
|
+
prefix_rule(
|
|
4
|
+
pattern = ["bun", "~/.pal/tools/project.ts"],
|
|
5
|
+
decision = "allow",
|
|
6
|
+
justification = "PAL project state commands are part of the installed PAL workflow",
|
|
7
|
+
match = [
|
|
8
|
+
"bun ~/.pal/tools/project.ts resume portable-agent-layer",
|
|
9
|
+
"bun ~/.pal/tools/project.ts list-isc portable-agent-layer",
|
|
10
|
+
"bun ~/.pal/tools/project.ts add-next portable-agent-layer note",
|
|
11
|
+
],
|
|
12
|
+
not_match = [
|
|
13
|
+
"bun ~/.pal/tools/other.ts",
|
|
14
|
+
],
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
prefix_rule(
|
|
18
|
+
pattern = ["bun", "~/.pal/tools/algorithm-reflect.ts"],
|
|
19
|
+
decision = "allow",
|
|
20
|
+
justification = "PAL Algorithm reflection logging is part of the installed PAL workflow",
|
|
21
|
+
match = [
|
|
22
|
+
"bun ~/.pal/tools/algorithm-reflect.ts --task work --criteria 1 --passed 1 --failed 0 --sentiment 8",
|
|
23
|
+
],
|
|
24
|
+
not_match = [
|
|
25
|
+
"bun ~/.pal/tools/project.ts list",
|
|
26
|
+
],
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
prefix_rule(
|
|
30
|
+
pattern = [
|
|
31
|
+
"bun",
|
|
32
|
+
[
|
|
33
|
+
"~/.pal/tools/analyze.ts",
|
|
34
|
+
"~/.pal/tools/handoff-note.ts",
|
|
35
|
+
"~/.pal/tools/relationship-note.ts",
|
|
36
|
+
"~/.pal/tools/synthesize.ts",
|
|
37
|
+
"~/.pal/tools/thread.ts",
|
|
38
|
+
"~/.pal/tools/wisdom-frame.ts",
|
|
39
|
+
],
|
|
40
|
+
],
|
|
41
|
+
decision = "allow",
|
|
42
|
+
justification = "PAL installed agent tools are safe to run without repeated approval",
|
|
43
|
+
match = [
|
|
44
|
+
"bun ~/.pal/tools/thread.ts --list",
|
|
45
|
+
"bun ~/.pal/tools/wisdom-frame.ts --help",
|
|
46
|
+
],
|
|
47
|
+
not_match = [
|
|
48
|
+
"bun ~/.pal/tools/project.ts list",
|
|
49
|
+
"bun ./local-script.ts",
|
|
50
|
+
],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
prefix_rule(
|
|
54
|
+
pattern = ["node", "--experimental-strip-types", "~/.pal/skills/consulting-report/tools/generate-pdf.ts"],
|
|
55
|
+
decision = "allow",
|
|
56
|
+
justification = "PAL consulting-report PDF generation requires Node for Playwright compatibility",
|
|
57
|
+
match = [
|
|
58
|
+
"node --experimental-strip-types ~/.pal/skills/consulting-report/tools/generate-pdf.ts ./report",
|
|
59
|
+
],
|
|
60
|
+
not_match = [
|
|
61
|
+
"node ~/.pal/skills/consulting-report/tools/generate-pdf.ts ./report",
|
|
62
|
+
],
|
|
63
|
+
)
|
|
64
|
+
# END PAL MANAGED CODEX RULES
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"Bash(stat //*)",
|
|
21
21
|
"Bash(readlink //*)",
|
|
22
22
|
"Bash(bun ~/.pal/skills/*/tools/*.ts *)",
|
|
23
|
-
"Bash(bun ~/.pal/tools/*.ts *)"
|
|
23
|
+
"Bash(bun ~/.pal/tools/*.ts *)",
|
|
24
|
+
"Bash(node --experimental-strip-types ~/.pal/skills/consulting-report/tools/generate-pdf.ts *)"
|
|
24
25
|
]
|
|
25
26
|
},
|
|
26
27
|
"hooks": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "portable-agent-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"src/",
|
|
11
11
|
"assets/",
|
|
12
|
+
".husky/install.mjs",
|
|
12
13
|
"README.md",
|
|
13
14
|
"LICENSE"
|
|
14
15
|
],
|
|
@@ -42,8 +43,7 @@
|
|
|
42
43
|
"check-write": "biome check --write",
|
|
43
44
|
"knip": "knip-bun",
|
|
44
45
|
"klint": "klint",
|
|
45
|
-
"jscpd": "jscpd
|
|
46
|
-
"jscpd:report": "jscpd src --noTips",
|
|
46
|
+
"jscpd": "jscpd --noTips",
|
|
47
47
|
"lint-staged": "lint-staged",
|
|
48
48
|
"prepare": "bun .husky/install.mjs",
|
|
49
49
|
"install:all": "bun run src/cli/index.ts cli install",
|
|
@@ -52,9 +52,7 @@
|
|
|
52
52
|
"tool:thread": "bun run src/tools/agent/thread.ts",
|
|
53
53
|
"tool:analyze": "bun run src/tools/agent/analyze.ts",
|
|
54
54
|
"tool:wisdom-frame": "bun run src/tools/agent/wisdom-frame.ts",
|
|
55
|
-
"tool:reflect": "bun run src/tools/relationship-reflect.ts"
|
|
56
|
-
"tool:export": "bun run src/tools/export.ts",
|
|
57
|
-
"tool:import": "bun run src/tools/import.ts"
|
|
55
|
+
"tool:reflect": "bun run src/tools/relationship-reflect.ts"
|
|
58
56
|
},
|
|
59
57
|
"lint-staged": {
|
|
60
58
|
"*.ts": [
|
|
@@ -62,9 +60,9 @@
|
|
|
62
60
|
]
|
|
63
61
|
},
|
|
64
62
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "2.4.
|
|
66
|
-
"@commitlint/cli": "
|
|
67
|
-
"@commitlint/config-conventional": "
|
|
63
|
+
"@biomejs/biome": "2.4.15",
|
|
64
|
+
"@commitlint/cli": "21.0.1",
|
|
65
|
+
"@commitlint/config-conventional": "21.0.1",
|
|
68
66
|
"@opencode-ai/plugin": "latest",
|
|
69
67
|
"@semantic-release/changelog": "^6.0.3",
|
|
70
68
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -75,15 +73,16 @@
|
|
|
75
73
|
"husky": "^9.1.7",
|
|
76
74
|
"jscpd": "^4.2.3",
|
|
77
75
|
"knip": "^6.14.1",
|
|
78
|
-
"lint-staged": "
|
|
76
|
+
"lint-staged": "17.0.5",
|
|
79
77
|
"semantic-release": "^25.0.3",
|
|
80
78
|
"typescript": "^5.9.3"
|
|
81
79
|
},
|
|
82
80
|
"dependencies": {
|
|
83
81
|
"@clack/prompts": "^1.4.0",
|
|
84
|
-
"@konvert7/klint": "
|
|
82
|
+
"@konvert7/klint": "0.4.0",
|
|
85
83
|
"adm-zip": "^0.5.17",
|
|
86
|
-
"marked": "
|
|
84
|
+
"marked": "18.0.4",
|
|
85
|
+
"pdf-lib": "1.17.1",
|
|
87
86
|
"playwright": "^1.60.0"
|
|
88
87
|
}
|
|
89
88
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -186,6 +186,12 @@ async function runCli(command: string | undefined, args: string[]) {
|
|
|
186
186
|
usage();
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
|
+
case "knowledge": {
|
|
190
|
+
const { runKnowledge } = await import("./knowledge");
|
|
191
|
+
const code = await runKnowledge(args);
|
|
192
|
+
if (code !== 0) process.exit(code);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
189
195
|
case "--help":
|
|
190
196
|
case "-h":
|
|
191
197
|
case "help":
|
|
@@ -226,6 +232,8 @@ function showHelp() {
|
|
|
226
232
|
pal cli doctor [--probe-inference] Check prerequisites and health (--probe fires real inference per route)
|
|
227
233
|
pal cli migrate [--list] [--dry-run] Run pending data migrations
|
|
228
234
|
pal cli usage Summarize token usage and cost
|
|
235
|
+
pal cli knowledge <sub> [args] Query & manage the knowledge store
|
|
236
|
+
(search · graph · stats · hubs · find · show · add · ls)
|
|
229
237
|
|
|
230
238
|
Environment:
|
|
231
239
|
PAL_HOME Override user state directory (default: ~/.pal or repo root)
|