@medicine-wheel/importance-unit 0.2.2

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 ADDED
@@ -0,0 +1,105 @@
1
+ # @medicine-wheel/importance-unit
2
+
3
+ The ImportanceUnit is the relational unit of knowledge in Wilson's epistemology — a relationally-accountable piece of meaning that carries epistemic weight, source dimensions, accountability links, and circle depth tracking.
4
+
5
+ ## Overview
6
+
7
+ In Wilson's framework, not all knowledge is equal. Dream-state and embodied knowledge may carry more epistemic authority than rational analysis. ImportanceUnits make this explicit.
8
+
9
+ ### What it provides
10
+
11
+ | Module | Description |
12
+ |--------|-------------|
13
+ | `types` | TypeScript types for ImportanceUnit, AccountabilityLink, CircleRefinement, and related structures |
14
+ | `schemas` | Zod validation schemas for runtime data integrity |
15
+ | `unit` | Core CRUD: `createUnit()`, `updateUnit()`, `circleBack()`, `archive()` |
16
+ | `epistemic-weight` | Weight computation: `computeWeight()`, `adjustForSource()`, `adjustForDepth()` |
17
+ | `accountability` | Link management: `linkAccountability()`, `resolveLinks()`, `findGaps()` |
18
+ | `circle-tracking` | Spiral tracking: `incrementCircle()`, `recordRefinement()`, `detectDeepening()`, `detectStagnation()` |
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @medicine-wheel/importance-unit
24
+ ```
25
+
26
+ Or link locally:
27
+ ```bash
28
+ npm link ../medicine-wheel/src/importance-unit
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```typescript
34
+ import {
35
+ // Types
36
+ type ImportanceUnit, type EpistemicSource, type AccountabilityLink,
37
+
38
+ // CRUD
39
+ createUnit, circleBack, archive,
40
+
41
+ // Weight
42
+ computeWeight, BASE_WEIGHTS,
43
+
44
+ // Accountability
45
+ linkAccountability, findGaps,
46
+
47
+ // Circle tracking
48
+ incrementCircle, detectDeepening, detectStagnation,
49
+
50
+ // Schemas
51
+ ImportanceUnitSchema,
52
+ } from '@medicine-wheel/importance-unit';
53
+
54
+ // Create a new unit from dream-state knowing
55
+ const unit = createUnit({
56
+ direction: 'east',
57
+ source: 'dream',
58
+ summary: 'The river teaches patience through its refusal to hurry',
59
+ createdBy: 'firekeeper-agent',
60
+ axiologicalPillar: 'epistemology',
61
+ });
62
+
63
+ // unit.epistemicWeight === 0.85 (dream-state base)
64
+ // unit.circleDepth === 1
65
+
66
+ // Circle back with a refinement
67
+ const deepened = circleBack(unit, 'Patience is not waiting — it is attending');
68
+ // deepened.circleDepth === 2
69
+ // deepened.epistemicWeight > 0.85 (depth bonus applied)
70
+ ```
71
+
72
+ ## Epistemic Weight Model
73
+
74
+ | Source | Base Weight | Rationale |
75
+ |--------|-------------|-----------|
76
+ | `dream` | 0.85 | Liminal/spirit-state knowing has highest authority |
77
+ | `land` | 0.75 | Place-grounded/embodied knowing |
78
+ | `vision` | 0.65 | Intentional/architectural knowing |
79
+ | `code` | 0.50 | Technical/implementation knowing |
80
+
81
+ Weight increases with `circleDepth` using diminishing returns (logarithmic scaling). The first return yields more insight than the tenth, though all returns matter. Weight never exceeds 1.0.
82
+
83
+ ## Key Concepts
84
+
85
+ ### Circle Depth
86
+
87
+ Repetition is ceremony and deepening, not redundancy. Each time a topic is revisited (`circleBack()`), the circle depth increments and a refinement is recorded capturing "the subtle difference between the 3rd and 4th circling."
88
+
89
+ ### Accountability Links
90
+
91
+ Every ImportanceUnit must be accountable to something. Links carry responsibility, not just reference. The `findGaps()` function identifies relationally isolated units.
92
+
93
+ ### Ceremony State
94
+
95
+ Tracks progression through the four directions. When all four quadrants have been visited, the circle is complete and the unit becomes eligible for archival.
96
+
97
+ ## Dependencies
98
+
99
+ - `@medicine-wheel/ontology-core` — Foundational types (`DirectionName`, etc.)
100
+ - `zod` — Runtime validation
101
+
102
+ ## License
103
+
104
+ MIT — IAIP Collaborative, Shawinigan, QC
105
+
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @medicine-wheel/importance-unit — Accountability Link Management
3
+ *
4
+ * Manages the relational strings connecting ImportanceUnits to what
5
+ * they are accountable to. The question is "To what is this accountable?"
6
+ * not "What is this about?"
7
+ *
8
+ * Wilson's relational accountability requires that every piece of
9
+ * knowledge be tethered to its responsibilities.
10
+ */
11
+ import type { ImportanceUnit, AccountabilityLink, AccountabilityLinkType } from './types.js';
12
+ /**
13
+ * Result of analyzing accountability gaps in a set of ImportanceUnits.
14
+ */
15
+ export interface AccountabilityGap {
16
+ /** ID of the unit with a gap */
17
+ unitId: string;
18
+ /** Description of the gap */
19
+ description: string;
20
+ /** Suggested link type to address the gap */
21
+ suggestedLinkType: AccountabilityLinkType;
22
+ }
23
+ /**
24
+ * Add an accountability link to an ImportanceUnit.
25
+ *
26
+ * Returns a new unit with the link appended. Does not add
27
+ * duplicate links (same targetId and relationType).
28
+ *
29
+ * @param unit - The unit to link from
30
+ * @param link - The accountability link to add
31
+ * @returns The unit with the new link
32
+ */
33
+ export declare function linkAccountability(unit: ImportanceUnit, link: AccountabilityLink): ImportanceUnit;
34
+ /**
35
+ * Resolve all accountability links for a unit against a collection
36
+ * of known ImportanceUnits. Returns the links that point to valid
37
+ * existing units.
38
+ *
39
+ * @param unit - The unit whose links to resolve
40
+ * @param allUnits - Map of all known units by ID
41
+ * @returns Object with resolved (found) and unresolved (dangling) links
42
+ */
43
+ export declare function resolveLinks(unit: ImportanceUnit, allUnits: Map<string, ImportanceUnit>): {
44
+ resolved: AccountabilityLink[];
45
+ unresolved: AccountabilityLink[];
46
+ };
47
+ /**
48
+ * Find accountability gaps across a set of ImportanceUnits.
49
+ *
50
+ * Identifies units that lack key relational connections:
51
+ * - Units with no accountability links at all
52
+ * - Units with no 'accountable-to' link
53
+ * - Units with high epistemic weight but no 'deepens' or 'circles-back-to' links
54
+ *
55
+ * @param units - Collection of ImportanceUnits to analyze
56
+ * @returns Array of identified gaps
57
+ */
58
+ export declare function findGaps(units: ImportanceUnit[]): AccountabilityGap[];
59
+ //# sourceMappingURL=accountability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accountability.d.ts","sourceRoot":"","sources":["../src/accountability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,iBAAiB,EAAE,sBAAsB,CAAC;CAC3C;AAID;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,kBAAkB,GACvB,cAAc,CAUhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GACpC;IAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAAC,UAAU,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAatE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,iBAAiB,EAAE,CA0CrE"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/importance-unit — Accountability Link Management
4
+ *
5
+ * Manages the relational strings connecting ImportanceUnits to what
6
+ * they are accountable to. The question is "To what is this accountable?"
7
+ * not "What is this about?"
8
+ *
9
+ * Wilson's relational accountability requires that every piece of
10
+ * knowledge be tethered to its responsibilities.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.linkAccountability = linkAccountability;
14
+ exports.resolveLinks = resolveLinks;
15
+ exports.findGaps = findGaps;
16
+ // ── Link Management ─────────────────────────────────────────────────────────
17
+ /**
18
+ * Add an accountability link to an ImportanceUnit.
19
+ *
20
+ * Returns a new unit with the link appended. Does not add
21
+ * duplicate links (same targetId and relationType).
22
+ *
23
+ * @param unit - The unit to link from
24
+ * @param link - The accountability link to add
25
+ * @returns The unit with the new link
26
+ */
27
+ function linkAccountability(unit, link) {
28
+ const exists = unit.accountabilityLinks.some((l) => l.targetId === link.targetId && l.relationType === link.relationType);
29
+ if (exists)
30
+ return unit;
31
+ return {
32
+ ...unit,
33
+ accountabilityLinks: [...unit.accountabilityLinks, link],
34
+ };
35
+ }
36
+ /**
37
+ * Resolve all accountability links for a unit against a collection
38
+ * of known ImportanceUnits. Returns the links that point to valid
39
+ * existing units.
40
+ *
41
+ * @param unit - The unit whose links to resolve
42
+ * @param allUnits - Map of all known units by ID
43
+ * @returns Object with resolved (found) and unresolved (dangling) links
44
+ */
45
+ function resolveLinks(unit, allUnits) {
46
+ const resolved = [];
47
+ const unresolved = [];
48
+ for (const link of unit.accountabilityLinks) {
49
+ if (allUnits.has(link.targetId)) {
50
+ resolved.push(link);
51
+ }
52
+ else {
53
+ unresolved.push(link);
54
+ }
55
+ }
56
+ return { resolved, unresolved };
57
+ }
58
+ /**
59
+ * Find accountability gaps across a set of ImportanceUnits.
60
+ *
61
+ * Identifies units that lack key relational connections:
62
+ * - Units with no accountability links at all
63
+ * - Units with no 'accountable-to' link
64
+ * - Units with high epistemic weight but no 'deepens' or 'circles-back-to' links
65
+ *
66
+ * @param units - Collection of ImportanceUnits to analyze
67
+ * @returns Array of identified gaps
68
+ */
69
+ function findGaps(units) {
70
+ const gaps = [];
71
+ for (const unit of units) {
72
+ // Units with no links at all are relationally isolated
73
+ if (unit.accountabilityLinks.length === 0) {
74
+ gaps.push({
75
+ unitId: unit.id,
76
+ description: 'Unit has no accountability links — relationally isolated',
77
+ suggestedLinkType: 'accountable-to',
78
+ });
79
+ continue;
80
+ }
81
+ // Every unit should be accountable to something
82
+ const hasAccountableTo = unit.accountabilityLinks.some((l) => l.relationType === 'accountable-to');
83
+ if (!hasAccountableTo) {
84
+ gaps.push({
85
+ unitId: unit.id,
86
+ description: 'Unit lacks an "accountable-to" link — knowledge without accountability',
87
+ suggestedLinkType: 'accountable-to',
88
+ });
89
+ }
90
+ // High-weight units should have deepening connections
91
+ if (unit.epistemicWeight >= 0.8) {
92
+ const hasDeepening = unit.accountabilityLinks.some((l) => l.relationType === 'deepens' || l.relationType === 'circles-back-to');
93
+ if (!hasDeepening) {
94
+ gaps.push({
95
+ unitId: unit.id,
96
+ description: 'High-weight unit lacks deepening links — authority without depth',
97
+ suggestedLinkType: 'deepens',
98
+ });
99
+ }
100
+ }
101
+ }
102
+ return gaps;
103
+ }
104
+ //# sourceMappingURL=accountability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accountability.js","sourceRoot":"","sources":["../src/accountability.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAkCH,gDAaC;AAWD,oCAgBC;AAaD,4BA0CC;AA3GD,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAChC,IAAoB,EACpB,IAAwB;IAExB,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAC1C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,CAC5E,CAAC;IACF,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IAExB,OAAO;QACL,GAAG,IAAI;QACP,mBAAmB,EAAE,CAAC,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC;KACzD,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,IAAoB,EACpB,QAAqC;IAErC,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC5C,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EA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,CAAC,IAAI,CAAC;oBACR,MAAM,EAAE,IAAI,CAAC,EAAE;oBACf,WAAW,EAAE,kEAAkE;oBAC/E,iBAAiB,EAAE,SAAS;iBAC7B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @medicine-wheel/importance-unit — Circle / Spiral Tracking
3
+ *
4
+ * Tracks the spiral journey of ImportanceUnits through repeated
5
+ * circling. In Wilson's framework, returning to a topic is not
6
+ * redundancy — it is ceremony and deepening. Each circle reveals
7
+ * the "subtle difference between the 3rd and 4th circling."
8
+ *
9
+ * Detects both deepening (genuine shifts in understanding) and
10
+ * stagnation (circling without change).
11
+ */
12
+ import type { DirectionName } from '@medicine-wheel/ontology-core';
13
+ import type { ImportanceUnit } from './types.js';
14
+ /**
15
+ * Increment the circle depth and record the current direction
16
+ * in the ceremony state's quadrantsVisited.
17
+ *
18
+ * @param unit - The unit to deepen
19
+ * @param direction - The direction being visited in this circle
20
+ * @returns Updated unit with incremented depth and visited direction
21
+ */
22
+ export declare function incrementCircle(unit: ImportanceUnit, direction: DirectionName): ImportanceUnit;
23
+ /**
24
+ * Record a refinement describing what shifted in this circle pass.
25
+ *
26
+ * @param unit - The unit being refined
27
+ * @param shift - What changed or deepened
28
+ * @returns Updated unit with the new refinement appended
29
+ */
30
+ export declare function recordRefinement(unit: ImportanceUnit, shift: string): ImportanceUnit;
31
+ /**
32
+ * Result of analyzing an ImportanceUnit's spiral depth.
33
+ */
34
+ export interface DeepeningAnalysis {
35
+ /** Total number of circles completed */
36
+ totalCircles: number;
37
+ /** Number of refinements recorded */
38
+ refinementCount: number;
39
+ /** Whether genuine deepening is detected */
40
+ isDeepening: boolean;
41
+ /** Average refinement length as a crude signal of substance */
42
+ averageShiftLength: number;
43
+ /** The most recent refinement, if any */
44
+ latestShift?: string;
45
+ }
46
+ /**
47
+ * Detect whether an ImportanceUnit is genuinely deepening through
48
+ * its spiral journey. Deepening requires that refinements are being
49
+ * recorded and that they carry substance.
50
+ *
51
+ * @param unit - The unit to analyze
52
+ * @returns Analysis of the unit's spiral depth
53
+ */
54
+ export declare function detectDeepening(unit: ImportanceUnit): DeepeningAnalysis;
55
+ /**
56
+ * Result of stagnation analysis.
57
+ */
58
+ export interface StagnationAnalysis {
59
+ /** Whether stagnation is detected */
60
+ isStagnant: boolean;
61
+ /** Number of circles without refinement */
62
+ circlesWithoutRefinement: number;
63
+ /** Ratio of refinements to circles */
64
+ refinementRatio: number;
65
+ /** Guidance for the practitioner */
66
+ guidance: string;
67
+ }
68
+ /**
69
+ * Detect whether an ImportanceUnit is stagnating — circling
70
+ * without genuine deepening or change.
71
+ *
72
+ * Stagnation is signaled when circleDepth exceeds refinement
73
+ * count by a significant margin, suggesting mechanical repetition
74
+ * rather than ceremonial deepening.
75
+ *
76
+ * @param unit - The unit to analyze
77
+ * @returns Stagnation analysis
78
+ */
79
+ export declare function detectStagnation(unit: ImportanceUnit): StagnationAnalysis;
80
+ //# sourceMappingURL=circle-tracking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle-tracking.d.ts","sourceRoot":"","sources":["../src/circle-tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAKlF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,SAAS,EAAE,aAAa,GACvB,cAAc,CAyBhB;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,GACZ,cAAc,CAchB;AAID;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,+DAA+D;IAC/D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,CA2BvE;AAID;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,wBAAwB,EAAE,MAAM,CAAC;IACjC,sCAAsC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,kBAAkB,CA2BzE"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/importance-unit — Circle / Spiral Tracking
4
+ *
5
+ * Tracks the spiral journey of ImportanceUnits through repeated
6
+ * circling. In Wilson's framework, returning to a topic is not
7
+ * redundancy — it is ceremony and deepening. Each circle reveals
8
+ * the "subtle difference between the 3rd and 4th circling."
9
+ *
10
+ * Detects both deepening (genuine shifts in understanding) and
11
+ * stagnation (circling without change).
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.incrementCircle = incrementCircle;
15
+ exports.recordRefinement = recordRefinement;
16
+ exports.detectDeepening = detectDeepening;
17
+ exports.detectStagnation = detectStagnation;
18
+ const epistemic_weight_js_1 = require("./epistemic-weight.js");
19
+ // ── Circle Increment ────────────────────────────────────────────────────────
20
+ /**
21
+ * Increment the circle depth and record the current direction
22
+ * in the ceremony state's quadrantsVisited.
23
+ *
24
+ * @param unit - The unit to deepen
25
+ * @param direction - The direction being visited in this circle
26
+ * @returns Updated unit with incremented depth and visited direction
27
+ */
28
+ function incrementCircle(unit, direction) {
29
+ const newDepth = unit.circleDepth + 1;
30
+ const visited = unit.ceremonyState?.quadrantsVisited ?? [];
31
+ const updatedVisited = visited.includes(direction)
32
+ ? visited
33
+ : [...visited, direction];
34
+ const circleComplete = updatedVisited.length >= 4;
35
+ const ceremonyState = {
36
+ quadrantsVisited: updatedVisited,
37
+ circleComplete,
38
+ gatingConditions: unit.ceremonyState?.gatingConditions ?? [],
39
+ };
40
+ return {
41
+ ...unit,
42
+ circleDepth: newDepth,
43
+ direction,
44
+ epistemicWeight: (0, epistemic_weight_js_1.computeWeight)(unit.source, newDepth),
45
+ ceremonyState,
46
+ meta: {
47
+ ...unit.meta,
48
+ lastCircledAt: new Date().toISOString(),
49
+ },
50
+ };
51
+ }
52
+ // ── Refinement Recording ────────────────────────────────────────────────────
53
+ /**
54
+ * Record a refinement describing what shifted in this circle pass.
55
+ *
56
+ * @param unit - The unit being refined
57
+ * @param shift - What changed or deepened
58
+ * @returns Updated unit with the new refinement appended
59
+ */
60
+ function recordRefinement(unit, shift) {
61
+ const refinement = {
62
+ circle: unit.circleDepth,
63
+ shift,
64
+ timestamp: new Date().toISOString(),
65
+ };
66
+ return {
67
+ ...unit,
68
+ content: {
69
+ ...unit.content,
70
+ refinements: [...unit.content.refinements, refinement],
71
+ },
72
+ };
73
+ }
74
+ /**
75
+ * Detect whether an ImportanceUnit is genuinely deepening through
76
+ * its spiral journey. Deepening requires that refinements are being
77
+ * recorded and that they carry substance.
78
+ *
79
+ * @param unit - The unit to analyze
80
+ * @returns Analysis of the unit's spiral depth
81
+ */
82
+ function detectDeepening(unit) {
83
+ const refinements = unit.content.refinements;
84
+ const refinementCount = refinements.length;
85
+ if (refinementCount === 0) {
86
+ return {
87
+ totalCircles: unit.circleDepth,
88
+ refinementCount: 0,
89
+ isDeepening: false,
90
+ averageShiftLength: 0,
91
+ };
92
+ }
93
+ const totalLength = refinements.reduce((sum, r) => sum + r.shift.length, 0);
94
+ const averageShiftLength = totalLength / refinementCount;
95
+ const latestShift = refinements[refinements.length - 1]?.shift;
96
+ // Deepening requires at least some substance in the shifts
97
+ const isDeepening = refinementCount > 0 && averageShiftLength > 10;
98
+ return {
99
+ totalCircles: unit.circleDepth,
100
+ refinementCount,
101
+ isDeepening,
102
+ averageShiftLength,
103
+ latestShift,
104
+ };
105
+ }
106
+ /**
107
+ * Detect whether an ImportanceUnit is stagnating — circling
108
+ * without genuine deepening or change.
109
+ *
110
+ * Stagnation is signaled when circleDepth exceeds refinement
111
+ * count by a significant margin, suggesting mechanical repetition
112
+ * rather than ceremonial deepening.
113
+ *
114
+ * @param unit - The unit to analyze
115
+ * @returns Stagnation analysis
116
+ */
117
+ function detectStagnation(unit) {
118
+ const refinementCount = unit.content.refinements.length;
119
+ const circlesWithoutRefinement = Math.max(0, unit.circleDepth - refinementCount - 1);
120
+ const refinementRatio = unit.circleDepth > 1
121
+ ? refinementCount / (unit.circleDepth - 1)
122
+ : 1;
123
+ // Stagnation: many circles, few refinements
124
+ const isStagnant = unit.circleDepth >= 3 && refinementRatio < 0.5;
125
+ let guidance;
126
+ if (isStagnant) {
127
+ guidance = 'This unit has been circled multiple times without substantial deepening. '
128
+ + 'Consider approaching from a different direction or source dimension.';
129
+ }
130
+ else if (refinementRatio < 0.75) {
131
+ guidance = 'Some circles lack recorded refinements. Ensure each return captures '
132
+ + 'what shifted — the subtle differences are where meaning lives.';
133
+ }
134
+ else {
135
+ guidance = 'Healthy spiral — each circle is producing recorded shifts.';
136
+ }
137
+ return {
138
+ isStagnant,
139
+ circlesWithoutRefinement,
140
+ refinementRatio,
141
+ guidance,
142
+ };
143
+ }
144
+ //# sourceMappingURL=circle-tracking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle-tracking.js","sourceRoot":"","sources":["../src/circle-tracking.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAgBH,0CA4BC;AAWD,4CAiBC;AA4BD,0CA2BC;AA6BD,4CA2BC;AAnLD,+DAAsD;AAEtD,+EAA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AAC;QAC1C,CAAC,CAAC,CAAC,CAAC;IAEN,4CAA4C;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,eAAe,GAAG,GAAG,CAAC;IAElE,IAAI,QAAgB,CAAC;IACrB,IAAI,UAAU,EAAE,CAAC;QACf,QAAQ,GAAG,2EAA2E;cAClF,sEAAsE,CAAC;IAC7E,CAAC;SAAM,IAAI,eAAe,GAAG,IAAI,EAAE,CAAC;QAClC,QAAQ,GAAG,sEAAsE;cAC7E,gEAAgE,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,4DAA4D,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,UAAU;QACV,wBAAwB;QACxB,eAAe;QACf,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @medicine-wheel/importance-unit — Epistemic Weight Computation
3
+ *
4
+ * Computes epistemic weight for ImportanceUnits based on their
5
+ * source dimension and circle depth. In Wilson's epistemology,
6
+ * not all knowledge is equal — dream-state and embodied knowledge
7
+ * carry more epistemic authority than rational analysis.
8
+ *
9
+ * Base weights:
10
+ * - dream: 0.85 (liminal/spirit-state knowing has highest authority)
11
+ * - land: 0.75 (place-grounded/embodied knowing)
12
+ * - vision: 0.65 (intentional/architectural knowing)
13
+ * - code: 0.50 (technical/implementation knowing)
14
+ *
15
+ * Weight increases with circleDepth using diminishing returns
16
+ * (logarithmic scaling), never exceeding 1.0.
17
+ */
18
+ import type { EpistemicSource } from './types.js';
19
+ /** Base epistemic weights by source dimension */
20
+ export declare const BASE_WEIGHTS: Record<EpistemicSource, number>;
21
+ /**
22
+ * Compute the full epistemic weight for a given source and depth.
23
+ *
24
+ * Weight = baseWeight + depthBonus, clamped to [0, 1].
25
+ *
26
+ * @param source - The epistemic source dimension
27
+ * @param circleDepth - How many times this topic has been circled
28
+ * @returns Epistemic weight between 0.0 and 1.0
29
+ */
30
+ export declare function computeWeight(source: EpistemicSource, circleDepth: number): number;
31
+ /**
32
+ * Adjust weight for a different source dimension.
33
+ *
34
+ * Re-bases the weight using the new source's base weight
35
+ * while preserving the depth-derived bonus.
36
+ *
37
+ * @param currentWeight - The current epistemic weight
38
+ * @param currentSource - The current source dimension
39
+ * @param newSource - The new source dimension
40
+ * @returns Adjusted weight for the new source
41
+ */
42
+ export declare function adjustForSource(currentWeight: number, currentSource: EpistemicSource, newSource: EpistemicSource): number;
43
+ /**
44
+ * Adjust weight for a new circle depth.
45
+ *
46
+ * Recalculates weight from the source base plus the new
47
+ * depth bonus.
48
+ *
49
+ * @param source - The epistemic source dimension
50
+ * @param newDepth - The new circle depth
51
+ * @returns Recalculated weight
52
+ */
53
+ export declare function adjustForDepth(source: EpistemicSource, newDepth: number): number;
54
+ //# sourceMappingURL=epistemic-weight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epistemic-weight.d.ts","sourceRoot":"","sources":["../src/epistemic-weight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,iDAAiD;AACjD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAKxD,CAAC;AAyBF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,eAAe,EAC9B,SAAS,EAAE,eAAe,GACzB,MAAM,CAKR;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhF"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/importance-unit — Epistemic Weight Computation
4
+ *
5
+ * Computes epistemic weight for ImportanceUnits based on their
6
+ * source dimension and circle depth. In Wilson's epistemology,
7
+ * not all knowledge is equal — dream-state and embodied knowledge
8
+ * carry more epistemic authority than rational analysis.
9
+ *
10
+ * Base weights:
11
+ * - dream: 0.85 (liminal/spirit-state knowing has highest authority)
12
+ * - land: 0.75 (place-grounded/embodied knowing)
13
+ * - vision: 0.65 (intentional/architectural knowing)
14
+ * - code: 0.50 (technical/implementation knowing)
15
+ *
16
+ * Weight increases with circleDepth using diminishing returns
17
+ * (logarithmic scaling), never exceeding 1.0.
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.BASE_WEIGHTS = void 0;
21
+ exports.computeWeight = computeWeight;
22
+ exports.adjustForSource = adjustForSource;
23
+ exports.adjustForDepth = adjustForDepth;
24
+ // ── Base Weights ────────────────────────────────────────────────────────────
25
+ /** Base epistemic weights by source dimension */
26
+ exports.BASE_WEIGHTS = {
27
+ dream: 0.85,
28
+ land: 0.75,
29
+ vision: 0.65,
30
+ code: 0.50,
31
+ };
32
+ /** Maximum depth bonus that can be added to base weight */
33
+ const MAX_DEPTH_BONUS = 0.15;
34
+ /** Logarithmic scaling factor for depth bonus */
35
+ const DEPTH_SCALE = 3;
36
+ // ── Weight Computation ──────────────────────────────────────────────────────
37
+ /**
38
+ * Compute the depth bonus using diminishing returns.
39
+ *
40
+ * Uses logarithmic scaling so that early circles contribute
41
+ * more than later ones — the first return yields more insight
42
+ * than the tenth, though all returns matter.
43
+ *
44
+ * @param circleDepth - Number of times circled (minimum 1)
45
+ * @returns Depth bonus between 0 and MAX_DEPTH_BONUS
46
+ */
47
+ function depthBonus(circleDepth) {
48
+ if (circleDepth <= 1)
49
+ return 0;
50
+ return MAX_DEPTH_BONUS * (Math.log(circleDepth) / Math.log(circleDepth + DEPTH_SCALE));
51
+ }
52
+ /**
53
+ * Compute the full epistemic weight for a given source and depth.
54
+ *
55
+ * Weight = baseWeight + depthBonus, clamped to [0, 1].
56
+ *
57
+ * @param source - The epistemic source dimension
58
+ * @param circleDepth - How many times this topic has been circled
59
+ * @returns Epistemic weight between 0.0 and 1.0
60
+ */
61
+ function computeWeight(source, circleDepth) {
62
+ const base = exports.BASE_WEIGHTS[source];
63
+ const bonus = depthBonus(circleDepth);
64
+ return Math.min(1.0, base + bonus);
65
+ }
66
+ /**
67
+ * Adjust weight for a different source dimension.
68
+ *
69
+ * Re-bases the weight using the new source's base weight
70
+ * while preserving the depth-derived bonus.
71
+ *
72
+ * @param currentWeight - The current epistemic weight
73
+ * @param currentSource - The current source dimension
74
+ * @param newSource - The new source dimension
75
+ * @returns Adjusted weight for the new source
76
+ */
77
+ function adjustForSource(currentWeight, currentSource, newSource) {
78
+ const currentBase = exports.BASE_WEIGHTS[currentSource];
79
+ const bonus = currentWeight - currentBase;
80
+ const newBase = exports.BASE_WEIGHTS[newSource];
81
+ return Math.min(1.0, Math.max(0, newBase + Math.max(0, bonus)));
82
+ }
83
+ /**
84
+ * Adjust weight for a new circle depth.
85
+ *
86
+ * Recalculates weight from the source base plus the new
87
+ * depth bonus.
88
+ *
89
+ * @param source - The epistemic source dimension
90
+ * @param newDepth - The new circle depth
91
+ * @returns Recalculated weight
92
+ */
93
+ function adjustForDepth(source, newDepth) {
94
+ return computeWeight(source, newDepth);
95
+ }
96
+ //# sourceMappingURL=epistemic-weight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epistemic-weight.js","sourceRoot":"","sources":["../src/epistemic-weight.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AA8CH,sCAIC;AAaD,0CASC;AAYD,wCAEC;AAlFD,+EAA+E;AAE/E,iDAAiD;AACpC,QAAA,YAAY,GAAoC;IAC3D,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,2DAA2D;AAC3D,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,iDAAiD;AACjD,MAA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