medicine-wheel-fire-keeper 0.1.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 +70 -0
- package/dist/ceremony-state.d.ts +63 -0
- package/dist/ceremony-state.d.ts.map +1 -0
- package/dist/ceremony-state.js +161 -0
- package/dist/ceremony-state.js.map +1 -0
- package/dist/check-back.d.ts +43 -0
- package/dist/check-back.d.ts.map +1 -0
- package/dist/check-back.js +138 -0
- package/dist/check-back.js.map +1 -0
- package/dist/decisions.d.ts +61 -0
- package/dist/decisions.d.ts.map +1 -0
- package/dist/decisions.js +111 -0
- package/dist/decisions.js.map +1 -0
- package/dist/gating.d.ts +55 -0
- package/dist/gating.d.ts.map +1 -0
- package/dist/gating.js +88 -0
- package/dist/gating.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/keeper.d.ts +85 -0
- package/dist/keeper.d.ts.map +1 -0
- package/dist/keeper.js +245 -0
- package/dist/keeper.js.map +1 -0
- package/dist/messages.d.ts +166 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +10 -0
- package/dist/messages.js.map +1 -0
- package/dist/trajectory.d.ts +45 -0
- package/dist/trajectory.d.ts.map +1 -0
- package/dist/trajectory.js +85 -0
- package/dist/trajectory.js.map +1 -0
- package/dist/types.d.ts +161 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# medicine-wheel-fire-keeper
|
|
2
|
+
|
|
3
|
+
> The Fire Keeper — ceremony coordination agent for Medicine Wheel
|
|
4
|
+
|
|
5
|
+
The Fire Keeper tends the ceremony fire, ensures relational integrity through gating conditions, and maintains Wilson alignment as an active agent — not a passive metric.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Wilson's ceremony requires a keeper. Without one, ceremony degrades into process. The Fire Keeper embodies relational accountability as an active agent that:
|
|
10
|
+
|
|
11
|
+
- **Evaluates** incoming ImportanceUnits against gating conditions
|
|
12
|
+
- **Gates** work through relational check-back protocol
|
|
13
|
+
- **Tracks** extended ceremony phases (gathering → kindling → tending → harvesting → resting)
|
|
14
|
+
- **Escalates** to human decision-makers at defined decision points
|
|
15
|
+
- **Issues** stop-work orders when relational accountability is violated
|
|
16
|
+
|
|
17
|
+
## Key Modules
|
|
18
|
+
|
|
19
|
+
| Module | Purpose |
|
|
20
|
+
|--------|---------|
|
|
21
|
+
| `keeper.ts` | FireKeeper class — core coordination engine |
|
|
22
|
+
| `gating.ts` | Gate evaluation and default gates (Wilson, OCAP, ceremony phase) |
|
|
23
|
+
| `decisions.ts` | Human-in-the-loop decision detection and permission escalation |
|
|
24
|
+
| `check-back.ts` | Four-step relational check-back protocol |
|
|
25
|
+
| `ceremony-state.ts` | Extended ceremony state management |
|
|
26
|
+
| `trajectory.ts` | Trajectory confidence and value divergence detection |
|
|
27
|
+
| `messages.ts` | A2A message type definitions |
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import {
|
|
33
|
+
FireKeeper,
|
|
34
|
+
DEFAULT_GATES,
|
|
35
|
+
type FireKeeperConfig,
|
|
36
|
+
} from 'medicine-wheel-fire-keeper';
|
|
37
|
+
|
|
38
|
+
const config: FireKeeperConfig = {
|
|
39
|
+
trajectoryThreshold: 0.65,
|
|
40
|
+
permissionTiers: ['observe', 'analyze', 'propose', 'act'],
|
|
41
|
+
gatingConditions: DEFAULT_GATES,
|
|
42
|
+
humanDecisionPoints: [],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const keeper = new FireKeeper(config);
|
|
46
|
+
const ceremony = keeper.beginCeremony('inquiry::my-research');
|
|
47
|
+
const result = keeper.evaluateImportance({ id: 'unit-1', title: 'Vision' }, 'inquiry::my-research');
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Permission Tiers
|
|
51
|
+
|
|
52
|
+
| Tier | Scope | Human Required |
|
|
53
|
+
|------|-------|---------------|
|
|
54
|
+
| 🟢 observe | Read files, gather context | No |
|
|
55
|
+
| 🟡 analyze | Produce analysis, create ImportanceUnits | No |
|
|
56
|
+
| 🟠 propose | Draft artifacts, suggest schemas | No (Fire Keeper reviews) |
|
|
57
|
+
| 🔴 act | Generate code, create commits | **Yes** |
|
|
58
|
+
|
|
59
|
+
## Relational Check-Back Protocol
|
|
60
|
+
|
|
61
|
+
Before any autonomous action, the Fire Keeper verifies:
|
|
62
|
+
|
|
63
|
+
1. **Does this action honor existing relations?**
|
|
64
|
+
2. **Does it strengthen the Spirit-Body relationship?**
|
|
65
|
+
3. **Is it accountable to all four directions?**
|
|
66
|
+
4. **Would an Elder approve?**
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MIT
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* medicine-wheel-fire-keeper — Extended Ceremony State Management
|
|
3
|
+
*
|
|
4
|
+
* Manages the full lifecycle of ceremony state with extended phases:
|
|
5
|
+
* gathering → kindling → tending → harvesting → resting.
|
|
6
|
+
* Tracks quadrant status and detects completion readiness.
|
|
7
|
+
*/
|
|
8
|
+
import type { DirectionName } from 'medicine-wheel-ontology-core';
|
|
9
|
+
import type { CeremonyPhaseExtended, CeremonyStateExtended, QuadrantStatus } from './types.js';
|
|
10
|
+
/** Manages extended ceremony state transitions and quadrant tracking */
|
|
11
|
+
export declare class CeremonyStateManager {
|
|
12
|
+
private state;
|
|
13
|
+
constructor(state: CeremonyStateExtended);
|
|
14
|
+
/** Get the current ceremony state (immutable copy) */
|
|
15
|
+
getState(): CeremonyStateExtended;
|
|
16
|
+
/**
|
|
17
|
+
* Transition to the next ceremony phase with validation.
|
|
18
|
+
* Phases must proceed in order: gathering → kindling → tending → harvesting → resting.
|
|
19
|
+
* @returns The new phase, or null if transition is invalid
|
|
20
|
+
*/
|
|
21
|
+
transitionPhase(): CeremonyPhaseExtended | null;
|
|
22
|
+
/**
|
|
23
|
+
* Update the status of a quadrant.
|
|
24
|
+
* @param direction - The direction to update
|
|
25
|
+
* @param updates - Partial quadrant status updates
|
|
26
|
+
*/
|
|
27
|
+
updateQuadrant(direction: DirectionName, updates: Partial<QuadrantStatus>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a relational circle is complete — all four quadrants visited.
|
|
30
|
+
* A quadrant counts as visited when its status is 'visited' or 'complete'
|
|
31
|
+
* and its deepest circle depth is >= 1.
|
|
32
|
+
*/
|
|
33
|
+
checkCircleComplete(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Detect whether the ceremony is ready to transition to the next phase.
|
|
36
|
+
* Evaluates gating conditions, quadrant coverage, and trajectory health.
|
|
37
|
+
*/
|
|
38
|
+
detectCompletionReadiness(): CompletionReadiness;
|
|
39
|
+
private validateTransition;
|
|
40
|
+
private computeCurrentConfidence;
|
|
41
|
+
}
|
|
42
|
+
/** Assessment of ceremony completion readiness */
|
|
43
|
+
export interface CompletionReadiness {
|
|
44
|
+
/** Whether the ceremony is ready to advance */
|
|
45
|
+
ready: boolean;
|
|
46
|
+
/** Whether a full relational circle has been completed */
|
|
47
|
+
circleComplete: boolean;
|
|
48
|
+
/** Whether all gating conditions are satisfied */
|
|
49
|
+
gatesOk: boolean;
|
|
50
|
+
/** Whether trajectory confidence is acceptable */
|
|
51
|
+
trajectoryOk: boolean;
|
|
52
|
+
/** Whether all relational milestones are complete */
|
|
53
|
+
milestonesComplete: boolean;
|
|
54
|
+
/** List of blocking reasons */
|
|
55
|
+
blockers: string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a fresh extended ceremony state for a new inquiry.
|
|
59
|
+
* @param inquiryRef - Reference to the inquiry
|
|
60
|
+
* @param startDirection - Initial direction (default: east)
|
|
61
|
+
*/
|
|
62
|
+
export declare function createCeremonyState(inquiryRef: string, startDirection?: DirectionName): CeremonyStateExtended;
|
|
63
|
+
//# sourceMappingURL=ceremony-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceremony-state.d.ts","sourceRoot":"","sources":["../src/ceremony-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EAEf,MAAM,YAAY,CAAC;AAcpB,wEAAwE;AACxE,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAwB;gBAEzB,KAAK,EAAE,qBAAqB;IAIxC,sDAAsD;IACtD,QAAQ,IAAI,qBAAqB;IAIjC;;;;OAIG;IACH,eAAe,IAAI,qBAAqB,GAAG,IAAI;IAuB/C;;;;OAIG;IACH,cAAc,CACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,IAAI;IASP;;;;OAIG;IACH,mBAAmB,IAAI,OAAO;IAW9B;;;OAGG;IACH,yBAAyB,IAAI,mBAAmB;IA4BhD,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,wBAAwB;CAKjC;AAID,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,KAAK,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,cAAc,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,YAAY,EAAE,OAAO,CAAC;IACtB,qDAAqD;IACrD,kBAAkB,EAAE,OAAO,CAAC;IAC5B,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,cAAc,GAAE,aAAsB,GACrC,qBAAqB,CAsBvB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* medicine-wheel-fire-keeper — Extended Ceremony State Management
|
|
4
|
+
*
|
|
5
|
+
* Manages the full lifecycle of ceremony state with extended phases:
|
|
6
|
+
* gathering → kindling → tending → harvesting → resting.
|
|
7
|
+
* Tracks quadrant status and detects completion readiness.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CeremonyStateManager = void 0;
|
|
11
|
+
exports.createCeremonyState = createCeremonyState;
|
|
12
|
+
// ── Phase Order ─────────────────────────────────────────────────────────────
|
|
13
|
+
const EXTENDED_PHASE_ORDER = [
|
|
14
|
+
'gathering',
|
|
15
|
+
'kindling',
|
|
16
|
+
'tending',
|
|
17
|
+
'harvesting',
|
|
18
|
+
'resting',
|
|
19
|
+
];
|
|
20
|
+
// ── Ceremony State Manager ──────────────────────────────────────────────────
|
|
21
|
+
/** Manages extended ceremony state transitions and quadrant tracking */
|
|
22
|
+
class CeremonyStateManager {
|
|
23
|
+
state;
|
|
24
|
+
constructor(state) {
|
|
25
|
+
this.state = { ...state };
|
|
26
|
+
}
|
|
27
|
+
/** Get the current ceremony state (immutable copy) */
|
|
28
|
+
getState() {
|
|
29
|
+
return { ...this.state };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Transition to the next ceremony phase with validation.
|
|
33
|
+
* Phases must proceed in order: gathering → kindling → tending → harvesting → resting.
|
|
34
|
+
* @returns The new phase, or null if transition is invalid
|
|
35
|
+
*/
|
|
36
|
+
transitionPhase() {
|
|
37
|
+
const currentIdx = EXTENDED_PHASE_ORDER.indexOf(this.state.ceremonyPhase);
|
|
38
|
+
if (currentIdx < 0 || currentIdx >= EXTENDED_PHASE_ORDER.length - 1) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (!this.validateTransition(this.state.ceremonyPhase)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const nextPhase = EXTENDED_PHASE_ORDER[currentIdx + 1];
|
|
45
|
+
this.state.ceremonyPhase = nextPhase;
|
|
46
|
+
this.state.trajectoryHistory.push({
|
|
47
|
+
timestamp: new Date().toISOString(),
|
|
48
|
+
confidence: this.computeCurrentConfidence(),
|
|
49
|
+
direction: this.state.activeDirection,
|
|
50
|
+
note: `Phase transition: ${EXTENDED_PHASE_ORDER[currentIdx]} → ${nextPhase}`,
|
|
51
|
+
});
|
|
52
|
+
return nextPhase;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Update the status of a quadrant.
|
|
56
|
+
* @param direction - The direction to update
|
|
57
|
+
* @param updates - Partial quadrant status updates
|
|
58
|
+
*/
|
|
59
|
+
updateQuadrant(direction, updates) {
|
|
60
|
+
const current = this.state.quadrantState[direction];
|
|
61
|
+
this.state.quadrantState[direction] = { ...current, ...updates };
|
|
62
|
+
if (updates.status === 'active') {
|
|
63
|
+
this.state.activeDirection = direction;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if a relational circle is complete — all four quadrants visited.
|
|
68
|
+
* A quadrant counts as visited when its status is 'visited' or 'complete'
|
|
69
|
+
* and its deepest circle depth is >= 1.
|
|
70
|
+
*/
|
|
71
|
+
checkCircleComplete() {
|
|
72
|
+
const directions = ['east', 'south', 'west', 'north'];
|
|
73
|
+
return directions.every((d) => {
|
|
74
|
+
const q = this.state.quadrantState[d];
|
|
75
|
+
return ((q.status === 'visited' || q.status === 'complete' || q.status === 'active') &&
|
|
76
|
+
q.deepestCircle >= 1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Detect whether the ceremony is ready to transition to the next phase.
|
|
81
|
+
* Evaluates gating conditions, quadrant coverage, and trajectory health.
|
|
82
|
+
*/
|
|
83
|
+
detectCompletionReadiness() {
|
|
84
|
+
const gatesOk = this.state.gatingConditions.every((g) => g.satisfied);
|
|
85
|
+
const circleComplete = this.checkCircleComplete();
|
|
86
|
+
const trajectoryOk = this.computeCurrentConfidence() >= 0.65;
|
|
87
|
+
const milestonesComplete = this.state.relationalMilestones.every((m) => m.complete);
|
|
88
|
+
const ready = gatesOk && trajectoryOk;
|
|
89
|
+
const reasons = [];
|
|
90
|
+
if (!gatesOk)
|
|
91
|
+
reasons.push('Not all gating conditions satisfied');
|
|
92
|
+
if (!circleComplete)
|
|
93
|
+
reasons.push('Relational circle not complete');
|
|
94
|
+
if (!trajectoryOk)
|
|
95
|
+
reasons.push('Trajectory confidence below threshold');
|
|
96
|
+
if (!milestonesComplete)
|
|
97
|
+
reasons.push('Relational milestones incomplete');
|
|
98
|
+
return {
|
|
99
|
+
ready,
|
|
100
|
+
circleComplete,
|
|
101
|
+
gatesOk,
|
|
102
|
+
trajectoryOk,
|
|
103
|
+
milestonesComplete,
|
|
104
|
+
blockers: reasons,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// ── Private Helpers ─────────────────────────────────────────────────────
|
|
108
|
+
validateTransition(currentPhase) {
|
|
109
|
+
switch (currentPhase) {
|
|
110
|
+
case 'gathering':
|
|
111
|
+
// Foundational gating conditions must be satisfied
|
|
112
|
+
return this.state.gatingConditions.some((g) => g.satisfied);
|
|
113
|
+
case 'kindling':
|
|
114
|
+
// Vision units must have some depth
|
|
115
|
+
return this.state.quadrantState.east.deepestCircle >= 1;
|
|
116
|
+
case 'tending':
|
|
117
|
+
// Active work being refined
|
|
118
|
+
return this.computeCurrentConfidence() >= 0.5;
|
|
119
|
+
case 'harvesting':
|
|
120
|
+
// Key units should have completed circles
|
|
121
|
+
return this.checkCircleComplete() || this.computeCurrentConfidence() >= 0.7;
|
|
122
|
+
default:
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
computeCurrentConfidence() {
|
|
127
|
+
const history = this.state.trajectoryHistory;
|
|
128
|
+
if (history.length === 0)
|
|
129
|
+
return 0.5;
|
|
130
|
+
return history[history.length - 1].confidence;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.CeremonyStateManager = CeremonyStateManager;
|
|
134
|
+
/**
|
|
135
|
+
* Create a fresh extended ceremony state for a new inquiry.
|
|
136
|
+
* @param inquiryRef - Reference to the inquiry
|
|
137
|
+
* @param startDirection - Initial direction (default: east)
|
|
138
|
+
*/
|
|
139
|
+
function createCeremonyState(inquiryRef, startDirection = 'east') {
|
|
140
|
+
const emptyQuadrant = {
|
|
141
|
+
status: 'pending',
|
|
142
|
+
unitCount: 0,
|
|
143
|
+
deepestCircle: 0,
|
|
144
|
+
lastVisited: null,
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
inquiryRef,
|
|
148
|
+
ceremonyPhase: 'gathering',
|
|
149
|
+
activeDirection: startDirection,
|
|
150
|
+
quadrantState: {
|
|
151
|
+
east: { ...emptyQuadrant },
|
|
152
|
+
south: { ...emptyQuadrant },
|
|
153
|
+
west: { ...emptyQuadrant },
|
|
154
|
+
north: { ...emptyQuadrant },
|
|
155
|
+
},
|
|
156
|
+
gatingConditions: [],
|
|
157
|
+
relationalMilestones: [],
|
|
158
|
+
trajectoryHistory: [],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=ceremony-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceremony-state.js","sourceRoot":"","sources":["../src/ceremony-state.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiLH,kDAyBC;AAhMD,+EAA+E;AAE/E,MAAM,oBAAoB,GAA4B;IACpD,WAAW;IACX,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;CACV,CAAC;AAEF,+EAA+E;AAE/E,wEAAwE;AACxE,MAAa,oBAAoB;IACvB,KAAK,CAAwB;IAErC,YAAY,KAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;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AE,SAAS;QACjB,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,CAAC;QAChB,WAAW,EAAE,IAAI;KAClB,CAAC;IAEF,OAAO;QACL,UAAU;QACV,aAAa,EAAE,WAAW;QAC1B,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE;YACb,IAAI,EAAE,EAAE,GAAG,aAAa,EAAE;YAC1B,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE;YAC3B,IAAI,EAAE,EAAE,GAAG,aAAa,EAAE;YAC1B,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE;SAC5B;QACD,gBAAgB,EAAE,EAAE;QACpB,oBAAoB,EAAE,EAAE;QACxB,iBAAiB,EAAE,EAAE;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* medicine-wheel-fire-keeper — Relational Check-Back Protocol
|
|
3
|
+
*
|
|
4
|
+
* Four-step verification that runs before any autonomous action.
|
|
5
|
+
* Ensures every action strengthens the relational web rather than
|
|
6
|
+
* degrading it. Rooted in Wilson's relational accountability framework.
|
|
7
|
+
*/
|
|
8
|
+
import type { FireKeeperContext } from './types.js';
|
|
9
|
+
/** Result of a single check-back step */
|
|
10
|
+
export interface CheckBackStep {
|
|
11
|
+
/** Step number (1–4) */
|
|
12
|
+
step: number;
|
|
13
|
+
/** Human-readable question for this step */
|
|
14
|
+
question: string;
|
|
15
|
+
/** Whether this step passed */
|
|
16
|
+
passed: boolean;
|
|
17
|
+
/** Explanation of the assessment */
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
/** Full result of the relational check-back protocol */
|
|
21
|
+
export interface CheckBackResult {
|
|
22
|
+
/** Whether the action is approved to proceed */
|
|
23
|
+
approved: boolean;
|
|
24
|
+
/** Results of all four steps */
|
|
25
|
+
steps: CheckBackStep[];
|
|
26
|
+
/** Summary of the check-back */
|
|
27
|
+
summary: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Execute the four-step relational check-back protocol.
|
|
31
|
+
* Before any autonomous action, verify it strengthens the relational web.
|
|
32
|
+
*
|
|
33
|
+
* Step 1: Does this action honor existing relations?
|
|
34
|
+
* Step 2: Does it strengthen the Spirit-Body relationship of the project?
|
|
35
|
+
* Step 3: Is it accountable to all four directions?
|
|
36
|
+
* Step 4: Would an Elder approve?
|
|
37
|
+
*
|
|
38
|
+
* @param action - Description of the proposed action
|
|
39
|
+
* @param context - Current Fire Keeper context
|
|
40
|
+
* @returns Check-back result with per-step assessments
|
|
41
|
+
*/
|
|
42
|
+
export declare function relationalCheckBack(action: string, context: FireKeeperContext): CheckBackResult;
|
|
43
|
+
//# sourceMappingURL=check-back.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-back.d.ts","sourceRoot":"","sources":["../src/check-back.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GACzB,eAAe,CAgBjB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* medicine-wheel-fire-keeper — Relational Check-Back Protocol
|
|
4
|
+
*
|
|
5
|
+
* Four-step verification that runs before any autonomous action.
|
|
6
|
+
* Ensures every action strengthens the relational web rather than
|
|
7
|
+
* degrading it. Rooted in Wilson's relational accountability framework.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.relationalCheckBack = relationalCheckBack;
|
|
11
|
+
// ── Check-Back Protocol ─────────────────────────────────────────────────────
|
|
12
|
+
/**
|
|
13
|
+
* Execute the four-step relational check-back protocol.
|
|
14
|
+
* Before any autonomous action, verify it strengthens the relational web.
|
|
15
|
+
*
|
|
16
|
+
* Step 1: Does this action honor existing relations?
|
|
17
|
+
* Step 2: Does it strengthen the Spirit-Body relationship of the project?
|
|
18
|
+
* Step 3: Is it accountable to all four directions?
|
|
19
|
+
* Step 4: Would an Elder approve?
|
|
20
|
+
*
|
|
21
|
+
* @param action - Description of the proposed action
|
|
22
|
+
* @param context - Current Fire Keeper context
|
|
23
|
+
* @returns Check-back result with per-step assessments
|
|
24
|
+
*/
|
|
25
|
+
function relationalCheckBack(action, context) {
|
|
26
|
+
const steps = [
|
|
27
|
+
checkHonorsRelations(action, context),
|
|
28
|
+
checkSpiritBodyRelationship(action, context),
|
|
29
|
+
checkFourDirections(action, context),
|
|
30
|
+
checkElderApproval(action, context),
|
|
31
|
+
];
|
|
32
|
+
const approved = steps.every((s) => s.passed);
|
|
33
|
+
const failedSteps = steps.filter((s) => !s.passed);
|
|
34
|
+
const summary = approved
|
|
35
|
+
? `Action "${action}" passes all four check-back steps — proceed with care`
|
|
36
|
+
: `Action "${action}" failed ${failedSteps.length} check-back step(s): ${failedSteps.map((s) => `Step ${s.step}`).join(', ')}`;
|
|
37
|
+
return { approved, steps, summary };
|
|
38
|
+
}
|
|
39
|
+
// ── Individual Steps ────────────────────────────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* Step 1: Does this action honor existing relations?
|
|
42
|
+
* Checks that gating conditions reflecting relational commitments are met.
|
|
43
|
+
*/
|
|
44
|
+
function checkHonorsRelations(action, context) {
|
|
45
|
+
const unsatisfied = context.ceremonyState.gatingConditions.filter((g) => !g.satisfied);
|
|
46
|
+
const passed = unsatisfied.length === 0;
|
|
47
|
+
return {
|
|
48
|
+
step: 1,
|
|
49
|
+
question: 'Does this action honor existing relations?',
|
|
50
|
+
passed,
|
|
51
|
+
reason: passed
|
|
52
|
+
? 'All relational gating conditions are satisfied'
|
|
53
|
+
: `${unsatisfied.length} gating condition(s) unsatisfied: ${unsatisfied.map((g) => g.condition).join('; ')}`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Step 2: Does it strengthen the Spirit-Body relationship?
|
|
58
|
+
* Checks trajectory confidence — a declining trajectory suggests
|
|
59
|
+
* the action may disconnect vision (Spirit) from implementation (Body).
|
|
60
|
+
*/
|
|
61
|
+
function checkSpiritBodyRelationship(action, context) {
|
|
62
|
+
const history = context.ceremonyState.trajectoryHistory;
|
|
63
|
+
if (history.length < 2) {
|
|
64
|
+
return {
|
|
65
|
+
step: 2,
|
|
66
|
+
question: 'Does it strengthen the Spirit-Body relationship of the project?',
|
|
67
|
+
passed: true,
|
|
68
|
+
reason: 'Insufficient trajectory history — proceeding with trust',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const recent = history.slice(-3);
|
|
72
|
+
const trend = recent[recent.length - 1].confidence - recent[0].confidence;
|
|
73
|
+
const passed = trend >= -0.1;
|
|
74
|
+
return {
|
|
75
|
+
step: 2,
|
|
76
|
+
question: 'Does it strengthen the Spirit-Body relationship of the project?',
|
|
77
|
+
passed,
|
|
78
|
+
reason: passed
|
|
79
|
+
? `Trajectory trend is stable or improving (${trend >= 0 ? '+' : ''}${trend.toFixed(2)})`
|
|
80
|
+
: `Trajectory is declining (${trend.toFixed(2)}) — Spirit-Body relationship may be weakening`,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Step 3: Is it accountable to all four directions?
|
|
85
|
+
* Checks that the ceremony hasn't become stuck in a single quadrant.
|
|
86
|
+
*/
|
|
87
|
+
function checkFourDirections(action, context) {
|
|
88
|
+
const { quadrantState } = context.ceremonyState;
|
|
89
|
+
const directions = Object.keys(quadrantState);
|
|
90
|
+
const activeOrVisited = directions.filter((d) => quadrantState[d].status !== 'pending');
|
|
91
|
+
// During gathering/kindling, we don't expect all directions yet
|
|
92
|
+
const earlyPhase = ['gathering', 'kindling'].includes(context.ceremonyState.ceremonyPhase);
|
|
93
|
+
if (earlyPhase) {
|
|
94
|
+
return {
|
|
95
|
+
step: 3,
|
|
96
|
+
question: 'Is it accountable to all four directions?',
|
|
97
|
+
passed: true,
|
|
98
|
+
reason: `Early ceremony phase (${context.ceremonyState.ceremonyPhase}) — directional balance not yet expected`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const passed = activeOrVisited.length >= 2;
|
|
102
|
+
return {
|
|
103
|
+
step: 3,
|
|
104
|
+
question: 'Is it accountable to all four directions?',
|
|
105
|
+
passed,
|
|
106
|
+
reason: passed
|
|
107
|
+
? `${activeOrVisited.length} direction(s) engaged: ${activeOrVisited.join(', ')}`
|
|
108
|
+
: 'Work is concentrated in fewer than 2 directions — relational balance at risk',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Step 4: Would an Elder approve?
|
|
113
|
+
* Synthesizes Wilson alignment, OCAP compliance, and ceremony state.
|
|
114
|
+
* This is the holistic check — if the numbers look right but something
|
|
115
|
+
* feels wrong, this step catches it.
|
|
116
|
+
*/
|
|
117
|
+
function checkElderApproval(action, context) {
|
|
118
|
+
const wilsonOk = (context.wilsonAlignment ?? 0) >= 0.5;
|
|
119
|
+
const ocapOk = context.ocapCompliant !== false;
|
|
120
|
+
const noStopWork = context.ceremonyState.ceremonyPhase !== 'resting';
|
|
121
|
+
const passed = wilsonOk && ocapOk && noStopWork;
|
|
122
|
+
const issues = [];
|
|
123
|
+
if (!wilsonOk)
|
|
124
|
+
issues.push(`Wilson alignment too low (${context.wilsonAlignment})`);
|
|
125
|
+
if (!ocapOk)
|
|
126
|
+
issues.push('OCAP compliance not verified');
|
|
127
|
+
if (!noStopWork)
|
|
128
|
+
issues.push('Ceremony is in resting phase');
|
|
129
|
+
return {
|
|
130
|
+
step: 4,
|
|
131
|
+
question: 'Would an Elder approve?',
|
|
132
|
+
passed,
|
|
133
|
+
reason: passed
|
|
134
|
+
? 'Wilson alignment, OCAP compliance, and ceremony state all indicate approval'
|
|
135
|
+
: `Concerns: ${issues.join('; ')}`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=check-back.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-back.js","sourceRoot":"","sources":["../src/check-back.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA2CH,kDAmBC;AAlCD,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CACjC,MAAc,EACd,OAA0B;IAE1B,MAAM,KAAK,GAAoB;QAC7B,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC;QACrC,2BAA2B,CAAC,MAAM,EAAE,OAAO,CAAC;QAC5C,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC;QACpC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC;KACpC,CAAC;IAEF,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEnD,MAAM,OAAO,GAAG,QAAQ;QACtB,CAAC,CAAC,WAAW,MAAM,wDAAwD;QAC3E,CAAC,CAAC,WAAW,MAAM,YAAY,WAAW,CAAC,MAAM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AAC;QACP,QAAQ,EAAE,2CAA2C;QACrD,MAAM;QACN,MAAM,EAAE,MAAM;YACZ,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,0BAA0B,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACjF,CAAC,CAAC,8EAA8E;KACnF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,MAAc,EACd,OAA0B;IAE1B,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,eAAe,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,KAAK,KAAK,CAAC;IAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,KAAK,SAAS,CAAC;IAErE,MAAM,MAAM,GAAG,QAAQ,IAAI,MAAM,IAAI,UAAU,CAAC;IAChD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,6BAA6B,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IACpF,IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,yBAAyB;QACnC,MAAM;QACN,MAAM,EAAE,MAAM;YACZ,CAAC,CAAC,6EAA6E;YAC/E,CAAC,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* medicine-wheel-fire-keeper — Human-in-the-Loop Decisions
|
|
3
|
+
*
|
|
4
|
+
* Determines when human involvement is required, manages permission
|
|
5
|
+
* escalation, and triggers circle review processes. The Fire Keeper
|
|
6
|
+
* decides autonomously except at defined decision points.
|
|
7
|
+
*/
|
|
8
|
+
import type { FireKeeperContext, PermissionTier, DecisionPointType, DecisionPoint } from './types.js';
|
|
9
|
+
import type { HumanNeededMessage } from './messages.js';
|
|
10
|
+
/** Result of checking whether human involvement is needed */
|
|
11
|
+
export interface HumanDecisionResult {
|
|
12
|
+
/** Whether human involvement is required */
|
|
13
|
+
needed: boolean;
|
|
14
|
+
/** Which decision point was triggered, if any */
|
|
15
|
+
decisionType: DecisionPointType | null;
|
|
16
|
+
/** Reason human involvement is needed */
|
|
17
|
+
reason: string | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Determine if a human decision is required given the current context.
|
|
21
|
+
* Checks trajectory confidence, value divergence, and decision point triggers.
|
|
22
|
+
* @param context - Current Fire Keeper context
|
|
23
|
+
* @param decisionPoints - Configured decision points to check
|
|
24
|
+
* @param trajectoryThreshold - Minimum acceptable trajectory confidence (default: 0.65)
|
|
25
|
+
*/
|
|
26
|
+
export declare function humanNeeded(context: FireKeeperContext, decisionPoints: DecisionPoint[], trajectoryThreshold?: number): HumanDecisionResult;
|
|
27
|
+
/** Result of a permission escalation request */
|
|
28
|
+
export interface EscalationResult {
|
|
29
|
+
/** Whether escalation is allowed */
|
|
30
|
+
allowed: boolean;
|
|
31
|
+
/** Whether human approval is required for this escalation */
|
|
32
|
+
humanRequired: boolean;
|
|
33
|
+
/** The tier being escalated from */
|
|
34
|
+
fromTier: PermissionTier;
|
|
35
|
+
/** The tier being escalated to */
|
|
36
|
+
toTier: PermissionTier;
|
|
37
|
+
/** Reason for the decision */
|
|
38
|
+
reason: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Evaluate a permission escalation request.
|
|
42
|
+
* The 'act' tier always requires human approval.
|
|
43
|
+
* @param currentTier - Agent's current permission tier
|
|
44
|
+
* @param requestedAction - The action the agent wants to perform
|
|
45
|
+
*/
|
|
46
|
+
export declare function permissionEscalation(currentTier: PermissionTier, requestedAction: PermissionTier): EscalationResult;
|
|
47
|
+
/** Result of a circle review check */
|
|
48
|
+
export interface CircleReviewResult {
|
|
49
|
+
/** Whether a circle review should be triggered */
|
|
50
|
+
reviewNeeded: boolean;
|
|
51
|
+
/** The human.needed message to send, if review is needed */
|
|
52
|
+
message: HumanNeededMessage | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Trigger a circle review process when an ImportanceUnit reaches
|
|
56
|
+
* circle completion (all four quadrants visited). Human must confirm
|
|
57
|
+
* before the unit can be archived or pruned.
|
|
58
|
+
* @param context - Current Fire Keeper context
|
|
59
|
+
*/
|
|
60
|
+
export declare function circleReview(context: FireKeeperContext): CircleReviewResult;
|
|
61
|
+
//# sourceMappingURL=decisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decisions.d.ts","sourceRoot":"","sources":["../src/decisions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAWxD,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC,yCAAyC;IACzC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,iBAAiB,EAC1B,cAAc,EAAE,aAAa,EAAE,EAC/B,mBAAmB,GAAE,MAAa,GACjC,mBAAmB,CA0BrB;AAID,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,aAAa,EAAE,OAAO,CAAC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