psyclaw 0.31.2 → 0.31.3

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 (33) hide show
  1. package/dist/src/adapters/pi/extension.js +20 -1
  2. package/dist/src/adapters/pi/extension.js.map +1 -1
  3. package/dist/src/analysis/decision-points.d.ts +10 -0
  4. package/dist/src/analysis/decision-points.js +88 -0
  5. package/dist/src/analysis/decision-points.js.map +1 -0
  6. package/dist/src/analysis/method-rules.js +3 -2
  7. package/dist/src/analysis/method-rules.js.map +1 -1
  8. package/dist/src/analysis/runtime-tools.js +3 -1
  9. package/dist/src/analysis/runtime-tools.js.map +1 -1
  10. package/dist/src/analysis/shell-timeout.d.ts +18 -0
  11. package/dist/src/analysis/shell-timeout.js +58 -0
  12. package/dist/src/analysis/shell-timeout.js.map +1 -1
  13. package/dist/src/observability/config.d.ts +1 -0
  14. package/dist/src/observability/config.js +3 -1
  15. package/dist/src/observability/config.js.map +1 -1
  16. package/dist/src/observability/langfuse.d.ts +15 -4
  17. package/dist/src/observability/langfuse.js +38 -10
  18. package/dist/src/observability/langfuse.js.map +1 -1
  19. package/dist/src/observability/node-sdks.js +16 -4
  20. package/dist/src/observability/node-sdks.js.map +1 -1
  21. package/dist/src/observability/public-keys.d.ts +10 -0
  22. package/dist/src/observability/public-keys.js +10 -0
  23. package/dist/src/observability/public-keys.js.map +1 -1
  24. package/dist/src/project/workspace.js +16 -0
  25. package/dist/src/project/workspace.js.map +1 -1
  26. package/dist/src/session/modes.js +8 -3
  27. package/dist/src/session/modes.js.map +1 -1
  28. package/dist/src/updates/whats-new.d.ts +8 -0
  29. package/dist/src/updates/whats-new.js +40 -0
  30. package/dist/src/updates/whats-new.js.map +1 -0
  31. package/package.json +2 -2
  32. package/skills/core/analysis-plan/SKILL.md +5 -0
  33. package/skills/core/method-interactions/SKILL.md +2 -1
@@ -8,3 +8,13 @@
8
8
  export declare const PUBLIC_SENTRY_DSN = "https://b2b38f3bd3388684400e99b83baf2996@o4512050300911616.ingest.us.sentry.io/4512051818266624";
9
9
  export declare const PUBLIC_SENTRY_DSN_WEB = "https://ccdf2394345c2a184955d005d49d5451@o4512050300911616.ingest.us.sentry.io/4512051822395392";
10
10
  export declare const PUBLIC_POSTHOG_KEY = "phc_zmztC3DEHRT88FVxaFF7ihK7TmBqrzvbDQF7DARzr4P5";
11
+ /**
12
+ * Public Langfuse relay URL. When set, clients send traces to this proxy
13
+ * instead of directly to Langfuse Cloud, avoiding the need to embed the
14
+ * LANGFUSE_SECRET_KEY in release binaries. The relay holds the secret and
15
+ * forwards ingestion payloads to Langfuse.
16
+ *
17
+ * This value can be overridden at build time by setting the LANGFUSE_RELAY_URL
18
+ * environment variable, or at runtime (for local testing).
19
+ */
20
+ export declare const PUBLIC_LANGFUSE_RELAY_URL: string | undefined;
@@ -8,4 +8,14 @@
8
8
  export const PUBLIC_SENTRY_DSN = "https://b2b38f3bd3388684400e99b83baf2996@o4512050300911616.ingest.us.sentry.io/4512051818266624";
9
9
  export const PUBLIC_SENTRY_DSN_WEB = "https://ccdf2394345c2a184955d005d49d5451@o4512050300911616.ingest.us.sentry.io/4512051822395392";
10
10
  export const PUBLIC_POSTHOG_KEY = "phc_zmztC3DEHRT88FVxaFF7ihK7TmBqrzvbDQF7DARzr4P5";
11
+ /**
12
+ * Public Langfuse relay URL. When set, clients send traces to this proxy
13
+ * instead of directly to Langfuse Cloud, avoiding the need to embed the
14
+ * LANGFUSE_SECRET_KEY in release binaries. The relay holds the secret and
15
+ * forwards ingestion payloads to Langfuse.
16
+ *
17
+ * This value can be overridden at build time by setting the LANGFUSE_RELAY_URL
18
+ * environment variable, or at runtime (for local testing).
19
+ */
20
+ export const PUBLIC_LANGFUSE_RELAY_URL = "https://psyclaw-langfuse-relay.psyclaw.workers.dev";
11
21
  //# sourceMappingURL=public-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-keys.js","sourceRoot":"","sources":["../../../src/observability/public-keys.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,iGAAiG,CAAC;AAEpG,MAAM,CAAC,MAAM,qBAAqB,GAChC,iGAAiG,CAAC;AAEpG,MAAM,CAAC,MAAM,kBAAkB,GAAG,kDAAkD,CAAC"}
1
+ {"version":3,"file":"public-keys.js","sourceRoot":"","sources":["../../../src/observability/public-keys.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,iGAAiG,CAAC;AAEpG,MAAM,CAAC,MAAM,qBAAqB,GAChC,iGAAiG,CAAC;AAEpG,MAAM,CAAC,MAAM,kBAAkB,GAAG,kDAAkD,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAuB,oDAAoD,CAAC"}
@@ -67,6 +67,22 @@ export function defaultAnalysisPlan() {
67
67
  "| ID | Scope as worded | Outcome | Focal term | Implied tests | Status |",
68
68
  "| --- | --- | --- | --- | --- | --- |",
69
69
  "",
70
+ "## Decision points",
71
+ "",
72
+ "Fill in before running any outcome model. One row per analytic fork: sample and exclusion rules, coding and scoring keys, unit of analysis, groups analysed separately or pooled, model family and estimator, random effects and covariates, missing data, alpha, multiplicity family and method, criteria for support.",
73
+ "Settled by: brief, data, convention (almost any competent analyst would choose it), or intent (the brief and data leave it open and reasonable analysts differ). A framework default does not settle an intent row.",
74
+ "Intent rows: ask the researcher or approver when one is available and record the answer. Otherwise make the option closest to the brief's wording primary, run the main alternative as a labelled sensitivity analysis, and report both when their conclusions differ.",
75
+ "",
76
+ "| ID | Decision | Options | Settled by | Primary | Alternative (sensitivity) |",
77
+ "| --- | --- | --- | --- | --- | --- |",
78
+ "",
79
+ "## Verdict rules",
80
+ "",
81
+ "Lock before the first outcome model. Any later change is a deviation: record it in the decision log with its reason.",
82
+ "",
83
+ "| Hypothesis | Test | Alpha and multiplicity family | Counts as supported if |",
84
+ "| --- | --- | --- | --- |",
85
+ "",
70
86
  "## Variables and coding",
71
87
  "",
72
88
  "## Decisions",
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/project/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEpG,MAAM,CAAC,MAAM,UAAU,GAAG,YAAqB,CAAC;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAA8B,CAAC;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAiC,CAAC;AAExE,MAAM,UAAU,sBAAsB,CAAC,YAAY,GAAG,SAAS;IAC7D,OAAO;QACL,KAAK,YAAY,EAAE;QACnB,EAAE;QACF,6EAA6E;QAC7E,EAAE;QACF,OAAO;QACP,EAAE;QACF,0CAA0C;QAC1C,2DAA2D;QAC3D,2BAA2B;QAC3B,6DAA6D;QAC7D,mCAAmC;QACnC,sBAAsB;QACtB,oBAAoB;QACpB,2BAA2B;QAC3B,gDAAgD;QAChD,EAAE;QACF,QAAQ;QACR,EAAE;QACF,iHAAiH;QACjH,EAAE;QACF,+FAA+F;QAC/F,EAAE;QACF,OAAO;QACP,EAAE;QACF,aAAa;QACb,eAAe;QACf,iBAAiB;QACjB,mCAAmC;QACnC,2CAA2C;QAC3C,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,+BAA+B;QAC/B,EAAE;QACF,iBAAiB;QACjB,sBAAsB;QACtB,0BAA0B;QAC1B,6B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AQ,GAAG,MAAM,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;IAC3E,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAC;QACpE,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,eAAe,CAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,wCAAwC;IACxC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACpE,CAAC"}
@@ -74,12 +74,16 @@ export function unattendedAnalysisPrompt() {
74
74
  "- Explore the data in one or two batched checks (structure, codings, value counts, missingness, group cross-tabs together), not one variable per call.",
75
75
  "- Write the complete analysis script once the plan lists every model. Fix errors with targeted edits; add a late analysis as one appended section and rerun once.",
76
76
  "- Have the script print a short summary and write every reported number to tables or a key-numbers file. Read that file; do not page through long logs with sed, awk or tail.",
77
- "- When an approver tool is available, ask only about decisions the brief leaves open that change the analysis (sample rules, coding and scoring, missing data, model specification, inference and decision rules). Settle one decision per question: each option is one way to settle that single point, within the tool's option limit. Do not bundle several choices (for example interval type, number of resamples and a decision rule) into one option.",
77
+ "- When an approver tool is available, ask only about decisions the brief leaves open that change the analysis, that is, the decision points settled by intent (sample rules, coding and scoring, missing data, model specification, inference and decision rules). Settle one decision per question: each option is one way to settle that single point, within the tool's option limit. Do not bundle several choices (for example interval type, number of resamples and a decision rule) into one option.",
78
78
  "- Offer the standard alternatives for that point first (for example 1000, 5000 or 10000 bootstrap resamples; a percentile or BCa interval; each exclusion rule as its own question rather than a final N), and state the facts each option relies on so that their counts add up to the total.",
79
79
  "- If every option is rejected, do not switch to a new bundle: split the rejected options into single components and ask about each until each is settled. When the approver says which part of a plan is wrong, ask about the rules of that part one at a time, not about its result (each exclusion rule, not which N).",
80
+ "- Without an approver, fill in the decision points in analysis/plans/plan.md, each settled by brief, data, convention or intent. For each intent row, make the option closest to the brief's wording primary and run the main alternative as a labelled sensitivity analysis; when their conclusions differ, report both in the conclusion. A framework default or method rule does not settle an intent row.",
81
+ "- Lock the verdict rules (alpha, multiplicity family and method, what counts as support) in the plan before the first outcome model. Record any later change in decisions.md as a deviation with its reason.",
80
82
  "- Before settling a standard element yourself, ask whether it was planned: scale scoring, missing-data handling, a latent or measurement model and its estimator, fit criteria, and decision rules such as an equivalence bound.",
81
83
  "- Ask for each approval of a whole plan or report once; if it does not settle, proceed and record that in the report.",
82
84
  "- Costly computations: time a bootstrap, permutation test, simulation or repeated refit at a small size first (for example B = 50 or a subsample) and estimate the full run time. If it exceeds a few minutes, use an analytic equivalent or fewer draws yourself, without asking, and record the timing and the choice in decisions.md.",
85
+ "- Keep each timing probe under a minute: start at a few hundred rows or units and scale up only if it finishes fast, and wrap it in `timeout 120`. A probe that needs longer already tells you the full run is too slow.",
86
+ "- Once a script takes more than a few minutes, save each fitted model and costly result to disk (saveRDS or pickle) and load it when the inputs have not changed. After an edit, rerun only the section that changed, not the whole script; run the full script once more at the end.",
83
87
  "- Do not run /crosscheck, /verify or a re-implementation of the analysis in a second language unless the task asks for it. State in the report that the results were not cross-checked (未经核对).",
84
88
  "- Do not produce figures unless the task asks for them.",
85
89
  "- Fill in analysis/plans/plan.md once, before executing. Do not write analysis/HANDOFF.md unless the task asks for it.",
@@ -107,8 +111,9 @@ export function sessionModePrompt(mode) {
107
111
  "data/secret is script-only unless .psyclaw/data-access.json sets it to full: do not read, cat, head, or grep its contents. Analysis scripts may open it on disk. data/raw stays readable. The researcher sets other files with /data-access; do not edit that config.",
108
112
  "Soft「可以」only settles the current choice card. Script execution requires the typed ritual (unless /plan auto).",
109
113
  `Standing method rules: ${RESIDENT_METHOD_RULES}`,
110
- "Costly computations: before a bootstrap, permutation test, simulation or repeated refit, time it at a small size (for example B = 50 or a subsample) and estimate the full run time. If it exceeds a few minutes, do not decide yourself: present a choice card with the estimate and the options (run in full, fewer draws, an analytic equivalent, or skip), and wait for the user's choice.",
111
- "Before asking for plan approval, fill in the hypotheses-to-models table already laid out in analysis/plans/plan.md (one row per hypothesis and exploratory variable; keep its columns). When the approver can only pick options, the approval card lists approve plus one revise_<element> option per element, each with its concrete alternative.",
114
+ "Costly computations: before a bootstrap, permutation test, simulation or repeated refit, time it at a small size (for example B = 50 or a subsample) and estimate the full run time. If it exceeds a few minutes, do not decide yourself: present a choice card with the estimate and the options (run in full, fewer draws, an analytic equivalent, or skip), and wait for the user's choice. Keep the timing probe itself under a minute (a few hundred rows or units, wrapped in `timeout 120`).",
115
+ "Slow scripts: once a script takes more than a few minutes, save fitted models and costly results to disk and reload them while their inputs are unchanged; after an edit, rerun only the changed section.",
116
+ "Before asking for plan approval, fill in the hypotheses-to-models table, the decision points and the verdict rules already laid out in analysis/plans/plan.md (one row per hypothesis and exploratory variable; keep the columns). Put each decision point settled by intent on a choice card; settle the brief, data and convention rows yourself and list them in the plan. When the approver can only pick options, the approval card lists approve plus one revise_<element> option per element, each with its concrete alternative.",
112
117
  "Do not auto-start `/crosscheck` or `/verify`. Ask first; only run after explicit agreement. Final human approval remains via Panel「核实」or wake-options.",
113
118
  "Do not claim analysis complete, write final HANDOFF as done, or invite academic mode until the human verify gate passes.",
114
119
  "When proposing more analyses, never close with「已经足够」as prose — offer a concrete new method first and put「已经足够」only as a selectable last option.",
@@ -1 +1 @@
1
- {"version":3,"file":"modes.js","sourceRoot":"","sources":["../../../src/session/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB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AO;QACL,2BAA2B;QAC3B,oGAAoG;QACpG,yLAAyL;QACzL,oKAAoK;QACpK,oJAAoJ;QACpJ,kPAAkP;QAClP,qLAAqL;QACrL,sHAAsH;QACtH,uBAAuB,EAAE;KAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** User-facing notes per version, newest first. Versions without an entry stay quiet. */
2
+ export declare const WHATS_NEW: Record<string, readonly string[]>;
3
+ export declare function formatWhatsNew(version: string, notes: readonly string[]): string;
4
+ /**
5
+ * Notice text when `version` has notes and has not been shown yet; records the
6
+ * version as seen either way so the notice appears at most once.
7
+ */
8
+ export declare function takeWhatsNew(version: string, statePath: string, notes?: Record<string, readonly string[]>): Promise<string | undefined>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * What's new: a short notice the first time an interactive session starts on a
3
+ * new version. The last version shown is kept in the agent directory, so each
4
+ * version is announced once per machine. Headless runs never show it.
5
+ */
6
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
7
+ import { dirname } from "node:path";
8
+ /** User-facing notes per version, newest first. Versions without an entry stay quiet. */
9
+ export const WHATS_NEW = {
10
+ "0.31.3": [
11
+ "修复任务超时问题:耗时计算先小规模计时,慢脚本只重跑改动部分,并提示重复的完整重跑",
12
+ "优化学术决策细节:方案中逐项记录分析决策点及其依据,结果判定规则在跑结局模型前锁定;需要研究者意图的选择会先问你,无人审批时把替代方案作为敏感性分析一并报告",
13
+ ],
14
+ };
15
+ export function formatWhatsNew(version, notes) {
16
+ return [`PsyClaw 已更新到 v${version}:`, ...notes.map((note) => `· ${note}`)].join("\n");
17
+ }
18
+ /**
19
+ * Notice text when `version` has notes and has not been shown yet; records the
20
+ * version as seen either way so the notice appears at most once.
21
+ */
22
+ export async function takeWhatsNew(version, statePath, notes = WHATS_NEW) {
23
+ let lastSeen;
24
+ try {
25
+ lastSeen = JSON.parse(await readFile(statePath, "utf8")).lastSeenVersion;
26
+ }
27
+ catch { /* first run or unreadable state */ }
28
+ if (lastSeen === version)
29
+ return undefined;
30
+ try {
31
+ await mkdir(dirname(statePath), { recursive: true });
32
+ await writeFile(statePath, `${JSON.stringify({ lastSeenVersion: version }, null, 2)}\n`, "utf8");
33
+ }
34
+ catch {
35
+ return undefined; // without a record the notice would repeat every session
36
+ }
37
+ const entry = notes[version];
38
+ return entry && entry.length > 0 ? formatWhatsNew(version, entry) : undefined;
39
+ }
40
+ //# sourceMappingURL=whats-new.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whats-new.js","sourceRoot":"","sources":["../../../src/updates/whats-new.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,yFAAyF;AACzF,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,QAAQ,EAAE;QACR,2CAA2C;QAC3C,gFAAgF;KACjF;CACF,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,KAAwB;IACtE,OAAO,CAAC,iBAAiB,OAAO,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAe,EACf,SAAiB,EACjB,QAA2C,SAAS;IAEpD,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAI,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAmC,CAAC,eAAe,CAAC;IAC9G,CAAC;IAAC,MAAM,CAAC,CAAC,mCAAmC,CAAC,CAAC;IAC/C,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,SAAS,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,yDAAyD;IAC7E,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyclaw",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "description": "A standalone, evidence-grounded social-science research agent with research contracts, evidence gates, and recoverable workflows",
5
5
  "type": "module",
6
6
  "license": "CC-BY-NC-4.0",
@@ -70,7 +70,7 @@
70
70
  ]
71
71
  },
72
72
  "scripts": {
73
- "build": "node scripts/rebrand-pi.mjs && tsc -p tsconfig.json && node scripts/copy-panel.mjs",
73
+ "build": "node scripts/rebrand-pi.mjs && tsc -p tsconfig.json && node scripts/inject-build-env.mjs && node scripts/copy-panel.mjs",
74
74
  "typecheck": "tsc --noEmit -p tsconfig.json",
75
75
  "test": "vitest run",
76
76
  "test:ars": "vitest run tests/unit/bundled-ars.test.ts tests/unit/bundled-nature-compose.test.ts tests/unit/ars-profile.test.ts tests/unit/ars-mode-editor.test.ts tests/unit/ars-panel-plan.test.ts tests/unit/ars-bridge.test.ts",
@@ -21,6 +21,11 @@ Use this skill only in **analysis** mode. Do not start academic/ARS writing from
21
21
  - **Status**: `confirmatory` or `exploratory`; every implied test enters the multiplicity plan.
22
22
 
23
23
  Re-read the table before writing the report and state, for each implied test, the result or why it was not run. These tests are the first candidates for the "concrete new method" option on the cards below, and the table goes into the plan you submit for approval.
24
+ 2b. **Decision points and verdict rules (required, before any outcome model)** — Fill in the two tables under "Decision points" and "Verdict rules" in `analysis/plans/plan.md`.
25
+ - One row per analytic fork: sample and exclusion rules, coding and scoring keys, unit of analysis, groups analysed separately or pooled, model family and estimator, random effects and covariates, missing data, alpha, multiplicity family and method, criteria for support.
26
+ - **Settled by**: `brief`, `data`, `convention` (almost any competent analyst would choose it), or `intent` (the brief and data leave it open and reasonable analysts differ). A standing method rule or an injected method skill is a default, not a settlement: when the brief does not settle a fork that such a rule covers, the row is `intent`.
27
+ - Intent rows go on the choice cards below. With no one to ask (unattended), make the option closest to the brief's wording primary, run the main alternative as a labelled sensitivity analysis, and report both when their conclusions differ.
28
+ - Verdict rules (alpha, multiplicity family and method, what counts as support) are locked before the first outcome model. A later change is a deviation: record it with its reason in the decision log.
24
29
  3. **Per-analysis choices (required)** — Do **not** dump one mega-plan and stop. For **each** analysis you propose, present a short decision card:
25
30
  - Question (what this analysis answers)
26
31
  - Options: **first option must be a concrete new method**; you may add alternatives; put「已经足够,先执行已选」**last**, never as the default recommendation
@@ -11,7 +11,8 @@ license: MIT
11
11
  Use this when the claim is that an effect differs by group, condition, or another measured variable.
12
12
 
13
13
  - Mean-centre continuous predictors before forming a product. The interaction coefficient does not depend on centering; the lower-order terms do. Say which variables were centred.
14
- - Fit one pooled model per outcome with every lower-order term that the product implies. Read each group's slope from that model. A separate regression per subgroup is a supplement, not the test of a difference.
14
+ - To test whether groups differ, fit one pooled model per outcome with every lower-order term that the product implies, and read each group's slope from that model. A separate regression per subgroup is a supplement, not the test of a difference.
15
+ - When the brief asks a question separately for each group, each group's own estimate (from a model within that group) is the primary answer for that group, and follow-up analyses of that question are run within each group as well; the pooled interaction answers whether the groups differ. If the brief does not say whether groups are analysed separately or pooled, that is a decision point settled by intent.
15
16
  - An effect that is significant in one group and not in another is not evidence that the groups differ (Gelman & Stern, 2006; Nieuwenhuis, Forstmann, & Wagenmakers, 2011). The interaction term is that test.
16
17
  - A moderator together with a grouping factor needs the three-way term, so the moderation can differ by group.
17
18
  - An exploratory variable gets its main effect and a product with each focal exposure or condition, each with one sentence of theoretical reason. It moderates the exposure, not only group membership.