Skip to content

Commit 9368432

Browse files
authored
feat(resilience): add agent immortality foundation [Story 482.1] (#718)
1 parent 96d7f59 commit 9368432

10 files changed

Lines changed: 1252 additions & 10 deletions

File tree

.aiox-core/core/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const healthCheck = require('./health-check');
3939
// External executor delegation
4040
const externalExecutors = require('./external-executors');
4141

42+
// Resilience primitives
43+
const resilience = require('./resilience');
44+
4245
/**
4346
* Core module exports
4447
*/
@@ -88,6 +91,9 @@ module.exports = {
8891
// External executors
8992
externalExecutors,
9093

94+
// Resilience
95+
resilience,
96+
9197
// Version info
9298
version: '2.0.0',
9399
moduleName: 'core',
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# AIOX Resilience
2+
3+
Core resilience modules that preserve agent execution continuity after fatal failures.
4+
5+
## Agent Immortality Protocol
6+
7+
```js
8+
const {
9+
AgentImmortalityProtocol,
10+
CauseOfDeath,
11+
} = require('@aiox-squads/core/resilience');
12+
13+
const protocol = new AgentImmortalityProtocol(process.cwd());
14+
15+
const result = protocol.captureFailure({
16+
agentState: {
17+
id: 'dev-1',
18+
lastGoal: 'Implement story 482.1',
19+
lastSuccessfulStep: 'Created tests',
20+
currentAction: 'retry failing tool call',
21+
workingMemory: ['large history omitted', 'last useful step'],
22+
criticalVariables: { storyId: '482.1' },
23+
},
24+
error: new Error('Tool execution failed: invalid schema'),
25+
});
26+
27+
console.log(result.reincarnationContext);
28+
console.log(result.report.cause === CauseOfDeath.TOOL_EXECUTION_FAILURE);
29+
```
30+
31+
The protocol records:
32+
33+
- a compact autopsy report, without rehydrating the full failed context;
34+
- a reincarnation queue item with prevention directives;
35+
- a delta state commit that can be replayed later;
36+
- an evolution event for repeated failure-pattern analysis.
37+
38+
Storage defaults to `.aiox/immortality/` inside the project root.

0 commit comments

Comments
 (0)