incitaciones 0.3.1 → 0.4.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/content/distilled/agent-value-alignment/SKILL.md +63 -0
- package/content/distilled/agent-value-alignment/references/examples.md +46 -0
- package/content/distilled/agent-value-alignment/references/integration.md +73 -0
- package/content/distilled/agent-value-alignment/references/layer-1-value.md +62 -0
- package/content/distilled/agent-value-alignment/references/layer-2-governance.md +74 -0
- package/content/distilled/agent-value-alignment/references/layer-3-runtime-prompt.md +68 -0
- package/content/distilled/agent-value-alignment/references/layer-4-infrastructure.md +58 -0
- package/content/distilled/agent-value-alignment/references/report-template.md +113 -0
- package/content/manifest.json +207 -1
- package/package.json +1 -1
- package/pi-package/prompts/agent-value-alignment.md +10 -0
- package/pi-package/skills/agent-value-alignment/SKILL.md +69 -0
- package/pi-package/skills/agent-value-alignment/references/examples.md +46 -0
- package/pi-package/skills/agent-value-alignment/references/integration.md +73 -0
- package/pi-package/skills/agent-value-alignment/references/layer-1-value.md +62 -0
- package/pi-package/skills/agent-value-alignment/references/layer-2-governance.md +74 -0
- package/pi-package/skills/agent-value-alignment/references/layer-3-runtime-prompt.md +68 -0
- package/pi-package/skills/agent-value-alignment/references/layer-4-infrastructure.md +58 -0
- package/pi-package/skills/agent-value-alignment/references/report-template.md +113 -0
- package/scripts/generate-pi-resources.mjs +122 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Layer 4 — Infrastructure: State, Memory, and Observability
|
|
2
|
+
|
|
3
|
+
**Question:** How is state preserved, memory managed, and drift observed in production?
|
|
4
|
+
|
|
5
|
+
## Checkpointing: fault tolerance vs. alignment
|
|
6
|
+
|
|
7
|
+
- **Fault-tolerant checkpointing** asks: "can we resume after a crash?"
|
|
8
|
+
- **Alignment-oriented checkpointing** asks: "is the agent still pursuing the right goal, and can we roll back to a known-good state if it has drifted?"
|
|
9
|
+
|
|
10
|
+
The latter requires **goal-state verification at each checkpoint**, not just state persistence.
|
|
11
|
+
|
|
12
|
+
**LangGraph** (1.0 GA, Oct 2025) is the most mature production option: checkpoints at every super-step, pluggable backends (`PostgresSaver` for production), first-class `interrupt()` API for HITL resumable via `Command(resume=...)`, time-travel debugging, state mutation. Powers agents at ~400 companies (LinkedIn, Uber, Replit) with 8% latency overhead. **MemGPT/Letta** provides OS-inspired tiered memory (main context / recall DB / archival vector store) with LLM-managed tier movement.
|
|
13
|
+
|
|
14
|
+
Caveat: OpenAI Agents SDK and AutoGen lack native durable execution — teams must add Temporal/DBOS. Google ADK loses in-memory session state on Cloud Run restarts. Configure persistent storage from day one; retrofitting is significantly harder.
|
|
15
|
+
|
|
16
|
+
## Memory architecture as a first-class concern
|
|
17
|
+
|
|
18
|
+
"Memory deserves the same level of engineering investment as the LLM itself" (Du, 2026). Three dimensions:
|
|
19
|
+
|
|
20
|
+
- **Temporal scope** — working (subject to lost-in-the-middle), episodic (concrete experience records), semantic (abstracted knowledge; over-generalization risk), procedural (reusable skills; Voyager without its skill library showed 15.3× slower progression).
|
|
21
|
+
- **Representational substrate** — context-resident text (compression drift), vector stores, structured stores, executable repositories.
|
|
22
|
+
- **Control policy** — heuristic, prompted self-control (MemGPT; silent orchestration failure risk), learned/RL (e.g., AgeMem, per Du 2026; most capable, requires training infra).
|
|
23
|
+
|
|
24
|
+
Empirical stakes: Generative Agents without reflection degenerated to repetitive responses within 48 simulated hours; on MemoryArena (2026), active memory agents achieved 80%+ task completion vs. ~45% for long-context-only baselines. Models near-saturating LoCoMo plummet to 40–60% on MemoryArena — a deep gap between passive recall and active, decision-relevant memory.
|
|
25
|
+
|
|
26
|
+
## Safe stopping, rollback, and HITL
|
|
27
|
+
|
|
28
|
+
Safe stopping criteria (distinct from error conditions): uncertainty threshold, scope boundary, resource limit, anomaly detection, human review trigger. LangGraph's `interrupt()` provides the mechanism; the *design* challenge is choosing when to pause, what to surface, and how to incorporate feedback: approve / modify / rollback-and-retry / abort.
|
|
29
|
+
|
|
30
|
+
**Cost calculus favors false positives:** unnecessary human reviews are far cheaper than undetected goal drift leading to irreversible actions. Configure HITL at all irreversible action boundaries.
|
|
31
|
+
|
|
32
|
+
## Observability for drift detection
|
|
33
|
+
|
|
34
|
+
**Quantitative signals:** task completion rate, goal retention score, scope violation rate, rollback rate, HITL trigger rate, token efficiency (useful work / total tokens — flags unproductive spinning).
|
|
35
|
+
|
|
36
|
+
**Qualitative signals:** execution traces, reasoning traces, state snapshots, anomaly detection.
|
|
37
|
+
|
|
38
|
+
**Decay detection dashboard** tiers these into:
|
|
39
|
+
- Behavioral health (weekly) — eval pass rate, goal achievement, scope violations, escalations, errors.
|
|
40
|
+
- Adoption health (weekly) — WAU, tasks/user, retention, satisfaction.
|
|
41
|
+
- Value health (monthly) — primary value metric, cost/task, cost/user.
|
|
42
|
+
|
|
43
|
+
**Automatic review triggers:** eval pass rate drops >10% week-over-week; any red metric persists 2+ weeks; model or prompt change deployed (re-run full eval suite).
|
|
44
|
+
|
|
45
|
+
## AUDIT checks
|
|
46
|
+
|
|
47
|
+
- [ ] Checkpointing is alignment-oriented (goal-state verification, not just resume).
|
|
48
|
+
- [ ] Persistent backend configured from day one (not in-memory in production).
|
|
49
|
+
- [ ] Memory architecture is a deliberate choice across all three dimensions, not an afterthought.
|
|
50
|
+
- [ ] HITL interrupts configured at all irreversible action boundaries.
|
|
51
|
+
- [ ] Tracing/observability deployed before production (LangSmith or equivalent).
|
|
52
|
+
- [ ] Decay detection dashboard exists with the three tiers and automatic triggers.
|
|
53
|
+
- [ ] Full eval suite re-runs on every model/prompt change.
|
|
54
|
+
|
|
55
|
+
## ESTABLISH (Day 5)
|
|
56
|
+
|
|
57
|
+
- Day 5a (30 min): Schedule the first Value Realization Review for 90 days out.
|
|
58
|
+
- Day 5b (30 min – ½ day): Stand up the decay detection dashboard. *30 min only if metrics are already instrumented; up to half a day if instrumentation must be built.* Do not skip — without it, drift cannot be detected before lagging outcome metrics confirm it.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Agent Value Alignment — Report Template
|
|
2
|
+
|
|
3
|
+
Use this for both AUDIT and ESTABLISH modes. Replace `[ ]` placeholders.
|
|
4
|
+
|
|
5
|
+
## Severity rubric
|
|
6
|
+
|
|
7
|
+
Apply consistently to every finding so two auditors rate the same gap alike:
|
|
8
|
+
|
|
9
|
+
| Severity | Definition |
|
|
10
|
+
|---|---|
|
|
11
|
+
| **CRITICAL** | Breaks the governing invariant (an unenforced decision / unverified clause / unacted eval result) **or** leaves an irreversible-action boundary unguarded (no HITL, no rollback) |
|
|
12
|
+
| **HIGH** | A Layer-1 or Layer-2 artifact is missing, unfalsifiable, or unsigned (e.g., no kill criteria, no BSD, vague VP) — the loop cannot close without it |
|
|
13
|
+
| **MEDIUM** | An AUDIT check fails but a compensating control exists (e.g., eval suite present but golden dataset lacks failure-class examples) |
|
|
14
|
+
| **LOW** | Cadence or documentation gap (e.g., Value Realization Review not yet scheduled, dashboard not yet live) |
|
|
15
|
+
|
|
16
|
+
A layer is 🔴 if it has ≥1 CRITICAL finding; 🟡 if it has ≥1 HIGH/MEDIUM but no CRITICAL; 🟢 if all AUDIT checks pass.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Agent Value Alignment Report
|
|
21
|
+
|
|
22
|
+
**Target:** [agent/tool name and version]
|
|
23
|
+
**Mode:** [AUDIT | ESTABLISH]
|
|
24
|
+
**Date:** [YYYY-MM-DD]
|
|
25
|
+
**Reviewer:** [name/role]
|
|
26
|
+
**Sources consulted:** [system prompt, BSD, eval suite, dashboard, etc.]
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### Executive Summary
|
|
31
|
+
|
|
32
|
+
[2–4 sentences. State the single most important finding: is the closed loop intact, and if not, where is it broken?]
|
|
33
|
+
|
|
34
|
+
**Overall verdict:** [ALIGNED | PARTIAL | NOT_ALIGNED]
|
|
35
|
+
|
|
36
|
+
### Layer Scores
|
|
37
|
+
|
|
38
|
+
| Layer | Status | Critical gaps |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| 1 — Value | [🟢/🟡/🔴] | [count] |
|
|
41
|
+
| 2 — Governance | [🟢/🟡/🔴] | [count] |
|
|
42
|
+
| 3 — Runtime Prompt | [🟢/🟡/🔴] | [count] |
|
|
43
|
+
| 4 — Infrastructure | [🟢/🟡/🔴] | [count] |
|
|
44
|
+
| Integration | [🟢/🟡/🔴] | [count] |
|
|
45
|
+
|
|
46
|
+
Status: 🟢 all AUDIT checks pass · 🟡 ≥1 check fails, no critical · 🔴 ≥1 critical gap.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### Findings
|
|
51
|
+
|
|
52
|
+
#### [LAYER-N-FINDING-001] [CRITICAL|HIGH|MEDIUM|LOW] — [Location]
|
|
53
|
+
- **Layer:** [1 Value | 2 Governance | 3 Runtime | 4 Infra | Integration]
|
|
54
|
+
- **What's wrong:** [specific gap, citing the artifact and location]
|
|
55
|
+
- **Why it matters:** [which root cause or failure mode this enables]
|
|
56
|
+
- **Recommendation:** [specific action — which artifact to create/change, by whom]
|
|
57
|
+
- **Invariant violated:** [enforcement | verification | action] (if applicable)
|
|
58
|
+
|
|
59
|
+
[repeat for each finding]
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### Invariant Check
|
|
64
|
+
|
|
65
|
+
The governing invariant: *every governance decision → prompt clause → eval test → governance review*.
|
|
66
|
+
|
|
67
|
+
- Decisions with no prompt clause (not enforced): [list, or "none"]
|
|
68
|
+
- Prompt clauses with no eval test (not verified): [list, or "none"]
|
|
69
|
+
- Eval results not reviewed in governance (not acted upon): [list, or "none"]
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Value Proposition (as currently stated)
|
|
74
|
+
|
|
75
|
+
> "[verbatim current VP, or 'NOT DEFINED']"
|
|
76
|
+
|
|
77
|
+
**Falsifiable?** [Yes/No — which slot is missing]
|
|
78
|
+
**Propagated verbatim across prompt + BSD + review agenda?** [Yes/No]
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Kill Criteria Status
|
|
83
|
+
|
|
84
|
+
[Cite each criterion, its threshold, the current value, and status: on-track / at-risk / triggered. Or "NOT DEFINED".]
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### Recommended Actions (priority order)
|
|
89
|
+
|
|
90
|
+
1. [Action] — Owner: [role] — Layer: [N] — Due: [date]
|
|
91
|
+
2. [Action] — Owner: [role] — Layer: [N] — Due: [date]
|
|
92
|
+
3. [Action] — Owner: [role] — Layer: [N] — Due: [date]
|
|
93
|
+
|
|
94
|
+
### Next Review
|
|
95
|
+
|
|
96
|
+
**Value Realization Review scheduled:** [date, or "NOT SCHEDULED — schedule within 90 days"]
|
|
97
|
+
**Decay dashboard live:** [Yes/No]
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### For ESTABLISH mode only: Minimum Viable Artifact Set
|
|
102
|
+
|
|
103
|
+
| Artifact | Status | Location |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| Falsifiable Value Proposition | [Done/In progress/Not started] | [path] |
|
|
106
|
+
| Kill Criteria (signed) | | |
|
|
107
|
+
| Agent Charter | | |
|
|
108
|
+
| Goal Sandwich system prompt | | |
|
|
109
|
+
| 10 eval test cases | | |
|
|
110
|
+
| Value Realization Review scheduled | | |
|
|
111
|
+
| Decay detection dashboard | | |
|
|
112
|
+
|
|
113
|
+
*Do not consider the loop closed until every artifact above is "Done" AND the invariant check shows zero unenforced/unverified/unacted items.*
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import process from "node:process";
|
|
5
7
|
|
|
6
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
9
|
const __dirname = path.dirname(__filename);
|
|
@@ -32,6 +34,15 @@ function readText(filePath) {
|
|
|
32
34
|
return fs.readFileSync(filePath, "utf8");
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
function getPackageVersion() {
|
|
38
|
+
try {
|
|
39
|
+
const pkg = JSON.parse(readText(path.join(repoRoot, "package.json")));
|
|
40
|
+
return `npm:${pkg.version}`;
|
|
41
|
+
} catch {
|
|
42
|
+
return new Date().toISOString().slice(0, 10);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
function generateSkill(prompt) {
|
|
36
47
|
const distilledPath = path.join(repoRoot, prompt.distilled);
|
|
37
48
|
const skillDir = path.join(skillsOut, prompt.name);
|
|
@@ -83,6 +94,113 @@ function generatePromptTemplate(prompt) {
|
|
|
83
94
|
fs.writeFileSync(path.join(promptsOut, `${prompt.name}.md`), template, "utf8");
|
|
84
95
|
}
|
|
85
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Detect flat-skills directories that already have incitaciones skills installed,
|
|
99
|
+
* and re-sync them with the latest pi-package content. This ensures that
|
|
100
|
+
* pi update / npm version bumps keep flat-install locations current.
|
|
101
|
+
*
|
|
102
|
+
* Flat installs (e.g. ~/.agents/skills/) are created by install.sh and
|
|
103
|
+
* npx incitaciones install, but are NOT managed by pi's package reader
|
|
104
|
+
* (which reads directly from pi-package/skills/). Without this re-sync,
|
|
105
|
+
* a version bump leaves those directories stale.
|
|
106
|
+
*/
|
|
107
|
+
function reSyncFlatInstallSkills(manifest) {
|
|
108
|
+
const version = getPackageVersion();
|
|
109
|
+
const now = new Date().toISOString().replace("Z", "000Z");
|
|
110
|
+
const home = homedir();
|
|
111
|
+
|
|
112
|
+
// Candidate directories to check for incitaciones flat installs
|
|
113
|
+
const candidates = [
|
|
114
|
+
path.join(home, ".agents", "skills"),
|
|
115
|
+
path.join(home, ".config", "agents", "skills"),
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
// Also check .agents/skills in cwd for project-local installs
|
|
119
|
+
try {
|
|
120
|
+
candidates.push(path.join(process.cwd(), ".agents", "skills"));
|
|
121
|
+
} catch {}
|
|
122
|
+
|
|
123
|
+
// Deduplicate
|
|
124
|
+
const checked = new Set();
|
|
125
|
+
const dirs = candidates.filter((d) => {
|
|
126
|
+
if (checked.has(d)) return false;
|
|
127
|
+
checked.add(d);
|
|
128
|
+
return fs.existsSync(d);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
let synced = 0;
|
|
132
|
+
for (const dir of dirs) {
|
|
133
|
+
// Check if this directory has incitaciones-installed skills
|
|
134
|
+
// by reading the first SKILL.md we find and checking its frontmatter
|
|
135
|
+
let hasIncitaciones = false;
|
|
136
|
+
try {
|
|
137
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
138
|
+
if (!entry.isDirectory()) continue;
|
|
139
|
+
const skillFile = path.join(dir, entry.name, "SKILL.md");
|
|
140
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
141
|
+
const content = fs.readFileSync(skillFile, "utf8");
|
|
142
|
+
if (content.includes("installed-from: incitaciones") || content.includes("installed-from: \"incitaciones\"")) {
|
|
143
|
+
hasIncitaciones = true;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
// Permission issues, etc. — skip
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!hasIncitaciones) continue;
|
|
153
|
+
|
|
154
|
+
// Re-sync: for each prompt in manifest, copy from pi-package/skills/ to flat dir
|
|
155
|
+
for (const prompt of manifest.prompts) {
|
|
156
|
+
const srcDir = path.join(skillsOut, prompt.name);
|
|
157
|
+
if (!fs.existsSync(srcDir)) continue;
|
|
158
|
+
|
|
159
|
+
const dstDir = path.join(dir, prompt.name);
|
|
160
|
+
fs.rmSync(dstDir, { recursive: true, force: true });
|
|
161
|
+
fs.mkdirSync(dstDir, { recursive: true });
|
|
162
|
+
|
|
163
|
+
// Generate flat-format frontmatter for SKILL.md
|
|
164
|
+
const distilledPath = path.join(repoRoot, prompt.distilled);
|
|
165
|
+
if (!fs.existsSync(distilledPath)) continue;
|
|
166
|
+
|
|
167
|
+
const description = escapeYamlDoubleQuoted(prompt.description || `Incitaciones prompt: ${prompt.name}`);
|
|
168
|
+
const frontmatter = [
|
|
169
|
+
"---",
|
|
170
|
+
`name: ${prompt.name}`,
|
|
171
|
+
`description: "${description}"`,
|
|
172
|
+
"installed-from: incitaciones",
|
|
173
|
+
`installed-version: "${version}"`,
|
|
174
|
+
`installed-at: "${now}"`,
|
|
175
|
+
"---",
|
|
176
|
+
"",
|
|
177
|
+
].join("\n");
|
|
178
|
+
|
|
179
|
+
fs.writeFileSync(path.join(dstDir, "SKILL.md"), frontmatter + readText(distilledPath), "utf8");
|
|
180
|
+
|
|
181
|
+
// Copy references/ from the source skill directory
|
|
182
|
+
if (distilledPath.endsWith(`${path.sep}SKILL.md`)) {
|
|
183
|
+
const srcRefDir = path.dirname(distilledPath);
|
|
184
|
+
for (const entry of fs.readdirSync(srcRefDir, { withFileTypes: true })) {
|
|
185
|
+
if (entry.name === "SKILL.md") continue;
|
|
186
|
+
const s = path.join(srcRefDir, entry.name);
|
|
187
|
+
const d = path.join(dstDir, entry.name);
|
|
188
|
+
if (entry.isDirectory()) {
|
|
189
|
+
fs.cpSync(s, d, { recursive: true });
|
|
190
|
+
} else {
|
|
191
|
+
fs.copyFileSync(s, d);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
synced++;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (synced > 0) {
|
|
200
|
+
console.log(`Re-synced incitaciones skills in ${synced} flat-install director(ies)`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
86
204
|
function main() {
|
|
87
205
|
const manifest = JSON.parse(readText(manifestPath));
|
|
88
206
|
resetDir(outRoot);
|
|
@@ -117,6 +235,9 @@ function main() {
|
|
|
117
235
|
fs.writeFileSync(path.join(outRoot, "README.md"), readme, "utf8");
|
|
118
236
|
|
|
119
237
|
console.log(`Generated pi resources for ${manifest.prompts.length} prompts in ${path.relative(repoRoot, outRoot)}/`);
|
|
238
|
+
|
|
239
|
+
// Re-sync any existing flat-install skill directories (e.g. ~/.agents/skills/)
|
|
240
|
+
reSyncFlatInstallSkills(manifest);
|
|
120
241
|
}
|
|
121
242
|
|
|
122
|
-
main();
|
|
243
|
+
main();
|