@deftai/directive-core 0.70.0 → 0.71.1

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 (79) hide show
  1. package/dist/branch/evaluate.js +7 -0
  2. package/dist/doctor/doctor-state.js +2 -2
  3. package/dist/eval/crud-telemetry.d.ts +59 -0
  4. package/dist/eval/crud-telemetry.js +307 -0
  5. package/dist/eval/health.d.ts +52 -0
  6. package/dist/eval/health.js +240 -0
  7. package/dist/eval/readback.d.ts +38 -0
  8. package/dist/eval/readback.js +209 -0
  9. package/dist/eval/report.d.ts +53 -0
  10. package/dist/eval/report.js +161 -0
  11. package/dist/eval/run.d.ts +79 -0
  12. package/dist/eval/run.js +309 -0
  13. package/dist/events/attribution-constants.d.ts +13 -0
  14. package/dist/events/attribution-constants.js +18 -0
  15. package/dist/events/attribution-ledger.d.ts +43 -0
  16. package/dist/events/attribution-ledger.js +61 -0
  17. package/dist/index.d.ts +5 -0
  18. package/dist/index.js +5 -0
  19. package/dist/init-deposit/gitignore.js +15 -5
  20. package/dist/intake/candidates-log.d.ts +0 -1
  21. package/dist/intake/candidates-log.js +5 -2
  22. package/dist/intake/issue-ingest.d.ts +8 -0
  23. package/dist/intake/issue-ingest.js +19 -1
  24. package/dist/intake/reconcile-issues.js +9 -2
  25. package/dist/layout/resolve.d.ts +2 -2
  26. package/dist/layout/resolve.js +2 -2
  27. package/dist/lifecycle/events.js +2 -0
  28. package/dist/orchestration/subagent-monitor.js +2 -2
  29. package/dist/policy/index.d.ts +2 -1
  30. package/dist/policy/index.js +15 -2
  31. package/dist/policy/value-feedback.d.ts +56 -0
  32. package/dist/policy/value-feedback.js +284 -0
  33. package/dist/preflight-cache/evaluate.js +4 -3
  34. package/dist/scope/audit-log.js +3 -3
  35. package/dist/scope/transition.js +16 -5
  36. package/dist/session/session-start.js +20 -0
  37. package/dist/slice/record.js +3 -3
  38. package/dist/task-surface/index.js +4 -1
  39. package/dist/triage/actions/candidates-log.d.ts +4 -4
  40. package/dist/triage/actions/candidates-log.js +4 -7
  41. package/dist/triage/actions/index.js +8 -32
  42. package/dist/triage/bootstrap/gitignore.d.ts +9 -3
  43. package/dist/triage/bootstrap/gitignore.js +77 -40
  44. package/dist/triage/bootstrap/index.d.ts +1 -1
  45. package/dist/triage/bootstrap/index.js +4 -3
  46. package/dist/triage/bulk/index.js +2 -2
  47. package/dist/triage/cache-path.d.ts +41 -0
  48. package/dist/triage/cache-path.js +115 -0
  49. package/dist/triage/help/registry-data.d.ts +48 -15
  50. package/dist/triage/help/registry-data.js +86 -15
  51. package/dist/triage/index.d.ts +2 -0
  52. package/dist/triage/index.js +2 -0
  53. package/dist/triage/queue/audit.js +2 -2
  54. package/dist/triage/queue/cache.js +2 -2
  55. package/dist/triage/reconcile/reconcile.js +4 -3
  56. package/dist/triage/scope/mutations-core.js +3 -2
  57. package/dist/triage/subscribe/index.d.ts +1 -1
  58. package/dist/triage/subscribe/index.js +4 -3
  59. package/dist/triage/summary/index.d.ts +2 -2
  60. package/dist/triage/summary/index.js +4 -3
  61. package/dist/triage/summary/reconcilable.d.ts +1 -1
  62. package/dist/triage/summary/reconcilable.js +3 -2
  63. package/dist/triage/welcome/constants.d.ts +2 -2
  64. package/dist/triage/welcome/constants.js +2 -2
  65. package/dist/triage/welcome/prior-state.js +3 -2
  66. package/dist/triage/welcome/summary.js +5 -4
  67. package/dist/value/adoption-emit.d.ts +14 -0
  68. package/dist/value/adoption-emit.js +67 -0
  69. package/dist/value/adoption-registry.d.ts +62 -0
  70. package/dist/value/adoption-registry.js +214 -0
  71. package/dist/value/feedback-file.d.ts +67 -0
  72. package/dist/value/feedback-file.js +353 -0
  73. package/dist/value/friction-emit.d.ts +10 -0
  74. package/dist/value/friction-emit.js +24 -0
  75. package/dist/value/readback.d.ts +86 -0
  76. package/dist/value/readback.js +503 -0
  77. package/dist/vbrief-validate/decomposition.js +1 -1
  78. package/dist/wip-cap/evaluate.js +3 -0
  79. package/package.json +35 -3
@@ -5,7 +5,7 @@ export const registryData = {
5
5
  name: "task triage:summary",
6
6
  summary: "One-line state for session-start ritual",
7
7
  refs: "(D2 / #1122)",
8
- description: "Emit the one-line triage state consumed by the session-start ritual. Always exits 0 (status surface, not a gate); appends a JSONL record to vbrief/.eval/summary-history.jsonl for observability.",
8
+ description: "Emit the one-line triage state consumed by the session-start ritual. Always exits 0 (status surface, not a gate); appends a JSONL record to vbrief/.triage-cache/summary-history.jsonl for observability.",
9
9
  usage: "task triage:summary [-- --json] [--no-history]",
10
10
  flags: [
11
11
  ["--json", "(off)", "Emit the structured record as JSON instead of the one-liner."],
@@ -321,7 +321,7 @@ export const registryData = {
321
321
  name: "task triage:reconcile",
322
322
  summary: "Self-heal audit log from on-disk vBRIEFs",
323
323
  refs: "(#1468)",
324
- description: "Idempotent repair verb: derive missing `accept` decisions for proposed/pending/active vBRIEFs that carry an x-vbrief/github-issue reference but have no entry in vbrief/.eval/candidates.jsonl. Recovers triage state after the gitignored audit log is reset/lost (#1464) without a full cache re-fetch. Never overrides an existing decision, so a re-run is a no-op.",
324
+ description: "Idempotent repair verb: derive missing `accept` decisions for proposed/pending/active vBRIEFs that carry an x-vbrief/github-issue reference but have no entry in vbrief/.triage-cache/candidates.jsonl. Recovers triage state after the gitignored audit log is reset/lost (#1464) without a full cache re-fetch. Never overrides an existing decision, so a re-run is a no-op.",
325
325
  usage: "task triage:reconcile [-- --repo owner/name] [--dry-run] [--json]",
326
326
  flags: [
327
327
  [
@@ -435,7 +435,7 @@ export const registryData = {
435
435
  name: "task triage:subscribe",
436
436
  summary: "Add label/milestone/issue to subscription",
437
437
  refs: "(D14 / #1133)",
438
- description: "Subscribe to a label / milestone / issue by appending a rule to plan.policy.triageScope[]. Emits a JSONL audit record to vbrief/.eval/subscription-history.jsonl.",
438
+ description: "Subscribe to a label / milestone / issue by appending a rule to plan.policy.triageScope[]. Emits a JSONL audit record to vbrief/.triage-cache/subscription-history.jsonl.",
439
439
  usage: "task triage:subscribe -- (--label=L | --milestone=M | --issue=N)",
440
440
  flags: [
441
441
  ["--label L", "(none)", "Subscribe to a label."],
@@ -504,7 +504,7 @@ export const registryData = {
504
504
  name: "task triage:audit-log:rotate",
505
505
  summary: "Rotate candidates.jsonl when bounded",
506
506
  refs: "(D20, coming)",
507
- description: "Rotate vbrief/.eval/candidates.jsonl when it exceeds the configured bound. Compacts terminal entries and preserves the open-work tail.",
507
+ description: "Rotate vbrief/.triage-cache/candidates.jsonl when it exceeds the configured bound. Compacts terminal entries and preserves the open-work tail.",
508
508
  usage: "task triage:audit-log:rotate [-- --max-lines N]",
509
509
  flags: [["--max-lines N", "(consumer default)", "Bound at which rotation fires."]],
510
510
  examples: ["task triage:audit-log:rotate -- --max-lines 10000"],
@@ -513,17 +513,87 @@ export const registryData = {
513
513
  },
514
514
  "task triage:metrics": {
515
515
  name: "task triage:metrics",
516
- summary: "Trend lines from summary-history.jsonl",
517
- refs: "(D17, coming)",
518
- description: "Print trend lines computed from vbrief/.eval/summary-history.jsonl: decisions-per-day, defer/accept ratio, stale-defer drift, etc.",
516
+ summary: "Attributed-value trend from the events ledger",
517
+ refs: "(#1709)",
518
+ description: "Report value-feedback attribution trends from .deft-cache/events.jsonl: total signal count plus per-class (value, bypass, adoption, friction) and per-event breakdowns over a time window. Alias of the value:show handler. Requires plan.policy.valueFeedback.enabled (default OFF) — exits blocked when disabled; an empty ledger prints a no-signals message. In the maintainer repo, skipped unless DEFT_VALUE_SELF_DOGFOOD=1.",
519
519
  usage: "task triage:metrics [-- --window=7d] [--format=text|json]",
520
520
  flags: [
521
- ["--window WINDOW", "7d", "Time window over which to aggregate."],
522
- ["--format text|json", "text", "Output shape."],
521
+ ["--window WINDOW", "7d", "Time window (e.g. 7d, 30d, 24h)."],
522
+ ["--format text|json", "text", "Output shape (json emits the full trend object)."],
523
523
  ],
524
- examples: ["task triage:metrics -- --window 30d"],
525
- see_also: ["task triage:summary", "#1119 / D17"],
526
- placeholder: true,
524
+ examples: ["task triage:metrics", "task triage:metrics -- --window=30d --format=json"],
525
+ see_also: [
526
+ "task policy:show --field=valueFeedback",
527
+ "task policy:enable-value-feedback -- --confirm",
528
+ "#1709",
529
+ ],
530
+ placeholder: false,
531
+ },
532
+ "task eval:health": {
533
+ name: "task eval:health",
534
+ summary: "Tier 0 static framework health score",
535
+ refs: "(#1703)",
536
+ description: "Aggregate static self-consistency gates (encoding, links, vBRIEF conformance, AGENTS.md freshness; content-manifest on framework-source trees) into a versioned 0–100 score. Detects contradictory / unsatisfiable gate pairs (#1694). Appends each run to .eval/results/health-history.jsonl. Session start may emit a budgeted [eval] advisory when health degrades.",
537
+ usage: "task eval:health [-- --json] [--no-persist] [--project-root PATH]",
538
+ flags: [
539
+ ["--json", "(off)", "Emit the structured HealthReport instead of the human summary."],
540
+ ["--no-persist", "(off)", "Run probes without appending to the health history ledger."],
541
+ [
542
+ "--project-root PATH",
543
+ "(cwd)",
544
+ "Project root override (Taskfile threads USER_WORKING_DIR).",
545
+ ],
546
+ ],
547
+ examples: ["task eval:health", "task eval:health -- --json"],
548
+ see_also: ["task eval:run", "task eval:report", "#1703"],
549
+ placeholder: false,
550
+ },
551
+ "task eval:run": {
552
+ name: "task eval:run",
553
+ summary: "Tier 2 golden corpus eval for a model",
554
+ refs: "(#1703)",
555
+ description: "Execute the fixed golden corpus with objective graders (CRUD schema/invention, surgical update, health fixture, rotating holdout tasks). Persists results to .eval/results/golden-runs.jsonl for champion–challenger diffs.",
556
+ usage: "task eval:run -- --model MODEL [--seed N] [--directive-version V] [--harness NAME] [--json] [--no-persist]",
557
+ flags: [
558
+ ["--model MODEL", "(required)", "Model identifier for the run record."],
559
+ ["--seed N", "(1,2,3)", "Repeatable seed(s); pass multiple --seed flags."],
560
+ ["--directive-version V", "(engine version)", "Pin the directive version label."],
561
+ ["--harness NAME", "deterministic-fixture", "Harness label stored on the run record."],
562
+ ["--json", "(off)", "Emit the GoldenRunRecord JSON."],
563
+ ["--no-persist", "(off)", "Run without appending to golden-runs.jsonl."],
564
+ [
565
+ "--project-root PATH",
566
+ "(cwd)",
567
+ "Project root override (Taskfile threads USER_WORKING_DIR).",
568
+ ],
569
+ ],
570
+ examples: [
571
+ "task eval:run -- --model gpt-5",
572
+ "task eval:run -- --model claude-sonnet --seed 1 --seed 2 --json",
573
+ ],
574
+ see_also: ["task eval:report", "task eval:health", "#1703"],
575
+ placeholder: false,
576
+ },
577
+ "task eval:report": {
578
+ name: "task eval:report",
579
+ summary: "Tier 2 champion–challenger diff with significance",
580
+ refs: "(#1703)",
581
+ description: "Diff two directive versions' latest golden runs for a model: primary/holdout/overall pass-rate deltas with two-proportion significance and a holdout tripwire when primary gains do not generalize (#1703 Goodhart guard).",
582
+ usage: "task eval:report -- --champion V --challenger V --model MODEL [--json] [--project-root PATH]",
583
+ flags: [
584
+ ["--champion V", "(required)", "Baseline directive version."],
585
+ ["--challenger V", "(required)", "Candidate directive version."],
586
+ ["--model MODEL", "(required)", "Model identifier shared by both runs."],
587
+ ["--json", "(off)", "Emit the GoldenEvalReport JSON."],
588
+ [
589
+ "--project-root PATH",
590
+ "(cwd)",
591
+ "Project root override (Taskfile threads USER_WORKING_DIR).",
592
+ ],
593
+ ],
594
+ examples: ["task eval:report -- --champion 0.58.0 --challenger 0.59.0 --model gpt-5"],
595
+ see_also: ["task eval:run", "task eval:health", "#1703"],
596
+ placeholder: false,
527
597
  },
528
598
  "task scope:promote": {
529
599
  name: "task scope:promote",
@@ -548,7 +618,7 @@ export const registryData = {
548
618
  name: "task scope:demote",
549
619
  summary: "pending/ -> proposed/ (set status proposed)",
550
620
  refs: "(D1 / #1121)",
551
- description: "Demote a vBRIEF scope from vbrief/pending/ back to vbrief/proposed/ and append a structured audit entry (including a demote_meta block) to vbrief/.eval/scope-lifecycle.jsonl. Supports single-file and --batch (cohort shrink / cap relief) modes.",
621
+ description: "Demote a vBRIEF scope from vbrief/pending/ back to vbrief/proposed/ and append a structured audit entry (including a demote_meta block) to vbrief/.triage-cache/scope-lifecycle.jsonl. Supports single-file and --batch (cohort shrink / cap relief) modes.",
552
622
  usage: "task scope:demote -- <file> [--reason TEXT] | task scope:demote -- --batch [--older-than-days N]",
553
623
  flags: [
554
624
  ["<file>", "(required for single)", "Path to vBRIEF."],
@@ -698,13 +768,13 @@ export const registryData = {
698
768
  [
699
769
  "--draft PATH",
700
770
  "(required)",
701
- "Approved decomposition JSON draft; prefer vbrief/.eval/decompositions/<parent-slug>.json.",
771
+ "Approved decomposition JSON draft; prefer vbrief/.triage-cache/decompositions/<parent-slug>.json.",
702
772
  ],
703
773
  ["--check", "(off)", "Validate only; do not write."],
704
774
  ["--date YYYY-MM-DD", "today", "Creation date for generated child filenames."],
705
775
  ],
706
776
  examples: [
707
- "task scope:decompose -- vbrief/active/epic.vbrief.json --draft vbrief/.eval/decompositions/epic.json --check",
777
+ "task scope:decompose -- vbrief/active/epic.vbrief.json --draft vbrief/.triage-cache/decompositions/epic.json --check",
708
778
  ],
709
779
  see_also: ["task scope:promote", "skills/deft-directive-decompose/SKILL.md"],
710
780
  placeholder: false,
@@ -759,6 +829,7 @@ export const registryData = {
759
829
  "task triage:metrics",
760
830
  ],
761
831
  ],
832
+ ["Framework eval (#1703)", ["task eval:health", "task eval:run", "task eval:report"]],
762
833
  ],
763
834
  categoriesScope: [
764
835
  ["Promote / demote", ["task scope:promote", "task scope:demote"]],
@@ -9,6 +9,8 @@
9
9
  export * as actions from "./actions/index.js";
10
10
  export * as bootstrap from "./bootstrap/index.js";
11
11
  export * as bulk from "./bulk/index.js";
12
+ export * as cachePath from "./cache-path.js";
13
+ export * from "./cache-path.js";
12
14
  export * as classify from "./classify/index.js";
13
15
  export * as help from "./help/index.js";
14
16
  export * as queue from "./queue/index.js";
@@ -9,6 +9,8 @@
9
9
  export * as actions from "./actions/index.js";
10
10
  export * as bootstrap from "./bootstrap/index.js";
11
11
  export * as bulk from "./bulk/index.js";
12
+ export * as cachePath from "./cache-path.js";
13
+ export * from "./cache-path.js";
12
14
  export * as classify from "./classify/index.js";
13
15
  export * as help from "./help/index.js";
14
16
  export * as queue from "./queue/index.js";
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
- import { resolveEvalPath } from "../../layout/resolve.js";
3
+ import { resolveCandidatesLogPath } from "../cache-path.js";
4
4
  /** Resolve audit log path; mirrors candidates_log._resolve_path (framework root). */
5
5
  export function resolveAuditLogPath(options = {}) {
6
6
  if (options.auditLogPath !== null && options.auditLogPath !== undefined) {
@@ -12,7 +12,7 @@ export function resolveAuditLogPath(options = {}) {
12
12
  : envRoot.length > 0
13
13
  ? resolve(envRoot)
14
14
  : process.cwd();
15
- return resolveEvalPath(root, "candidates.jsonl");
15
+ return resolveCandidatesLogPath(root);
16
16
  }
17
17
  /** Read audit log entries, optionally filtered by repo. */
18
18
  export function readAuditEntries(repo, options = {}) {
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { resolveEvalPath } from "../../layout/resolve.js";
3
+ import { resolveTriageCachePath } from "../cache-path.js";
4
4
  import { extractAuthor, extractMilestone } from "../scope-drift/cache-walker.js";
5
5
  import { CACHE_DIR_NAME, CACHE_SOURCE_GITHUB_ISSUE } from "./constants.js";
6
6
  import { hasActiveScopeIgnores, isRawIssueScopeIgnored, resolveScopeIgnores, } from "./scope-ignores-filter.js";
@@ -23,7 +23,7 @@ export function resolveSlicesLogPath(options = {}) {
23
23
  : envRoot.length > 0
24
24
  ? resolve(envRoot)
25
25
  : process.cwd();
26
- return resolveEvalPath(root, "slices.jsonl");
26
+ return resolveTriageCachePath(root, "slices.jsonl");
27
27
  }
28
28
  /** Read slices.jsonl records. */
29
29
  export function loadSliceRecords(options = {}) {
@@ -2,7 +2,8 @@ import { execFileSync } from "node:child_process";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { appendFileSync, mkdirSync } from "node:fs";
4
4
  import { dirname, resolve } from "node:path";
5
- import { resolveEvalPath, resolveLifecycleFolder } from "../../layout/resolve.js";
5
+ import { resolveLifecycleFolder } from "../../layout/resolve.js";
6
+ import { resolveCandidatesLogPath } from "../cache-path.js";
6
7
  import { auditKey, existingAuditRefs, scanLifecycleRefs } from "./audit.js";
7
8
  import { BACKFILL_FOLDERS, RECONCILE_ACTOR, } from "./types.js";
8
9
  const GIT_ORIGIN_RE = /^(?:https?:\/\/(?:[^@/]+@)?github\.com\/|git@github\.com:|ssh:\/\/git@github\.com[:/])([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*?)(?:\.git)?\/?\s*$/;
@@ -33,7 +34,7 @@ function newDecisionId() {
33
34
  }
34
35
  export function findReconcilable(projectRoot, options = {}) {
35
36
  const root = resolve(projectRoot);
36
- const auditPath = options.auditLogPath ?? resolveEvalPath(root, "candidates.jsonl");
37
+ const auditPath = options.auditLogPath ?? resolveCandidatesLogPath(root);
37
38
  const existing = existingAuditRefs(auditPath);
38
39
  const defaultRepo = options.defaultRepo ?? null;
39
40
  const items = [];
@@ -116,7 +117,7 @@ export function reconcile(projectRoot, options = {}) {
116
117
  if (defaultRepo === null) {
117
118
  defaultRepo = inferRepoFromGit(root);
118
119
  }
119
- const auditPath = options.auditLogPath ?? resolveEvalPath(root, "candidates.jsonl");
120
+ const auditPath = options.auditLogPath ?? resolveCandidatesLogPath(root);
120
121
  const dryRun = options.dryRun ?? false;
121
122
  const result = {
122
123
  projectRoot: root,
@@ -2,9 +2,10 @@ import { randomUUID } from "node:crypto";
2
2
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
3
3
  import { tmpdir } from "node:os";
4
4
  import { dirname, join } from "node:path";
5
- import { resolveEvalPath, resolveProjectDefinitionPath } from "../../layout/resolve.js";
5
+ import { resolveProjectDefinitionPath } from "../../layout/resolve.js";
6
6
  import { migrateLegacyPolicyKey, PLAN_POLICY_KEY } from "../../policy/plan-extensions.js";
7
7
  import { projectDefinitionMutationLock } from "../../vbrief-build/project-definition-io.js";
8
+ import { resolveTriageCachePath } from "../cache-path.js";
8
9
  import { SUBSCRIPTION_HISTORY_SCHEMA } from "./constants.js";
9
10
  import { pyStrRepr } from "./python-repr.js";
10
11
  import { utcIso } from "./time.js";
@@ -61,7 +62,7 @@ function resolveActor(actor) {
61
62
  }
62
63
  }
63
64
  export function recordSubscriptionChange(projectRoot, options) {
64
- const historyPath = resolveEvalPath(projectRoot, "subscription-history.jsonl");
65
+ const historyPath = resolveTriageCachePath(projectRoot, "subscription-history.jsonl");
65
66
  const record = {
66
67
  schema: SUBSCRIPTION_HISTORY_SCHEMA,
67
68
  change_id: randomUUID(),
@@ -1,4 +1,4 @@
1
- export declare const SUBSCRIPTION_HISTORY_REL_PATH = "vbrief/.eval/subscription-history.jsonl";
1
+ export declare const SUBSCRIPTION_HISTORY_REL_PATH = "vbrief/.triage-cache/subscription-history.jsonl";
2
2
  export declare const SUBSCRIPTION_HISTORY_SCHEMA = "deft.triage.subscription-change.v1";
3
3
  export declare const PROJECT_DEFINITION_REL_PATH = "vbrief/PROJECT-DEFINITION.vbrief.json";
4
4
  /** Python ``!r``-style quoting for parity with triage_subscribe.py messages. */
@@ -1,10 +1,11 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
3
3
  import { basename, join } from "node:path";
4
- import { resolveEvalPath, resolveProjectDefinitionPath } from "../../layout/resolve.js";
4
+ import { resolveProjectDefinitionPath } from "../../layout/resolve.js";
5
5
  import { migrateLegacyPolicyKey, PLAN_POLICY_KEY } from "../../policy/plan-extensions.js";
6
6
  import { projectDefinitionMutationLock } from "../../vbrief-build/project-definition-io.js";
7
- export const SUBSCRIPTION_HISTORY_REL_PATH = "vbrief/.eval/subscription-history.jsonl";
7
+ import { resolveTriageCachePath } from "../cache-path.js";
8
+ export const SUBSCRIPTION_HISTORY_REL_PATH = "vbrief/.triage-cache/subscription-history.jsonl";
8
9
  export const SUBSCRIPTION_HISTORY_SCHEMA = "deft.triage.subscription-change.v1";
9
10
  export const PROJECT_DEFINITION_REL_PATH = "vbrief/PROJECT-DEFINITION.vbrief.json";
10
11
  /** Python ``!r``-style quoting for parity with triage_subscribe.py messages. */
@@ -90,7 +91,7 @@ function resolveActor(actor) {
90
91
  }
91
92
  }
92
93
  export function recordSubscriptionChange(projectRoot, options) {
93
- const historyPath = resolveEvalPath(projectRoot, "subscription-history.jsonl");
94
+ const historyPath = resolveTriageCachePath(projectRoot, "subscription-history.jsonl");
94
95
  const record = {
95
96
  schema: SUBSCRIPTION_HISTORY_SCHEMA,
96
97
  change_id: randomUUID(),
@@ -4,9 +4,9 @@ export declare const MAX_LINE_CHARS = 120;
4
4
  export { DEFAULT_WIP_CAP, PROJECT_DEFINITION_REL_PATH };
5
5
  export declare const CACHE_DIR_NAME = ".deft-cache";
6
6
  export declare const CACHE_SOURCE = "github-issue";
7
- export declare const CANDIDATES_LOG_REL_PATH = "vbrief/.eval/candidates.jsonl";
7
+ export declare const CANDIDATES_LOG_REL_PATH = "vbrief/.triage-cache/candidates.jsonl";
8
8
  export { latestDecisions, readAuditLog } from "../actions/candidates-log.js";
9
- export declare const SUMMARY_HISTORY_REL_PATH = "vbrief/.eval/summary-history.jsonl";
9
+ export declare const SUMMARY_HISTORY_REL_PATH = "vbrief/.triage-cache/summary-history.jsonl";
10
10
  export declare const SUMMARY_HISTORY_SCHEMA = "deft.triage.summary.v1";
11
11
  /** D2 repeat-suppression window for session-start triage one-liner (#1122 / #1279). */
12
12
  export declare const D2_SUPPRESSION_WINDOW_HOURS = 4;
@@ -1,11 +1,12 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
3
3
  import { join, resolve as pathResolve } from "node:path";
4
- import { hasArtifactSuffix, resolveEvalPath, resolveLifecycleFolder, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
4
+ import { hasArtifactSuffix, resolveLifecycleFolder, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
5
5
  import { readPlanPolicy } from "../../policy/plan-extensions.js";
6
6
  import { loadProjectDefinition, PROJECT_DEFINITION_REL_PATH } from "../../policy/resolve.js";
7
7
  import { countVbriefWip, DEFAULT_WIP_CAP, resolveWipCap } from "../../policy/wip.js";
8
8
  import { AUDIT_LOG_REL_PATH, latestDecisions, readAuditLog } from "../actions/candidates-log.js";
9
+ import { resolveCandidatesLogPath } from "../cache-path.js";
9
10
  import { countReconcilable } from "./reconcilable.js";
10
11
  import { computeScopeDriftTotal } from "./scope-drift.js";
11
12
  // ---------------------------------------------------------------------------
@@ -17,7 +18,7 @@ export const CACHE_DIR_NAME = ".deft-cache";
17
18
  export const CACHE_SOURCE = "github-issue";
18
19
  export const CANDIDATES_LOG_REL_PATH = AUDIT_LOG_REL_PATH;
19
20
  export { latestDecisions, readAuditLog } from "../actions/candidates-log.js";
20
- export const SUMMARY_HISTORY_REL_PATH = "vbrief/.eval/summary-history.jsonl";
21
+ export const SUMMARY_HISTORY_REL_PATH = "vbrief/.triage-cache/summary-history.jsonl";
21
22
  export const SUMMARY_HISTORY_SCHEMA = "deft.triage.summary.v1";
22
23
  /** D2 repeat-suppression window for session-start triage one-liner (#1122 / #1279). */
23
24
  export const D2_SUPPRESSION_WINDOW_HOURS = 4;
@@ -189,7 +190,7 @@ export function isCachedIssueOpen(cacheRoot, repo, issueNumber) {
189
190
  export function computeSummary(projectRoot, options = {}) {
190
191
  const root = pathResolve(projectRoot);
191
192
  const resolvedCacheRoot = options.cacheRoot ?? join(root, CACHE_DIR_NAME);
192
- const resolvedLogPath = options.auditLogPath ?? resolveEvalPath(root, "candidates.jsonl");
193
+ const resolvedLogPath = options.auditLogPath ?? resolveCandidatesLogPath(root);
193
194
  const cached = iterCachedIssues(resolvedCacheRoot);
194
195
  const repos = [...new Set(cached.map(([repo]) => repo))].sort();
195
196
  const wipCap = resolveWipCapInt(root);
@@ -1,6 +1,6 @@
1
1
  /** Lifecycle folders scanned for reconcilable vBRIEFs (#1468). */
2
2
  export declare const BACKFILL_FOLDERS: readonly ["proposed", "pending", "active"];
3
- export declare const CANDIDATES_LOG_REL_PATH = "vbrief/.eval/candidates.jsonl";
3
+ export declare const CANDIDATES_LOG_REL_PATH = "vbrief/.triage-cache/candidates.jsonl";
4
4
  /**
5
5
  * Count reconcilable issues (#1468) — mirrors `triage_reconcile.count_reconcilable`.
6
6
  */
@@ -1,8 +1,9 @@
1
1
  import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { referenceTypeMatches } from "@deftai/directive-types";
4
- import { hasArtifactSuffix, resolveEvalPath, resolveLifecycleRoot } from "../../layout/resolve.js";
4
+ import { hasArtifactSuffix, resolveLifecycleRoot } from "../../layout/resolve.js";
5
5
  import { AUDIT_LOG_REL_PATH, readAuditLog } from "../actions/candidates-log.js";
6
+ import { resolveCandidatesLogPath } from "../cache-path.js";
6
7
  /** Lifecycle folders scanned for reconcilable vBRIEFs (#1468). */
7
8
  export const BACKFILL_FOLDERS = ["proposed", "pending", "active"];
8
9
  export const CANDIDATES_LOG_REL_PATH = AUDIT_LOG_REL_PATH;
@@ -63,7 +64,7 @@ function auditKey(repo, issueNumber) {
63
64
  */
64
65
  export function countReconcilable(projectRoot, options = {}) {
65
66
  try {
66
- const auditPath = options.auditLogPath ?? resolveEvalPath(projectRoot, "candidates.jsonl");
67
+ const auditPath = options.auditLogPath ?? resolveCandidatesLogPath(projectRoot);
67
68
  const existing = existingAuditRefs(auditPath);
68
69
  const defaultRepo = options.defaultRepo ?? null;
69
70
  const keys = new Set();
@@ -1,13 +1,13 @@
1
1
  export declare const CACHE_DIR_NAME = ".deft-cache";
2
2
  export declare const CACHE_SOURCE = "github-issue";
3
- export declare const CANDIDATES_RELPATH: readonly ["vbrief", ".eval", "candidates.jsonl"];
3
+ export declare const CANDIDATES_RELPATH: readonly ["vbrief", ".triage-cache", "candidates.jsonl"];
4
4
  export declare const WIP_LIFECYCLE_DIRS: readonly ["pending", "active"];
5
5
  export declare const AUDIT_LOG_REL_PATH = "meta/policy-changes.log";
6
6
  export declare const DEFAULT_WIP_CAP = 20;
7
7
  export declare const DEFAULT_RELIEF_AGE_DAYS = 30;
8
8
  export declare const TRIAGE_SKILL_PATH = "skills/deft-directive-triage/SKILL.md";
9
9
  export declare const WELCOME_AUDIT_TAG = "triage-welcome";
10
- export declare const SUMMARY_HISTORY_REL_PATH = "vbrief/.eval/summary-history.jsonl";
10
+ export declare const SUMMARY_HISTORY_REL_PATH = "vbrief/.triage-cache/summary-history.jsonl";
11
11
  export declare const SUMMARY_HISTORY_SCHEMA = "deft.triage.summary.v1";
12
12
  export declare const EMPTY_CACHE_LINE = "[triage] cache empty -- run task triage:bootstrap";
13
13
  export declare const MAX_LINE_CHARS = 120;
@@ -1,13 +1,13 @@
1
1
  export const CACHE_DIR_NAME = ".deft-cache";
2
2
  export const CACHE_SOURCE = "github-issue";
3
- export const CANDIDATES_RELPATH = ["vbrief", ".eval", "candidates.jsonl"];
3
+ export const CANDIDATES_RELPATH = ["vbrief", ".triage-cache", "candidates.jsonl"];
4
4
  export const WIP_LIFECYCLE_DIRS = ["pending", "active"];
5
5
  export const AUDIT_LOG_REL_PATH = "meta/policy-changes.log";
6
6
  export const DEFAULT_WIP_CAP = 20;
7
7
  export const DEFAULT_RELIEF_AGE_DAYS = 30;
8
8
  export const TRIAGE_SKILL_PATH = "skills/deft-directive-triage/SKILL.md";
9
9
  export const WELCOME_AUDIT_TAG = "triage-welcome";
10
- export const SUMMARY_HISTORY_REL_PATH = "vbrief/.eval/summary-history.jsonl";
10
+ export const SUMMARY_HISTORY_REL_PATH = "vbrief/.triage-cache/summary-history.jsonl";
11
11
  export const SUMMARY_HISTORY_SCHEMA = "deft.triage.summary.v1";
12
12
  export const EMPTY_CACHE_LINE = "[triage] cache empty -- run task triage:bootstrap";
13
13
  export const MAX_LINE_CHARS = 120;
@@ -1,7 +1,8 @@
1
1
  import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { hasArtifactSuffix, resolveAuditPath, resolveEvalPath, resolveLifecycleRoot, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
3
+ import { hasArtifactSuffix, resolveAuditPath, resolveLifecycleRoot, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
4
4
  import { readPlanPolicy } from "../../policy/plan-extensions.js";
5
+ import { resolveCandidatesLogPath } from "../cache-path.js";
5
6
  import { CACHE_DIR_NAME, CACHE_SOURCE, DEFAULT_WIP_CAP, SUBSCRIPTION_PRESETS, WIP_LIFECYCLE_DIRS, } from "./constants.js";
6
7
  function loadProjectDefinition(projectRoot) {
7
8
  const path = resolveProjectDefinitionPath(projectRoot);
@@ -39,7 +40,7 @@ function countCacheEntries(projectRoot) {
39
40
  return count;
40
41
  }
41
42
  export function candidatesLogPath(projectRoot) {
42
- return resolveEvalPath(projectRoot, "candidates.jsonl");
43
+ return resolveCandidatesLogPath(projectRoot);
43
44
  }
44
45
  function countWip(projectRoot) {
45
46
  let total = 0;
@@ -1,8 +1,9 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { hasArtifactSuffix, resolveEvalPath, resolveLifecycleFolder, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
3
+ import { hasArtifactSuffix, resolveLifecycleFolder, resolveProjectDefinitionPath, } from "../../layout/resolve.js";
4
4
  import { readPlanPolicy } from "../../policy/plan-extensions.js";
5
- import { countVbriefWip, DEFAULT_WIP_CAP, resolveWipCap } from "../../policy/wip.js";
5
+ import { countVbriefWip, resolveWipCap } from "../../policy/wip.js";
6
+ import { resolveCandidatesLogPath, resolveTriageCachePath } from "../cache-path.js";
6
7
  import { countReconcilable } from "../reconcile/reconcile.js";
7
8
  import { computeDrift } from "../scope-drift/compute.js";
8
9
  import { shouldSuppressD2Emission } from "../summary/index.js";
@@ -119,7 +120,7 @@ function utcIso() {
119
120
  export function computeSummary(projectRoot) {
120
121
  const root = resolve(projectRoot);
121
122
  const cacheRoot = join(root, CACHE_DIR_NAME);
122
- const logPath = resolveEvalPath(root, "candidates.jsonl");
123
+ const logPath = resolveCandidatesLogPath(root);
123
124
  const cached = iterCachedIssues(cacheRoot);
124
125
  const repos = [...new Set(cached.map(([r]) => r))].sort().slice(0, 8);
125
126
  const wipCapResult = resolveWipCap(root);
@@ -293,7 +294,7 @@ export function appendHistory(historyPath, result, line) {
293
294
  export function emitOneliner(projectRoot, options = {}) {
294
295
  const result = computeSummary(projectRoot);
295
296
  const line = formatSummary(result);
296
- const historyPath = resolveEvalPath(projectRoot, "summary-history.jsonl");
297
+ const historyPath = resolveTriageCachePath(projectRoot, "summary-history.jsonl");
297
298
  const applySuppression = options.applyD2Suppression !== false;
298
299
  if (applySuppression && shouldSuppressD2Emission(result, historyPath, { now: options.now })) {
299
300
  return line;
@@ -0,0 +1,14 @@
1
+ import { type ValueFeedbackResolved } from "../policy/value-feedback.js";
2
+ import { type WorkContext } from "./adoption-registry.js";
3
+ export interface AdoptionEmitOptions {
4
+ readonly logPath?: string | null;
5
+ readonly policyOverride?: ValueFeedbackResolved;
6
+ readonly workContext?: WorkContext;
7
+ }
8
+ /** Best-effort WorkContext snapshot from git porcelain status (#2339). */
9
+ export declare function buildWorkContextFromGit(projectRoot: string): WorkContext;
10
+ /** Record adoption signals for applicable-but-unused capabilities (#2339). */
11
+ export declare function recordAdoptionSignalsFromWorkContext(projectRoot: string, ctx: WorkContext, options?: AdoptionEmitOptions): number;
12
+ /** Session/work-boundary adoption probe — builds WorkContext when omitted (#2339). */
13
+ export declare function probeAdoptionAtWorkBoundary(projectRoot: string, options?: AdoptionEmitOptions): number;
14
+ //# sourceMappingURL=adoption-emit.d.ts.map
@@ -0,0 +1,67 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { recordAdoptionSignal } from "../events/attribution-ledger.js";
3
+ import { isValueFeedbackPathAllowed, resolveValueFeedback, } from "../policy/value-feedback.js";
4
+ import { detectApplicableButUnusedGated } from "./adoption-registry.js";
5
+ /** Best-effort WorkContext snapshot from git porcelain status (#2339). */
6
+ export function buildWorkContextFromGit(projectRoot) {
7
+ try {
8
+ const porcelain = execFileSync("git", ["status", "--porcelain"], {
9
+ cwd: projectRoot,
10
+ encoding: "utf8",
11
+ stdio: ["ignore", "pipe", "ignore"],
12
+ });
13
+ const paths = new Set();
14
+ for (const line of porcelain.split("\n")) {
15
+ if (line.length < 4) {
16
+ continue;
17
+ }
18
+ let path = line.slice(3).trim();
19
+ if (path.startsWith('"') && path.endsWith('"')) {
20
+ path = path.slice(1, -1);
21
+ }
22
+ if (path.length > 0) {
23
+ paths.add(path);
24
+ }
25
+ }
26
+ const modules = new Set();
27
+ for (const filePath of paths) {
28
+ const segment = filePath.split("/")[0];
29
+ if (segment !== undefined && segment.length > 0) {
30
+ modules.add(segment);
31
+ }
32
+ }
33
+ return {
34
+ filesTouched: paths.size,
35
+ distinctModuleGlobs: modules.size,
36
+ usedCapabilities: [],
37
+ };
38
+ }
39
+ catch {
40
+ return { filesTouched: 0, distinctModuleGlobs: 0, usedCapabilities: [] };
41
+ }
42
+ }
43
+ /** Record adoption signals for applicable-but-unused capabilities (#2339). */
44
+ export function recordAdoptionSignalsFromWorkContext(projectRoot, ctx, options = {}) {
45
+ const policy = options.policyOverride ?? resolveValueFeedback(projectRoot);
46
+ if (!isValueFeedbackPathAllowed("emitEvents", policy)) {
47
+ return 0;
48
+ }
49
+ const signals = detectApplicableButUnusedGated(ctx, policy);
50
+ let recorded = 0;
51
+ for (const signal of signals) {
52
+ const record = recordAdoptionSignal(projectRoot, signal.capabilityId, signal.message, {
53
+ logPath: options.logPath,
54
+ policyOverride: policy,
55
+ });
56
+ if (record !== null) {
57
+ recorded += 1;
58
+ }
59
+ }
60
+ return recorded;
61
+ }
62
+ /** Session/work-boundary adoption probe — builds WorkContext when omitted (#2339). */
63
+ export function probeAdoptionAtWorkBoundary(projectRoot, options = {}) {
64
+ const ctx = options.workContext ?? buildWorkContextFromGit(projectRoot);
65
+ return recordAdoptionSignalsFromWorkContext(projectRoot, ctx, options);
66
+ }
67
+ //# sourceMappingURL=adoption-emit.js.map
@@ -0,0 +1,62 @@
1
+ import { type ValueFeedbackResolved } from "../policy/value-feedback.js";
2
+ /** Canonical directive capabilities tracked for underutilization nudges (#1709). */
3
+ export type CapabilityId = "planning" | "cost" | "decompose" | "swarm" | "pre-pr" | "debug" | "glossary" | "lessons";
4
+ /** How downstream instrumentation knows a capability was exercised. */
5
+ export type UsageSignalSource = "command:/deft:directive:run:interview" | "command:/deft:directive:run:speckit" | "command:task capacity:show" | "command:split-to-prs" | "command:task swarm:launch" | "skill:deft-directive-pre-pr" | "skill:debug-mode" | "command:/deft:glossary" | "command:deft packs:slice";
6
+ export interface CapabilityRecord {
7
+ readonly id: CapabilityId;
8
+ readonly label: string;
9
+ readonly description: string;
10
+ readonly usageSignals: readonly UsageSignalSource[];
11
+ readonly nudgeHint: string;
12
+ }
13
+ /** Work snapshot supplied by callers when evaluating adoption heuristics. */
14
+ export interface WorkContext {
15
+ readonly filesTouched: number;
16
+ /** Distinct module globs from the codebase map (parallelizability proxy). */
17
+ readonly distinctModuleGlobs: number;
18
+ readonly usedCapabilities: readonly CapabilityId[];
19
+ readonly isBuildIntent?: boolean;
20
+ readonly isPrOpening?: boolean;
21
+ }
22
+ export interface ApplicabilityVerdict {
23
+ readonly applicable: boolean;
24
+ readonly reason: string;
25
+ }
26
+ export interface AdoptionSignal {
27
+ readonly signalClass: "adoption";
28
+ readonly event: string;
29
+ readonly capabilityId: CapabilityId;
30
+ readonly message: string;
31
+ readonly evidence: Readonly<Record<string, unknown>>;
32
+ }
33
+ /** Conservative thresholds — adoption nudges fire only above these bars (#1709). */
34
+ export declare const ADOPTION_THRESHOLDS: {
35
+ readonly smallWorkMaxFiles: 2;
36
+ readonly planningMinFiles: 4;
37
+ readonly costMinFiles: 3;
38
+ readonly largeMultiFileMinFiles: 5;
39
+ readonly largeMultiFileMinModules: 2;
40
+ readonly swarmMinFiles: 8;
41
+ readonly swarmMinModules: 3;
42
+ readonly glossaryMinFiles: 6;
43
+ readonly lessonsMinFiles: 5;
44
+ };
45
+ export declare const ADOPTION_SIGNAL_CLASS: "adoption";
46
+ /** Event name for the attribution ledger (`adoption:<capability>`). */
47
+ export declare function formatAdoptionEventName(id: CapabilityId): string;
48
+ /** True when work is too small for any adoption nudge (#1709-adoption-registry-a3). */
49
+ export declare function isWorkTooSmallForAdoptionNudges(ctx: WorkContext): boolean;
50
+ /** Evaluate whether a capability's conservative heuristic applies to the work snapshot. */
51
+ export declare function evaluateApplicability(id: CapabilityId, ctx: WorkContext): ApplicabilityVerdict;
52
+ /**
53
+ * Detect applicable-but-unused capabilities (#1709-adoption-registry-a2).
54
+ * Does not consult the value-feedback policy — use `detectApplicableButUnusedGated`.
55
+ */
56
+ export declare function detectApplicableButUnused(ctx: WorkContext): AdoptionSignal[];
57
+ /**
58
+ * Policy-gated adoption detection — returns signals only when value feedback
59
+ * is enabled and the emitEvents path is allowed (#1709 opt-in gate).
60
+ */
61
+ export declare function detectApplicableButUnusedGated(ctx: WorkContext, policy: ValueFeedbackResolved): AdoptionSignal[];
62
+ //# sourceMappingURL=adoption-registry.d.ts.map