create-principles-disciple 1.154.2 → 1.154.4

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.
Files changed (115) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/worker/workspace-worker.js +7 -1
  3. package/codex-adapter/package.json +1 -1
  4. package/console/dist/server/models/ReceiptsConsoleModel.js +2 -2
  5. package/console/dist/web/assets/app.css +5 -0
  6. package/console/dist/web/assets/app.js +38 -38
  7. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  8. package/core/dist/runtime/feature-flags/feature-flag-contract.js +1 -0
  9. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  10. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  11. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +8 -0
  12. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  13. package/core/dist/runtime/pain-ingress-payload.d.ts +13 -0
  14. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  15. package/core/dist/runtime/pain-ingress-payload.js +26 -0
  16. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  17. package/core/dist/runtime/pain-ingress.d.ts +1 -1
  18. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  19. package/core/dist/runtime/pain-ingress.js +15 -2
  20. package/core/dist/runtime/pain-ingress.js.map +1 -1
  21. package/core/dist/runtime/pain-signal-bridge.d.ts +18 -0
  22. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  23. package/core/dist/runtime/pain-signal-bridge.js +49 -1
  24. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  25. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +7 -0
  26. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  27. package/core/dist/runtime/pain-signal-runtime-factory.js +2 -0
  28. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  29. package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
  30. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  31. package/core/dist/runtime/pain-to-principle-service.js +21 -1
  32. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  33. package/core/package.json +1 -1
  34. package/host-runtime/dist/auto-pain-authorization.d.ts +29 -0
  35. package/host-runtime/dist/auto-pain-authorization.js +32 -0
  36. package/host-runtime/dist/diagnostician-auto-run.d.ts +1 -1
  37. package/host-runtime/dist/diagnostician-auto-run.js +41 -0
  38. package/host-runtime/dist/governance-signal-admission.js +16 -0
  39. package/host-runtime/dist/index.d.ts +1 -0
  40. package/host-runtime/dist/index.js +1 -0
  41. package/host-runtime/package.json +1 -1
  42. package/install-layout/dist/active-release.d.ts +41 -0
  43. package/install-layout/dist/active-release.js +131 -0
  44. package/install-layout/dist/index.d.ts +56 -5
  45. package/install-layout/dist/index.js +166 -1
  46. package/install-layout/dist/mcp-binding-contract.d.ts +76 -12
  47. package/install-layout/dist/mcp-binding-contract.js +183 -75
  48. package/install-layout/package.json +1 -1
  49. package/package.json +3 -3
  50. package/pd-cli/dist/commands/health-ingestion.d.ts.map +1 -1
  51. package/pd-cli/dist/commands/health-ingestion.js +6 -2
  52. package/pd-cli/dist/commands/health-ingestion.js.map +1 -1
  53. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  54. package/pd-cli/dist/commands/pain-record.js +4 -1
  55. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  56. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  57. package/pd-cli/dist/commands/pain-retry.js +19 -1
  58. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  59. package/pd-cli/dist/commands/service-run-once.d.ts +6 -0
  60. package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -0
  61. package/pd-cli/dist/commands/service-run-once.js +139 -0
  62. package/pd-cli/dist/commands/service-run-once.js.map +1 -0
  63. package/pd-cli/dist/program.d.ts.map +1 -1
  64. package/pd-cli/dist/program.js +21 -0
  65. package/pd-cli/dist/program.js.map +1 -1
  66. package/pd-cli/dist/services/pain-flood-simulation-runner.d.ts.map +1 -1
  67. package/pd-cli/dist/services/pain-flood-simulation-runner.js +4 -0
  68. package/pd-cli/dist/services/pain-flood-simulation-runner.js.map +1 -1
  69. package/pd-cli/dist/services/service-host/index.d.ts +15 -0
  70. package/pd-cli/dist/services/service-host/index.d.ts.map +1 -0
  71. package/pd-cli/dist/services/service-host/index.js +15 -0
  72. package/pd-cli/dist/services/service-host/index.js.map +1 -0
  73. package/pd-cli/dist/services/service-host/install-identity.d.ts +79 -0
  74. package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -0
  75. package/pd-cli/dist/services/service-host/install-identity.js +166 -0
  76. package/pd-cli/dist/services/service-host/install-identity.js.map +1 -0
  77. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +134 -0
  78. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -0
  79. package/pd-cli/dist/services/service-host/locking/service-run-lock.js +659 -0
  80. package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -0
  81. package/pd-cli/dist/services/service-host/owner-projection.d.ts +47 -0
  82. package/pd-cli/dist/services/service-host/owner-projection.d.ts.map +1 -0
  83. package/pd-cli/dist/services/service-host/owner-projection.js +121 -0
  84. package/pd-cli/dist/services/service-host/owner-projection.js.map +1 -0
  85. package/pd-cli/dist/services/service-host/run-once.d.ts +96 -0
  86. package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -0
  87. package/pd-cli/dist/services/service-host/run-once.js +440 -0
  88. package/pd-cli/dist/services/service-host/run-once.js.map +1 -0
  89. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +117 -0
  90. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -0
  91. package/pd-cli/dist/services/service-host/status/service-run-status.js +150 -0
  92. package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -0
  93. package/pd-cli/dist/services/service-host/workspace-discovery.d.ts +71 -0
  94. package/pd-cli/dist/services/service-host/workspace-discovery.d.ts.map +1 -0
  95. package/pd-cli/dist/services/service-host/workspace-discovery.js +288 -0
  96. package/pd-cli/dist/services/service-host/workspace-discovery.js.map +1 -0
  97. package/pd-cli/dist/services/synthetic-baseline-runner.d.ts.map +1 -1
  98. package/pd-cli/dist/services/synthetic-baseline-runner.js +4 -0
  99. package/pd-cli/dist/services/synthetic-baseline-runner.js.map +1 -1
  100. package/pd-cli/package.json +1 -1
  101. package/plugin/dist/bundle.js +420 -420
  102. package/plugin/dist/core/signal-collector-host.d.ts +12 -0
  103. package/plugin/dist/openclaw.plugin.json +1 -1
  104. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +10 -2
  105. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +10 -2
  106. package/plugin/mcp/launcher.cjs +40 -4
  107. package/plugin/openclaw.plugin.json +1 -1
  108. package/plugin/package.json +1 -1
  109. package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +10 -2
  110. package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +10 -2
  111. package/release-manager/package.json +1 -1
  112. package/workbuddy-adapter/dist/worker/workspace-worker.js +4 -1
  113. package/workbuddy-adapter/package.json +1 -1
  114. package/workbuddy-adapter/plugin/mcp/launcher.cjs +40 -4
  115. package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +10 -2
@@ -81,6 +81,17 @@ export interface SignalCollectorHostOptions {
81
81
  * 未注入时为 no-op(earned 永不升级,行为=G3 之前)。
82
82
  */
83
83
  cueFeedbackRecorder?: (terms: readonly string[], wasCorrection: boolean) => void;
84
+ /**
85
+ * B-class automatic Pain submission authorization probe (Pain Ingress SPEC
86
+ * §9.6): consulted lazily ONLY when a signal is about to trigger an LLM
87
+ * classification or an automatic submission — never on the plain-message
88
+ * fast path (no per-message config I/O). Default: NOT authorized, so the
89
+ * B-class path is off unless the Workspace opts in via
90
+ * features.automatic_pain_submission. prompt.ts wires it to the Workspace
91
+ * `.pd/config.yaml` flag; detection bookkeeping (user_turns, keyword
92
+ * feedback) is unaffected.
93
+ */
94
+ isAutoPainAuthorized?: () => boolean;
84
95
  }
85
96
  export declare class SignalCollectorHost {
86
97
  private readonly wctx;
@@ -88,6 +99,7 @@ export declare class SignalCollectorHost {
88
99
  private readonly config;
89
100
  private readonly llmClassifier;
90
101
  private readonly cueFeedbackRecorder?;
102
+ private readonly isAutoPainAuthorized;
91
103
  /** rate limit 状态:sessionId → STRONG 计数桶 */
92
104
  private readonly rateLimit;
93
105
  /**
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
- "version": "4.2.0",
5
+ "version": "4.2.1",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -8,11 +8,17 @@ disable-model-invocation: false
8
8
 
9
9
  # PD Pain Signal (OpenClaw)
10
10
 
11
- Pain = a concrete behavior deviation relative to a named anchor. Three elements must hold together:
11
+ Pain is a locator and trigger, not the dataset unit; the sample unit is a complete-context behavior-deviation event. Compare the host's behavior with this Owner's verifiable expectations, intent, and applicable PD principles in the specific task and decision context. A successful task may still deviate; a failed task is not automatically a deviation. Do not treat "ask less", "act faster", or "check more" as universally better.
12
+
13
+ A complete event must link the original relevant conversation, tool calls and results, artifacts, and state changes; a summary never replaces the original trajectory. Keep expectations available to the host at decision time separate from post-hoc clarifications and evaluator inferences. Later corrections may be linked in the archive but must not leak into earlier decision-point evaluations. Do not discard a valid Pain only because the full trajectory is not yet available: use the existing authorized submission path, preserve verifiable signal/source references, and keep it marked as an incomplete candidate. Never call it a complete sample or bypass retention authorization to fill the gap.
14
+
15
+ See the [PD Behavior-Deviation Event and Relative Evaluation Contract](https://github.com/csuzngjh/principles/blob/main/docs/concepts/PD_BEHAVIOR_DEVIATION_EVENT_AND_RELATIVE_EVALUATION.md). The current submission interface still requires one primary anchor; that is an ingress-field constraint, not a claim that the full event has only one expectation basis. Preserve additional expectation or principle conflicts honestly in `reason`.
16
+
17
+ The current submission interface still requires a primary anchor. Its requirements are:
12
18
 
13
19
  1. **Anchor** — an Owner expectation, an established principle, or an in-force Agent Instruction / Skill requirement.
14
20
  2. **Concrete behavior** — what you actually did or failed to do.
15
- 3. **Significant deviation** — a describable gap against that anchor.
21
+ 3. **Concrete, explainable deviation** — a describable gap against that anchor; impact size, repetition, and emotional intensity are not submission thresholds.
16
22
 
17
23
  No proven impact, no repetition and no prior Owner correction are NOT reasons to withhold a submission. They only help the Owner decide attention priority.
18
24
 
@@ -76,6 +82,8 @@ If you cannot classify the anchor into one of the three types, do not submit. Cl
76
82
 
77
83
  ## `reason` — six parts, in this order
78
84
 
85
+ These six parts describe the primary anchor required by the current submission interface; they are not the complete event data model. Post-hoc clarifications and evaluator inferences must remain separate in the full event record and must never be presented as an Owner quote or as knowledge available to the host at the time. Inference alone does not satisfy the current anchored-submission contract; it may be retained as material awaiting verification, never disguised as a verified deviation.
86
+
79
87
  1. **Anchor** — quote or name it (principle id@version, instruction path#section, Owner statement + location).
80
88
  2. **Anchor source and citation grade** — `verbatim` / `paraphrase` / `recollection` / `inference`. Do not upgrade the grade. A `recollection` or `inference` alone is not enough: confirm the wording with the Owner first.
81
89
  3. **Observed behavior** — specific actions, order, skipped steps, overreach. Not "the quality was poor".
@@ -8,11 +8,17 @@ disable-model-invocation: false
8
8
 
9
9
  # PD Pain Signal(OpenClaw)
10
10
 
11
- Pain = 相对某个明确锚点的、具体的行为背离。三要素必须同时成立:
11
+ Pain 是定位和触发信号,不是数据集样本本体;样本单位是有完整上下文的行为偏差事件。必须在具体 Owner、任务和决策时点中,比较宿主行为与当时可证实的用户预期、意图及适用 PD 原则。任务成功仍可能偏离;任务失败也不自动意味着偏离。不得把“少询问、执行快、检查多”等行为风格当作普遍更好。
12
+
13
+ 完整事件需要关联原始相关对话轨迹、工具调用与返回、产物和状态变化;摘要不能替代原始轨迹。区分当时宿主有机会获知的期望、事后澄清和评价者推断。完整归档可以包含后续纠正,但不得将后续信息泄漏给更早的决策点评测。完整轨迹暂不可用时,不要因此丢弃合法 Pain:按现有授权入口保存可验证信号与来源线索,明确保留为不完整候选,不得宣称完整样本,也不得绕过留存授权补齐。
14
+
15
+ 规范详见 [PD 行为偏差事件与相对评价规范](https://github.com/csuzngjh/principles/blob/main/docs/concepts/PD_BEHAVIOR_DEVIATION_EVENT_AND_RELATIVE_EVALUATION.md)。当前提交接口仍要求一个主锚点;这是入口字段约束,不代表完整事件只包含一个期望依据。额外期望或原则冲突应在 reason 中如实保留。
16
+
17
+ 当前提交接口的主锚点仍需满足以下要求:
12
18
 
13
19
  1. **锚点** —— Owner 的明示要求、既有原则,或生效中的 Agent 指令 / Skill 要求。
14
20
  2. **具体行为** —— 你实际做了什么、漏了什么。
15
- 3. **显著背离** —— 相对该锚点可以说清楚的差距。
21
+ 3. **具体可说明的背离** —— 相对该锚点可以说清楚的差距;影响大小、重复次数和情绪强度不是提交门槛。
16
22
 
17
23
  没有证明影响、没有重复发生、Owner 之前没纠正过,都**不是**不提交的理由,只影响 Owner 的注意力排序。
18
24
 
@@ -76,6 +82,8 @@ Owner 说过 —— 本次对话、Owner 文档或已批准的决定。`anchorRe
76
82
 
77
83
  ## `reason` —— 六部分,按顺序
78
84
 
85
+ 以下六部分描述当前提交入口需要表达的主锚点,不等于完整事件的数据模型。完整事件中的事后澄清和评价者推断必须分开保存,不能冒充 Owner 原话或宿主当时已知的要求;只有推断不足以满足当前有锚点提交约束时,可以保留为待核验材料,不得伪装成已验证偏差。
86
+
79
87
  1. **锚点** —— 引用或指明(原则 id@version、指令 path#section、Owner 原话 + 出处)。
80
88
  2. **锚点来源与引用等级** —— `verbatim` / `paraphrase` / `recollection` / `inference`。不得抬高等级。仅有 `recollection` 或 `inference` 时不够:先与 Owner 确认原话。
81
89
  3. **观察到的行为** —— 具体动作、顺序、跳过的步骤、越界之处。不要写"质量不好"。
@@ -435,6 +435,33 @@ function readAbsoluteWorkspaceField(parsed, field) {
435
435
  * Comparison uses canonical directory identity so a junction, alias or case
436
436
  * difference cannot smuggle one host's tree past another host's claim.
437
437
  */
438
+ /**
439
+ * Read the workspaceDir of another host's persisted payload binding, but only
440
+ * when the binding passes the SAME full shape validation the launcher applies
441
+ * to its own binding (schemaVersion, host marker, absolute workspaceDir/
442
+ * runtimeDir/serverEntry, semver versions.mcpServer, canonical server entry).
443
+ * A binding that would fail launch-time validation cannot form a workspace
444
+ * claim — fail-closed, mirroring `readWorkspaceFromBinding` in
445
+ * @principles/install-layout.
446
+ */
447
+ function payloadBindingWorkspaceClaim(file, host) {
448
+ const parsed = readJson(file);
449
+ if (parsed === undefined) return undefined;
450
+ if (parsed.schemaVersion !== BINDING_SCHEMA) return undefined;
451
+ if (parsed.host !== host) return undefined;
452
+ if (typeof parsed.workspaceDir !== 'string' || !path.isAbsolute(parsed.workspaceDir.trim())) return undefined;
453
+ if (typeof parsed.runtimeDir !== 'string' || !path.isAbsolute(parsed.runtimeDir.trim())) return undefined;
454
+ if (typeof parsed.serverEntry !== 'string' || !path.isAbsolute(parsed.serverEntry.trim())) return undefined;
455
+ if (!isRecord(parsed.versions) || typeof parsed.versions.mcpServer !== 'string' || !SEMVER.test(parsed.versions.mcpServer)) return undefined;
456
+ // getCanonicalMcpServerEntry mirror: Codex uses the npm-dependency layout,
457
+ // the shared-runtime hosts the component layout.
458
+ const canonical = host === 'codex'
459
+ ? path.join(parsed.runtimeDir, 'node_modules', '@principles', 'pd-mcp-server', 'dist', 'index.js')
460
+ : path.join(parsed.runtimeDir, 'pd-mcp-server', 'dist', 'index.js');
461
+ if (!samePath(parsed.serverEntry, canonical)) return undefined;
462
+ return path.resolve(parsed.workspaceDir.trim());
463
+ }
464
+
438
465
  function hostDeclaredWorkspaceClaims(roots) {
439
466
  const claims = [];
440
467
  const declarationFiles = [
@@ -449,17 +476,26 @@ function hostDeclaredWorkspaceClaims(roots) {
449
476
  const dataRoot = path.join(roots.codexHome, 'plugins', 'data');
450
477
  for (const entry of fs.readdirSync(dataRoot)) {
451
478
  if (typeof entry !== 'string' || !entry.startsWith('principles-disciple-')) continue;
452
- const bound = readAbsoluteWorkspaceField(readJson(path.join(dataRoot, entry, 'mcp-binding.json')), 'workspaceDir');
479
+ const bound = payloadBindingWorkspaceClaim(path.join(dataRoot, entry, 'mcp-binding.json'), 'codex');
453
480
  if (bound !== undefined) claims.push({ host: 'codex', workspaceDir: bound });
454
481
  }
455
482
  } catch {
456
483
  // No Codex plugin data on this machine — nothing to claim.
457
484
  }
458
- const wbBound = readAbsoluteWorkspaceField(
459
- readJson(path.join(roots.homeDir, '.pd', 'workbuddy-marketplace', 'principles-disciple', 'mcp-binding.json')),
460
- 'workspaceDir',
485
+ const wbBound = payloadBindingWorkspaceClaim(
486
+ path.join(roots.homeDir, '.pd', 'workbuddy-marketplace', 'principles-disciple', 'mcp-binding.json'),
487
+ 'workbuddy',
461
488
  );
462
489
  if (wbBound !== undefined) claims.push({ host: 'workbuddy', workspaceDir: wbBound });
490
+ // P0-1: the OpenClaw plugin persists its own binding beside its installed
491
+ // extension (<openclawHome>/extensions/principles-disciple/mcp-binding.json).
492
+ // Without this read, a non-default workspace OpenClaw bound via
493
+ // PD_WORKSPACE_DIR/OPENCLAW_WORKSPACE was invisible to ownership checks.
494
+ const ocBound = payloadBindingWorkspaceClaim(
495
+ path.join(roots.openclawHome, 'extensions', 'principles-disciple', 'mcp-binding.json'),
496
+ 'openclaw',
497
+ );
498
+ if (ocBound !== undefined) claims.push({ host: 'openclaw', workspaceDir: ocBound });
463
499
  return claims;
464
500
  }
465
501
 
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
- "version": "4.2.0",
5
+ "version": "4.2.1",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,11 +8,17 @@ disable-model-invocation: false
8
8
 
9
9
  # PD Pain Signal (OpenClaw)
10
10
 
11
- Pain = a concrete behavior deviation relative to a named anchor. Three elements must hold together:
11
+ Pain is a locator and trigger, not the dataset unit; the sample unit is a complete-context behavior-deviation event. Compare the host's behavior with this Owner's verifiable expectations, intent, and applicable PD principles in the specific task and decision context. A successful task may still deviate; a failed task is not automatically a deviation. Do not treat "ask less", "act faster", or "check more" as universally better.
12
+
13
+ A complete event must link the original relevant conversation, tool calls and results, artifacts, and state changes; a summary never replaces the original trajectory. Keep expectations available to the host at decision time separate from post-hoc clarifications and evaluator inferences. Later corrections may be linked in the archive but must not leak into earlier decision-point evaluations. Do not discard a valid Pain only because the full trajectory is not yet available: use the existing authorized submission path, preserve verifiable signal/source references, and keep it marked as an incomplete candidate. Never call it a complete sample or bypass retention authorization to fill the gap.
14
+
15
+ See the [PD Behavior-Deviation Event and Relative Evaluation Contract](https://github.com/csuzngjh/principles/blob/main/docs/concepts/PD_BEHAVIOR_DEVIATION_EVENT_AND_RELATIVE_EVALUATION.md). The current submission interface still requires one primary anchor; that is an ingress-field constraint, not a claim that the full event has only one expectation basis. Preserve additional expectation or principle conflicts honestly in `reason`.
16
+
17
+ The current submission interface still requires a primary anchor. Its requirements are:
12
18
 
13
19
  1. **Anchor** — an Owner expectation, an established principle, or an in-force Agent Instruction / Skill requirement.
14
20
  2. **Concrete behavior** — what you actually did or failed to do.
15
- 3. **Significant deviation** — a describable gap against that anchor.
21
+ 3. **Concrete, explainable deviation** — a describable gap against that anchor; impact size, repetition, and emotional intensity are not submission thresholds.
16
22
 
17
23
  No proven impact, no repetition and no prior Owner correction are NOT reasons to withhold a submission. They only help the Owner decide attention priority.
18
24
 
@@ -76,6 +82,8 @@ If you cannot classify the anchor into one of the three types, do not submit. Cl
76
82
 
77
83
  ## `reason` — six parts, in this order
78
84
 
85
+ These six parts describe the primary anchor required by the current submission interface; they are not the complete event data model. Post-hoc clarifications and evaluator inferences must remain separate in the full event record and must never be presented as an Owner quote or as knowledge available to the host at the time. Inference alone does not satisfy the current anchored-submission contract; it may be retained as material awaiting verification, never disguised as a verified deviation.
86
+
79
87
  1. **Anchor** — quote or name it (principle id@version, instruction path#section, Owner statement + location).
80
88
  2. **Anchor source and citation grade** — `verbatim` / `paraphrase` / `recollection` / `inference`. Do not upgrade the grade. A `recollection` or `inference` alone is not enough: confirm the wording with the Owner first.
81
89
  3. **Observed behavior** — specific actions, order, skipped steps, overreach. Not "the quality was poor".
@@ -8,11 +8,17 @@ disable-model-invocation: false
8
8
 
9
9
  # PD Pain Signal(OpenClaw)
10
10
 
11
- Pain = 相对某个明确锚点的、具体的行为背离。三要素必须同时成立:
11
+ Pain 是定位和触发信号,不是数据集样本本体;样本单位是有完整上下文的行为偏差事件。必须在具体 Owner、任务和决策时点中,比较宿主行为与当时可证实的用户预期、意图及适用 PD 原则。任务成功仍可能偏离;任务失败也不自动意味着偏离。不得把“少询问、执行快、检查多”等行为风格当作普遍更好。
12
+
13
+ 完整事件需要关联原始相关对话轨迹、工具调用与返回、产物和状态变化;摘要不能替代原始轨迹。区分当时宿主有机会获知的期望、事后澄清和评价者推断。完整归档可以包含后续纠正,但不得将后续信息泄漏给更早的决策点评测。完整轨迹暂不可用时,不要因此丢弃合法 Pain:按现有授权入口保存可验证信号与来源线索,明确保留为不完整候选,不得宣称完整样本,也不得绕过留存授权补齐。
14
+
15
+ 规范详见 [PD 行为偏差事件与相对评价规范](https://github.com/csuzngjh/principles/blob/main/docs/concepts/PD_BEHAVIOR_DEVIATION_EVENT_AND_RELATIVE_EVALUATION.md)。当前提交接口仍要求一个主锚点;这是入口字段约束,不代表完整事件只包含一个期望依据。额外期望或原则冲突应在 reason 中如实保留。
16
+
17
+ 当前提交接口的主锚点仍需满足以下要求:
12
18
 
13
19
  1. **锚点** —— Owner 的明示要求、既有原则,或生效中的 Agent 指令 / Skill 要求。
14
20
  2. **具体行为** —— 你实际做了什么、漏了什么。
15
- 3. **显著背离** —— 相对该锚点可以说清楚的差距。
21
+ 3. **具体可说明的背离** —— 相对该锚点可以说清楚的差距;影响大小、重复次数和情绪强度不是提交门槛。
16
22
 
17
23
  没有证明影响、没有重复发生、Owner 之前没纠正过,都**不是**不提交的理由,只影响 Owner 的注意力排序。
18
24
 
@@ -76,6 +82,8 @@ Owner 说过 —— 本次对话、Owner 文档或已批准的决定。`anchorRe
76
82
 
77
83
  ## `reason` —— 六部分,按顺序
78
84
 
85
+ 以下六部分描述当前提交入口需要表达的主锚点,不等于完整事件的数据模型。完整事件中的事后澄清和评价者推断必须分开保存,不能冒充 Owner 原话或宿主当时已知的要求;只有推断不足以满足当前有锚点提交约束时,可以保留为待核验材料,不得伪装成已验证偏差。
86
+
79
87
  1. **锚点** —— 引用或指明(原则 id@version、指令 path#section、Owner 原话 + 出处)。
80
88
  2. **锚点来源与引用等级** —— `verbatim` / `paraphrase` / `recollection` / `inference`。不得抬高等级。仅有 `recollection` 或 `inference` 时不够:先与 Owner 确认原话。
81
89
  3. **观察到的行为** —— 具体动作、顺序、跳过的步骤、越界之处。不要写"质量不好"。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.154.2",
3
+ "version": "1.154.4",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,7 @@
32
32
  import fs from 'node:fs';
33
33
  import path from 'node:path';
34
34
  import { computeFeatureFlagsFromConfig, createRuntimeStateHandle, createPainSignalBridge, isRetryWaitBackoffElapsed, PrincipleTreeLedgerAdapter, resolveDiagnosticianCapability, } from '@principles/core/runtime';
35
- import { loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, createGovernanceTrajectoryTurnReader, createHostIntentDocReader, saveHostToolDeclaration, HOST_TOOL_DECLARATION_VERSION, } from '@principles/host-runtime';
35
+ import { loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, createGovernanceTrajectoryTurnReader, createHostIntentDocReader, isAutomaticPainSubmissionAuthorized, saveHostToolDeclaration, HOST_TOOL_DECLARATION_VERSION, } from '@principles/host-runtime';
36
36
  import { WORKBUDDY_TOOL_SEMANTICS, WORKBUDDY_TOOL_SEMANTIC_MAPPINGS } from '../tool-semantics.js';
37
37
  import { catchUpWorkbuddyIngestion } from '../ingestion/catch-up.js';
38
38
  const WORKER_OWNER = 'companion-worker';
@@ -172,6 +172,9 @@ export async function runWorkbuddyWorkspaceWorkerCycle(options) {
172
172
  // PRI-1265: the worker's Stage A gets the bound session's ORIGINAL
173
173
  // turns from the workspace's own consent-tiered governance store.
174
174
  trajectoryTurnReader: createGovernanceTrajectoryTurnReader({ workspaceDir }),
175
+ // SPEC §9.6: lazy probe — a revoked flag stops persisted
176
+ // automatic_hook tasks at the bridge's execution boundary.
177
+ isAutoPainSubmissionAuthorized: () => isAutomaticPainSubmissionAuthorized(workspaceDir),
175
178
  });
176
179
  const executed = await bridge.executePendingDiagnosis({ taskId: candidate.taskId });
177
180
  diagnostician = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/workbuddy-adapter",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -435,6 +435,33 @@ function readAbsoluteWorkspaceField(parsed, field) {
435
435
  * Comparison uses canonical directory identity so a junction, alias or case
436
436
  * difference cannot smuggle one host's tree past another host's claim.
437
437
  */
438
+ /**
439
+ * Read the workspaceDir of another host's persisted payload binding, but only
440
+ * when the binding passes the SAME full shape validation the launcher applies
441
+ * to its own binding (schemaVersion, host marker, absolute workspaceDir/
442
+ * runtimeDir/serverEntry, semver versions.mcpServer, canonical server entry).
443
+ * A binding that would fail launch-time validation cannot form a workspace
444
+ * claim — fail-closed, mirroring `readWorkspaceFromBinding` in
445
+ * @principles/install-layout.
446
+ */
447
+ function payloadBindingWorkspaceClaim(file, host) {
448
+ const parsed = readJson(file);
449
+ if (parsed === undefined) return undefined;
450
+ if (parsed.schemaVersion !== BINDING_SCHEMA) return undefined;
451
+ if (parsed.host !== host) return undefined;
452
+ if (typeof parsed.workspaceDir !== 'string' || !path.isAbsolute(parsed.workspaceDir.trim())) return undefined;
453
+ if (typeof parsed.runtimeDir !== 'string' || !path.isAbsolute(parsed.runtimeDir.trim())) return undefined;
454
+ if (typeof parsed.serverEntry !== 'string' || !path.isAbsolute(parsed.serverEntry.trim())) return undefined;
455
+ if (!isRecord(parsed.versions) || typeof parsed.versions.mcpServer !== 'string' || !SEMVER.test(parsed.versions.mcpServer)) return undefined;
456
+ // getCanonicalMcpServerEntry mirror: Codex uses the npm-dependency layout,
457
+ // the shared-runtime hosts the component layout.
458
+ const canonical = host === 'codex'
459
+ ? path.join(parsed.runtimeDir, 'node_modules', '@principles', 'pd-mcp-server', 'dist', 'index.js')
460
+ : path.join(parsed.runtimeDir, 'pd-mcp-server', 'dist', 'index.js');
461
+ if (!samePath(parsed.serverEntry, canonical)) return undefined;
462
+ return path.resolve(parsed.workspaceDir.trim());
463
+ }
464
+
438
465
  function hostDeclaredWorkspaceClaims(roots) {
439
466
  const claims = [];
440
467
  const declarationFiles = [
@@ -449,17 +476,26 @@ function hostDeclaredWorkspaceClaims(roots) {
449
476
  const dataRoot = path.join(roots.codexHome, 'plugins', 'data');
450
477
  for (const entry of fs.readdirSync(dataRoot)) {
451
478
  if (typeof entry !== 'string' || !entry.startsWith('principles-disciple-')) continue;
452
- const bound = readAbsoluteWorkspaceField(readJson(path.join(dataRoot, entry, 'mcp-binding.json')), 'workspaceDir');
479
+ const bound = payloadBindingWorkspaceClaim(path.join(dataRoot, entry, 'mcp-binding.json'), 'codex');
453
480
  if (bound !== undefined) claims.push({ host: 'codex', workspaceDir: bound });
454
481
  }
455
482
  } catch {
456
483
  // No Codex plugin data on this machine — nothing to claim.
457
484
  }
458
- const wbBound = readAbsoluteWorkspaceField(
459
- readJson(path.join(roots.homeDir, '.pd', 'workbuddy-marketplace', 'principles-disciple', 'mcp-binding.json')),
460
- 'workspaceDir',
485
+ const wbBound = payloadBindingWorkspaceClaim(
486
+ path.join(roots.homeDir, '.pd', 'workbuddy-marketplace', 'principles-disciple', 'mcp-binding.json'),
487
+ 'workbuddy',
461
488
  );
462
489
  if (wbBound !== undefined) claims.push({ host: 'workbuddy', workspaceDir: wbBound });
490
+ // P0-1: the OpenClaw plugin persists its own binding beside its installed
491
+ // extension (<openclawHome>/extensions/principles-disciple/mcp-binding.json).
492
+ // Without this read, a non-default workspace OpenClaw bound via
493
+ // PD_WORKSPACE_DIR/OPENCLAW_WORKSPACE was invisible to ownership checks.
494
+ const ocBound = payloadBindingWorkspaceClaim(
495
+ path.join(roots.openclawHome, 'extensions', 'principles-disciple', 'mcp-binding.json'),
496
+ 'openclaw',
497
+ );
498
+ if (ocBound !== undefined) claims.push({ host: 'openclaw', workspaceDir: ocBound });
463
499
  return claims;
464
500
  }
465
501
 
@@ -7,11 +7,17 @@ description: 记录一条"相对锚点的显著行为背离"(Pain)。Owner
7
7
 
8
8
  # PD Pain Signal(WorkBuddy)
9
9
 
10
- Pain = 相对某个明确锚点的、具体的行为背离。三要素必须同时成立:
10
+ Pain 是定位和触发信号,不是数据集样本本体;样本单位是有完整上下文的行为偏差事件。必须在具体 Owner、任务和决策时点中,比较宿主行为与当时可证实的用户预期、意图及适用 PD 原则。任务成功仍可能偏离;任务失败也不自动意味着偏离。不得把“少询问、执行快、检查多”等行为风格当作普遍更好。
11
+
12
+ 完整事件需要关联原始相关对话轨迹、工具调用与返回、产物和状态变化;摘要不能替代原始轨迹。区分当时宿主有机会获知的期望、事后澄清和评价者推断。完整归档可以包含后续纠正,但不得将后续信息泄漏给更早的决策点评测。完整轨迹暂不可用时,不要因此丢弃合法 Pain:按现有授权入口保存可验证信号与来源线索,明确保留为不完整候选,不得宣称完整样本,也不得绕过留存授权补齐。
13
+
14
+ 规范详见 [PD 行为偏差事件与相对评价规范](https://github.com/csuzngjh/principles/blob/main/docs/concepts/PD_BEHAVIOR_DEVIATION_EVENT_AND_RELATIVE_EVALUATION.md)。当前提交接口仍要求一个主锚点;这是入口字段约束,不代表完整事件只包含一个期望依据。额外期望或原则冲突应在 reason 中如实保留。
15
+
16
+ 当前提交接口的主锚点仍需满足以下要求:
11
17
 
12
18
  1. **锚点** —— Owner 的明示要求、既有原则,或生效中的 Agent 指令 / Skill 要求。
13
19
  2. **具体行为** —— 你实际做了什么、漏了什么。
14
- 3. **显著背离** —— 相对该锚点可以说清楚的差距。
20
+ 3. **具体可说明的背离** —— 相对该锚点可以说清楚的差距;影响大小、重复次数和情绪强度不是提交门槛。
15
21
 
16
22
  没有证明影响、没有重复发生、Owner 之前没纠正过,都**不是**不提交的理由,只影响 Owner 的注意力排序。
17
23
 
@@ -76,6 +82,8 @@ Owner 说过 —— 本次对话、Owner 文档或已批准的决定。`anchorRe
76
82
 
77
83
  ## `reason` —— 六部分,按顺序
78
84
 
85
+ 以下六部分描述当前提交入口需要表达的主锚点,不等于完整事件的数据模型。完整事件中的事后澄清和评价者推断必须分开保存,不能冒充 Owner 原话或宿主当时已知的要求;只有推断不足以满足当前有锚点提交约束时,可以保留为待核验材料,不得伪装成已验证偏差。
86
+
79
87
  1. **锚点** —— 引用或指明(原则 id@version、指令 path#section、Owner 原话 + 出处)。
80
88
  2. **锚点来源与引用等级** —— `verbatim` / `paraphrase` / `recollection` / `inference`。不得抬高等级。仅有 `recollection` 或 `inference` 时不够:先与 Owner 确认原话。
81
89
  3. **观察到的行为** —— 具体动作、顺序、跳过的步骤、越界之处。不要写"质量不好"。