principles-disciple 1.104.2 → 1.105.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/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Evolutionary programming agent framework with strategic guardrails and reflection loops.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.105.0",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onCapabilities": [
|
|
8
8
|
"hook"
|
package/package.json
CHANGED
package/src/core/init.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { addPrincipleToLedger } from './principle-tree-ledger.js';
|
|
|
9
9
|
import type { LedgerPrinciple } from './principle-tree-ledger.js';
|
|
10
10
|
import { atomicWriteFileSync } from '../utils/io.js';
|
|
11
11
|
import { createDefaultKeywordStore, saveKeywordStore } from './empathy-keyword-matcher.js';
|
|
12
|
+
import { CORE_PRINCIPLES } from '@principles/core/runtime-v2';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Default PROFILE.json content
|
|
@@ -150,24 +151,17 @@ function copyRecursiveSync(srcDir: string, destDir: string, api: OpenClawPluginA
|
|
|
150
151
|
|
|
151
152
|
/**
|
|
152
153
|
* Core thinking model definitions (T-01 through T-10).
|
|
153
|
-
*
|
|
154
|
+
* Derived from the Core Principle Registry — the single source of truth.
|
|
154
155
|
*/
|
|
155
156
|
export const CORE_THINKING_MODELS: Array<{
|
|
156
157
|
id: string;
|
|
157
158
|
name: string;
|
|
158
159
|
description: string;
|
|
159
|
-
}> =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{ id: 'T-05', name: 'Safety Rails', description: 'Call out guardrails, prohibitions, and failure-prevention constraints.' },
|
|
165
|
-
{ id: 'T-06', name: 'Simplicity First', description: 'Prefer the smallest understandable solution over over-engineering.' },
|
|
166
|
-
{ id: 'T-07', name: 'Minimal Change Surface', description: 'Limit the blast radius and touch only what is necessary.' },
|
|
167
|
-
{ id: 'T-08', name: 'Pain As Signal', description: 'Treat failures and friction as clues to step back and rethink.' },
|
|
168
|
-
{ id: 'T-09', name: 'Divide And Conquer', description: 'Split the task into smaller phases before execution.' },
|
|
169
|
-
{ id: 'T-10', name: 'Memory Externalization', description: 'Write intermediate conclusions to files for persistence.' },
|
|
170
|
-
];
|
|
160
|
+
}> = CORE_PRINCIPLES.map(p => ({
|
|
161
|
+
id: p.id,
|
|
162
|
+
name: p.name,
|
|
163
|
+
description: p.description,
|
|
164
|
+
}));
|
|
171
165
|
|
|
172
166
|
/**
|
|
173
167
|
* Initialize core thinking models into the training store if it's empty.
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Thinking Models — Detection Engine
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Core principle metadata (id, name, description) comes from the
|
|
5
|
+
* Core Principle Registry in @principles/core/runtime-v2.
|
|
5
6
|
* Detection patterns are carefully tuned regexes that match AI output text.
|
|
6
7
|
*
|
|
7
8
|
* Flow:
|
|
8
|
-
*
|
|
9
|
+
* Core Principle Registry (authority) → id, name, description
|
|
9
10
|
* BUILTIN_PATTERNS (engine) → detection regexes per model id
|
|
10
11
|
* THINKING_MODELS (merged) → full definitions with patterns
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import { loadThinkingOsFromWorkspace, generateDetectionPatterns } from './thinking-os-parser.js';
|
|
15
|
+
import { CORE_PRINCIPLES } from '@principles/core/runtime-v2';
|
|
14
16
|
|
|
15
17
|
export interface ThinkingModelDefinition {
|
|
16
18
|
id: string;
|
|
@@ -199,37 +201,15 @@ const BUILTIN_PATTERNS: BuiltinPatternEntry[] = [
|
|
|
199
201
|
|
|
200
202
|
const BUILTIN_PATTERN_MAP = new Map(BUILTIN_PATTERNS.map((p) => [p.id, p]));
|
|
201
203
|
|
|
202
|
-
// Fallback name/description lookup
|
|
204
|
+
// Fallback name/description lookup — delegates to Core Principle Registry
|
|
203
205
|
function getFallbackName(id: string): string {
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
'T-02': 'Respect Constraints',
|
|
207
|
-
'T-03': 'Evidence Over Assumption',
|
|
208
|
-
'T-04': 'Reversible First',
|
|
209
|
-
'T-05': 'Safety Rails',
|
|
210
|
-
'T-06': 'Simplicity First',
|
|
211
|
-
'T-07': 'Minimal Change Surface',
|
|
212
|
-
'T-08': 'Pain As Signal',
|
|
213
|
-
'T-09': 'Divide And Conquer',
|
|
214
|
-
'T-10': 'Memory Externalization',
|
|
215
|
-
};
|
|
216
|
-
return names[id] ?? id;
|
|
206
|
+
const entry = CORE_PRINCIPLES.find(p => p.id === id);
|
|
207
|
+
return entry?.name ?? id;
|
|
217
208
|
}
|
|
218
209
|
|
|
219
210
|
function getFallbackDescription(id: string): string {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
'T-02': 'Trust files, not your context window. Write conclusions to files.',
|
|
223
|
-
'T-03': 'Use logs, code, and outputs before inferring causes.',
|
|
224
|
-
'T-04': 'Prefer changes that are safe to roll back when risk is high.',
|
|
225
|
-
'T-05': 'Call out guardrails, prohibitions, and failure-prevention constraints.',
|
|
226
|
-
'T-06': 'Prefer the smallest understandable solution over over-engineering.',
|
|
227
|
-
'T-07': 'Limit the blast radius and touch only what is necessary.',
|
|
228
|
-
'T-08': 'Treat failures and friction as clues to step back and rethink.',
|
|
229
|
-
'T-09': 'Split the task into smaller phases before execution.',
|
|
230
|
-
'T-10': 'Write intermediate conclusions to files for persistence.',
|
|
231
|
-
};
|
|
232
|
-
return descs[id] ?? '';
|
|
211
|
+
const entry = CORE_PRINCIPLES.find(p => p.id === id);
|
|
212
|
+
return entry?.description ?? '';
|
|
233
213
|
}
|
|
234
214
|
|
|
235
215
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { listThinkingModels } from '../../src/core/thinking-models.js';
|
|
3
|
+
import {
|
|
4
|
+
CORE_PRINCIPLES,
|
|
5
|
+
CORE_PRINCIPLE_IDS,
|
|
6
|
+
} from '@principles/core/runtime-v2';
|
|
7
|
+
|
|
8
|
+
describe('Core Principle Registry drift test', () => {
|
|
9
|
+
it('registry count matches thinking-models.ts builtin count', () => {
|
|
10
|
+
// No workspace → falls back to builtin patterns (T-01..T-10)
|
|
11
|
+
const models = listThinkingModels();
|
|
12
|
+
expect(models).toHaveLength(10);
|
|
13
|
+
expect(CORE_PRINCIPLES).toHaveLength(10);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('registry ids match thinking-models.ts ids', () => {
|
|
17
|
+
const models = listThinkingModels();
|
|
18
|
+
const modelIds = models.map(m => m.id).sort();
|
|
19
|
+
const registryIds = CORE_PRINCIPLE_IDS.slice().sort();
|
|
20
|
+
expect(registryIds).toEqual(modelIds);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('registry names match thinking-models.ts fallback names', () => {
|
|
24
|
+
const models = listThinkingModels();
|
|
25
|
+
for (const model of models) {
|
|
26
|
+
const registryEntry = CORE_PRINCIPLES.find(p => p.id === model.id);
|
|
27
|
+
expect(registryEntry).toBeDefined();
|
|
28
|
+
// model.name comes from getFallbackName() when no workspace
|
|
29
|
+
expect(registryEntry!.name).toBe(model.name);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('no extra or missing ids in registry', () => {
|
|
34
|
+
const models = listThinkingModels();
|
|
35
|
+
const modelIdSet = new Set(models.map(m => m.id));
|
|
36
|
+
const registryIdSet = new Set(CORE_PRINCIPLE_IDS);
|
|
37
|
+
expect(registryIdSet).toEqual(modelIdSet);
|
|
38
|
+
});
|
|
39
|
+
});
|