@geraldmaron/construct 1.0.7 → 1.0.8

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 (147) hide show
  1. package/README.md +20 -17
  2. package/bin/construct +1199 -69
  3. package/commands/work/optimize-prompts.md +1 -1
  4. package/db/schema/007_tags.sql +30 -0
  5. package/db/schema/008_skill_usage.sql +24 -0
  6. package/db/schema/009_scheduler.sql +14 -0
  7. package/examples/internal/roles/architect/bad/clever-plan-without-contracts.md +1 -1
  8. package/examples/internal/roles/architect/golden/explicit-tradeoff-before-plan.md +1 -1
  9. package/examples/internal/roles/engineer/bad/speculative-abstraction.md +1 -1
  10. package/examples/internal/roles/engineer/golden/read-before-write.md +1 -1
  11. package/examples/internal/roles/qa/bad/coverage-theater.md +1 -1
  12. package/examples/internal/roles/qa/golden/regression-gate.md +1 -1
  13. package/examples/seed-observations/decisions.md +1 -1
  14. package/lib/audit-skills.mjs +3 -3
  15. package/lib/auto-docs.mjs +2 -2
  16. package/lib/cli-commands.mjs +276 -122
  17. package/lib/comment-lint.mjs +5 -1
  18. package/lib/completions.mjs +1 -1
  19. package/lib/config/schema.mjs +15 -1
  20. package/lib/contracts/validate.mjs +65 -17
  21. package/lib/distill.mjs +22 -4
  22. package/lib/doc-stamp.mjs +48 -0
  23. package/lib/doctor/watchers/consistency.mjs +62 -12
  24. package/lib/document-extract.mjs +221 -28
  25. package/lib/document-ingest.mjs +2 -0
  26. package/lib/embed/inbox.mjs +48 -3
  27. package/lib/embed/role-framing.mjs +3 -3
  28. package/lib/env-config.mjs +9 -3
  29. package/lib/extractors/calendar.mjs +173 -0
  30. package/lib/extractors/shared/drop-info.mjs +22 -0
  31. package/lib/extractors/transcript.mjs +0 -0
  32. package/lib/gates-audit.mjs +8 -2
  33. package/lib/git-hooks/prepare-commit-msg +1 -1
  34. package/lib/headhunt.mjs +2 -2
  35. package/lib/hooks/agent-tracker.mjs +6 -11
  36. package/lib/hooks/guard-bash.mjs +35 -14
  37. package/lib/hooks/mcp-audit.mjs +12 -0
  38. package/lib/hooks/pre-compact.mjs +92 -5
  39. package/lib/hooks/pre-push-gate.mjs +41 -8
  40. package/lib/hooks/registry-sync.mjs +2 -2
  41. package/lib/hooks/stop-notify.mjs +7 -6
  42. package/lib/host-capabilities.mjs +10 -1
  43. package/lib/hygiene/scan.mjs +141 -0
  44. package/lib/init-unified.mjs +18 -0
  45. package/lib/install/stage-project.mjs +4 -4
  46. package/lib/intake/classify.mjs +222 -55
  47. package/lib/intake/filesystem-queue.mjs +25 -5
  48. package/lib/intake/postgres-queue.mjs +45 -3
  49. package/lib/intake/prepare.mjs +3 -0
  50. package/lib/intake/quarantine.mjs +205 -0
  51. package/lib/knowledge/postgres-search.mjs +132 -0
  52. package/lib/knowledge/search.mjs +14 -4
  53. package/lib/mcp/server.mjs +9 -3
  54. package/lib/mcp/tools/skills.mjs +32 -11
  55. package/lib/mcp/tools/workflow.mjs +1 -1
  56. package/lib/migrations/index.mjs +1 -1
  57. package/lib/model-registry.mjs +1 -1
  58. package/lib/opencode-runtime-plugin.mjs +1 -1
  59. package/lib/orchestration-policy.mjs +4 -4
  60. package/lib/overrides/resolver.mjs +3 -3
  61. package/lib/parity.mjs +4 -4
  62. package/lib/policy/engine.mjs +2 -2
  63. package/lib/profiles/lifecycle.mjs +1 -1
  64. package/lib/prompt-metadata.mjs +4 -4
  65. package/lib/providers/circuit-breaker.mjs +14 -0
  66. package/lib/providers/contract.mjs +67 -3
  67. package/lib/providers/creds.mjs +219 -0
  68. package/lib/providers/scaffold.mjs +107 -0
  69. package/lib/role-preload.mjs +5 -0
  70. package/lib/roles/catalog.mjs +1 -1
  71. package/lib/roles/manifest.mjs +2 -2
  72. package/lib/scheduler/index.mjs +112 -0
  73. package/lib/scheduler/solo.mjs +183 -0
  74. package/lib/server/index.mjs +7 -1
  75. package/lib/server/insights.mjs +14 -12
  76. package/lib/server/langfuse-login.mjs +58 -0
  77. package/lib/server/static/assets/index-ab25c707.js +1 -1
  78. package/lib/{agent-contracts-enforce.mjs → specialist-contracts-enforce.mjs} +4 -4
  79. package/lib/{agent-contracts.mjs → specialist-contracts.mjs} +9 -8
  80. package/lib/{agents → specialists}/postconditions.mjs +3 -3
  81. package/lib/{agents → specialists}/schema.mjs +6 -6
  82. package/lib/status.mjs +13 -11
  83. package/lib/storage/backup.mjs +2 -2
  84. package/lib/tags/lifecycle.mjs +278 -0
  85. package/lib/tags/vocabulary.mjs +140 -0
  86. package/lib/telemetry/otel-tracer.mjs +184 -0
  87. package/lib/telemetry/skill-calls.mjs +73 -12
  88. package/lib/uninstall/uninstall.mjs +1 -1
  89. package/lib/update.mjs +1 -1
  90. package/lib/validator.mjs +57 -56
  91. package/lib/workflows/instantiate.mjs +320 -0
  92. package/package.json +13 -3
  93. package/personas/construct.md +2 -2
  94. package/platforms/claude/CLAUDE.md +1 -1
  95. package/rules/common/no-fabrication.md +1 -1
  96. package/scripts/{sync-agents.mjs → sync-specialists.mjs} +126 -54
  97. package/skills/ai/prompt-optimizer.md +3 -3
  98. package/skills/exploration/dependency-graph-reading.md +98 -0
  99. package/skills/exploration/tracer-bullet-method.md +71 -0
  100. package/skills/exploration/unknown-codebase-onboarding.md +91 -0
  101. package/skills/operating/change-management.md +91 -0
  102. package/skills/operating/incident-response.md +75 -0
  103. package/skills/operating/oncall-rotation.md +95 -0
  104. package/skills/operating/orchestration-reference.md +2 -2
  105. package/skills/strategy/competitive-landscape.md +75 -0
  106. package/skills/strategy/market-research-methods.md +87 -0
  107. package/skills/strategy/narrative-arc.md +77 -0
  108. package/skills/strategy/pricing-positioning.md +94 -0
  109. package/{agents → specialists}/contracts.schema.json +1 -1
  110. package/specialists/policy-inventory.json +160 -0
  111. package/{agents → specialists}/prompts/cx-accessibility.md +1 -1
  112. package/{agents → specialists}/prompts/cx-ai-engineer.md +1 -1
  113. package/{agents → specialists}/prompts/cx-architect.md +1 -1
  114. package/{agents → specialists}/prompts/cx-business-strategist.md +1 -1
  115. package/{agents → specialists}/prompts/cx-data-analyst.md +1 -1
  116. package/{agents → specialists}/prompts/cx-data-engineer.md +1 -1
  117. package/{agents → specialists}/prompts/cx-debugger.md +1 -1
  118. package/{agents → specialists}/prompts/cx-designer.md +1 -1
  119. package/{agents → specialists}/prompts/cx-devil-advocate.md +1 -1
  120. package/{agents → specialists}/prompts/cx-docs-keeper.md +2 -2
  121. package/{agents → specialists}/prompts/cx-engineer.md +2 -2
  122. package/{agents → specialists}/prompts/cx-evaluator.md +1 -1
  123. package/{agents → specialists}/prompts/cx-explorer.md +1 -1
  124. package/{agents → specialists}/prompts/cx-legal-compliance.md +1 -1
  125. package/{agents → specialists}/prompts/cx-operations.md +1 -1
  126. package/{agents → specialists}/prompts/cx-orchestrator.md +2 -2
  127. package/{agents → specialists}/prompts/cx-platform-engineer.md +1 -1
  128. package/{agents → specialists}/prompts/cx-product-manager.md +1 -1
  129. package/{agents → specialists}/prompts/cx-qa.md +1 -1
  130. package/{agents → specialists}/prompts/cx-rd-lead.md +1 -1
  131. package/{agents → specialists}/prompts/cx-release-manager.md +1 -1
  132. package/{agents → specialists}/prompts/cx-researcher.md +1 -1
  133. package/{agents → specialists}/prompts/cx-reviewer.md +2 -2
  134. package/{agents → specialists}/prompts/cx-security.md +1 -1
  135. package/{agents → specialists}/prompts/cx-sre.md +2 -2
  136. package/{agents → specialists}/prompts/cx-test-automation.md +1 -1
  137. package/{agents → specialists}/prompts/cx-trace-reviewer.md +3 -3
  138. package/{agents → specialists}/prompts/cx-ux-researcher.md +1 -1
  139. package/{agents → specialists}/registry.json +651 -423
  140. package/{agents → specialists}/role-manifests.json +8 -8
  141. package/templates/provider-scaffold/health.test.mjs +30 -0
  142. package/templates/provider-scaffold/index.mjs +48 -0
  143. package/templates/workflows/cross-team-handoff.yml +85 -0
  144. package/templates/workflows/engineering-onboarding.yml +77 -0
  145. package/templates/workflows/new-feature.yml +53 -0
  146. /package/{agents → specialists}/contracts.json +0 -0
  147. /package/{agents → specialists}/teams.json +0 -0
@@ -18,7 +18,7 @@ Optimize prompt fragments and overlays, not the runtime orchestration policy. If
18
18
 
19
19
  ## Required steps
20
20
 
21
- 1. **Read current prompt**: read the agent's prompt from `agents/registry.json` (or its `promptFile`)
21
+ 1. **Read current prompt**: read the agent's prompt from `specialists/registry.json` (or its `promptFile`)
22
22
  2. **Fetch recent scores**: GET `{CONSTRUCT_TELEMETRY_URL}/api/public/scores?name=quality&limit=200`
23
23
  3. **Skip agents with fewer than 20 scored traces**: insufficient signal; note them but do not optimize
24
24
  4. **Diagnose failure patterns**: analyze low-scoring traces, identify top 3 recurring patterns
@@ -0,0 +1,30 @@
1
+ -- Tag attribution and migration tracking for construct_documents.
2
+ -- The construct_documents.tags JSONB column already exists in 001_init.sql.
3
+ -- This migration adds GIN indexing, attribution history, and migration audit.
4
+
5
+ create index if not exists construct_documents_tags_gin_idx
6
+ on construct_documents using gin (tags jsonb_path_ops);
7
+
8
+ create table if not exists construct_tag_attribution (
9
+ document_id text not null references construct_documents(id) on delete cascade,
10
+ tag text not null,
11
+ source text not null, -- 'agent:classifier' | 'user' | 'curator'
12
+ confidence numeric,
13
+ applied_at timestamptz not null default now(),
14
+ migrated_from text,
15
+ primary key (document_id, tag, source)
16
+ );
17
+ create index if not exists construct_tag_attribution_tag_idx on construct_tag_attribution (tag);
18
+
19
+ create table if not exists construct_tag_migrations (
20
+ id text primary key,
21
+ from_tag text not null,
22
+ to_tag text,
23
+ executed_at timestamptz not null default now(),
24
+ executed_by text not null,
25
+ reason text not null,
26
+ doc_count_before integer not null,
27
+ doc_count_after integer,
28
+ reversible boolean not null default true,
29
+ rolled_back_at timestamptz
30
+ );
@@ -0,0 +1,24 @@
1
+ -- db/schema/008_skill_usage.sql — Per-skill invocation log.
2
+ --
3
+ -- Backs `construct skills usage/orphans/hot`. The local
4
+ -- JSONL path (~/.cx/skill-calls.jsonl) is primary in solo mode; this table is
5
+ -- primary in team/enterprise mode. One-time backfill via
6
+ -- `construct skills backfill-postgres`.
7
+
8
+ create table if not exists construct_skill_invocations (
9
+ id bigserial primary key,
10
+ ts timestamptz not null,
11
+ skill_id text not null,
12
+ source text not null, -- 'mcp' | 'role-preload' | 'prompt-composer' | …
13
+ agent_id text,
14
+ session_id text,
15
+ caller_context text,
16
+ latency_ms integer,
17
+ tokens_returned integer
18
+ );
19
+
20
+ create index if not exists construct_skill_invocations_skill_ts_idx
21
+ on construct_skill_invocations (skill_id, ts desc);
22
+
23
+ create index if not exists construct_skill_invocations_session_idx
24
+ on construct_skill_invocations (session_id);
@@ -0,0 +1,14 @@
1
+ -- Scheduler job state for team and enterprise deployment modes.
2
+ -- Solo mode uses native trigger files instead of this table.
3
+ -- The lock_holder column stores a short identifier for the process/host
4
+ -- that currently holds the advisory lock for a running job.
5
+
6
+ create table if not exists construct_scheduled_jobs (
7
+ id text primary key,
8
+ schedule text not null,
9
+ last_run_at timestamptz,
10
+ last_run_status text,
11
+ lock_holder text,
12
+ lock_acquired_at timestamptz,
13
+ created_at timestamptz not null default now()
14
+ );
@@ -7,7 +7,7 @@ verdict: fail
7
7
  summary: Recommends a clever architecture without exposing contracts or rejected alternatives.
8
8
  references:
9
9
  - skills/roles/architect.md
10
- - agents/prompts/cx-architect.md
10
+ - specialists/prompts/cx-architect.md
11
11
  tags:
12
12
  - missing-contracts
13
13
  - hidden-dependencies
@@ -7,7 +7,7 @@ verdict: pass
7
7
  summary: Makes interface and dependency tradeoffs explicit before locking in a plan.
8
8
  references:
9
9
  - skills/roles/architect.md
10
- - agents/prompts/cx-architect.md
10
+ - specialists/prompts/cx-architect.md
11
11
  tags:
12
12
  - tradeoffs
13
13
  - contracts
@@ -7,7 +7,7 @@ verdict: fail
7
7
  summary: Introduces an abstraction for future cases without evidence from the code.
8
8
  references:
9
9
  - skills/roles/engineer.md
10
- - agents/prompts/cx-engineer.md
10
+ - specialists/prompts/cx-engineer.md
11
11
  tags:
12
12
  - speculative-abstraction
13
13
  - unnecessary-surface-area
@@ -7,7 +7,7 @@ verdict: pass
7
7
  summary: Reads the touched files and surrounding pattern before proposing code changes.
8
8
  references:
9
9
  - skills/roles/engineer.md
10
- - agents/prompts/cx-engineer.md
10
+ - specialists/prompts/cx-engineer.md
11
11
  tags:
12
12
  - read-before-write
13
13
  - local-conventions
@@ -7,7 +7,7 @@ verdict: fail
7
7
  summary: Treats a green suite or coverage number as proof that the behavior is safe.
8
8
  references:
9
9
  - skills/roles/qa.md
10
- - agents/prompts/cx-qa.md
10
+ - specialists/prompts/cx-qa.md
11
11
  tags:
12
12
  - coverage-theater
13
13
  - false-confidence
@@ -7,7 +7,7 @@ verdict: pass
7
7
  summary: Verifies changed behavior with regression-oriented tests instead of coverage theater.
8
8
  references:
9
9
  - skills/roles/qa.md
10
- - agents/prompts/cx-qa.md
10
+ - specialists/prompts/cx-qa.md
11
11
  tags:
12
12
  - regression
13
13
  - changed-behavior
@@ -33,4 +33,4 @@ Hook guards for workflow, drive, bootstrap, and task behavior are expressed as Y
33
33
 
34
34
  ## Registry as Single Source of Truth
35
35
 
36
- `agents/registry.json` is the canonical definition for all agents on all platforms (Claude Code, OpenCode, Codex, Copilot). `construct sync` regenerates all platform-specific files from the registry. Never edit generated files directly: edits are overwritten on the next sync.
36
+ `specialists/registry.json` is the canonical definition for all agents on all platforms (Claude Code, OpenCode, Codex, Copilot). `construct sync` regenerates all platform-specific files from the registry. Never edit generated files directly: edits are overwritten on the next sync.
@@ -11,7 +11,7 @@ import path from 'node:path';
11
11
  function findConstructRoot(startPath = process.cwd()) {
12
12
  let current = path.resolve(startPath);
13
13
  while (true) {
14
- if (fs.existsSync(path.join(current, 'agents', 'registry.json'))) return current;
14
+ if (fs.existsSync(path.join(current, 'specialists', 'registry.json'))) return current;
15
15
  const parent = path.dirname(current);
16
16
  if (parent === current) return path.resolve(startPath);
17
17
  current = parent;
@@ -36,7 +36,7 @@ function collectSkillFiles(skillsDir) {
36
36
 
37
37
  export function auditSkills({ rootDir, silent = false } = {}) {
38
38
  const root = rootDir ?? findConstructRoot();
39
- const registryPath = path.join(root, 'agents', 'registry.json');
39
+ const registryPath = path.join(root, 'specialists', 'registry.json');
40
40
  const skillsDir = path.join(root, 'skills');
41
41
 
42
42
  const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
@@ -46,7 +46,7 @@ export function auditSkills({ rootDir, silent = false } = {}) {
46
46
  const agentsWithNoSkills = [];
47
47
  const missingSkillFiles = [];
48
48
 
49
- for (const agent of registry.agents ?? []) {
49
+ for (const agent of registry.specialists ?? []) {
50
50
  const skills = agent.skills ?? [];
51
51
  if (skills.length === 0) {
52
52
  agentsWithNoSkills.push(agent.name);
package/lib/auto-docs.mjs CHANGED
@@ -397,10 +397,10 @@ function renderAgentsPage(rootDir) {
397
397
  return [
398
398
  '---',
399
399
  'title: Specialists',
400
- 'description: The 28 specialists behind the construct persona. Generated from agents/registry.json.',
400
+ 'description: The 28 specialists behind the construct persona. Generated from specialists/registry.json.',
401
401
  '---',
402
402
  '',
403
- '> Generated from `agents/registry.json`. Re-run `construct docs:site` to refresh.',
403
+ '> Generated from `specialists/registry.json`. Re-run `construct docs:site` to refresh.',
404
404
  '',
405
405
  'Construct ships one persona (`construct`) and 28 specialists behind it. You address `@construct` for all everyday work; it routes to specialists internally. Each specialist has a role, model tier, and prompt file that defines its decision authority.',
406
406
  '',