@useorgx/wizard 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +423 -111
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2569,10 +2569,10 @@ var EXTENSION_FRONTMATTER_DELIMITER = "---";
|
|
|
2569
2569
|
var CURSOR_RULES_CONTENT = `# OrgX Rules
|
|
2570
2570
|
|
|
2571
2571
|
- Prefer \`workspace_id\` on OrgX tool calls. \`command_center_id\` is a deprecated alias and should only be used for backwards compatibility. If both are present, they must match.
|
|
2572
|
-
- Treat \`
|
|
2573
|
-
- Treat \`
|
|
2572
|
+
- Treat \`orgx_act\` with \`force: true\` as an escape hatch. It bypasses hierarchy and proof checks, so only use it when the user explicitly wants that behavior and say why.
|
|
2573
|
+
- Treat \`orgx_write continue_on_error\` as best-effort creation. Use it only when partial scaffolds are acceptable, and follow up on any failed children.
|
|
2574
2574
|
- Preserve \`_context\` when widget or app-rendering flows depend on client, conversation, session, or user metadata. Do not strip or rename it.
|
|
2575
|
-
- Prefer \`
|
|
2575
|
+
- Prefer \`orgx_search\` for pending approvals and state inspection before reaching for legacy aliases.
|
|
2576
2576
|
- Keep hosted OrgX MCP calls distinct from local OpenClaw/plugin surfaces before mutating config or entity state.
|
|
2577
2577
|
- Artifact proof must use durable sources: GitHub PR/commit/blob permalinks, published/public URLs, or absolute file paths / \`file://...\`.
|
|
2578
2578
|
- Never use OrgX wrapper pages like \`/live/...\`, \`/artifacts/...\`, or \`/console/...\` as proof links. \`preview_markdown\` is supplemental, not proof.
|
|
@@ -2597,10 +2597,10 @@ This skill is for the hosted OrgX tool surface, not the local OpenClaw plugin. K
|
|
|
2597
2597
|
## Operating Rules
|
|
2598
2598
|
|
|
2599
2599
|
- Prefer \`workspace_id\` on OrgX tools. \`command_center_id\` is a deprecated alias kept for compatibility.
|
|
2600
|
-
- Treat \`
|
|
2601
|
-
- Treat \`
|
|
2600
|
+
- Treat \`orgx_act\` with \`force: true\` as a deliberate override only. It bypasses hierarchy and proof-chain checks.
|
|
2601
|
+
- Treat \`orgx_write continue_on_error\` as best-effort scaffolding. Use it only when partial creation is acceptable and inspect failures afterward.
|
|
2602
2602
|
- Preserve \`_context\` when widget or app rendering depends on client, conversation, session, or user metadata.
|
|
2603
|
-
- Prefer \`
|
|
2603
|
+
- Prefer \`orgx_search\` over older aliases when you need pending decisions, blockers, or entity state.
|
|
2604
2604
|
- Artifact proof must use durable sources: GitHub PR/commit/blob permalinks, published/public URLs, or absolute file paths / \`file://...\`.
|
|
2605
2605
|
- Never use OrgX wrapper pages like \`/live/...\`, \`/artifacts/...\`, or \`/console/...\` as proof links. \`preview_markdown\` is supporting context only.
|
|
2606
2606
|
|
|
@@ -2615,7 +2615,7 @@ Install and use these packs alongside this base skill:
|
|
|
2615
2615
|
|
|
2616
2616
|
## Suggested Workflow
|
|
2617
2617
|
|
|
2618
|
-
1. Inspect state with \`
|
|
2618
|
+
1. Inspect state with \`mcp__orgx__orgx_search\`, \`mcp__orgx__get_initiative_pulse\`, or the relevant workspace-scoped read tool.
|
|
2619
2619
|
2. Mutate state with the narrowest tool that matches the task.
|
|
2620
2620
|
3. When you need a hard override, explain why before using \`force: true\`.
|
|
2621
2621
|
4. When you scaffold, decide up front whether \`continue_on_error\` is acceptable.
|
|
@@ -6228,24 +6228,25 @@ var AI_SESSION_SOURCES = ["codex", "claude"];
|
|
|
6228
6228
|
var DEFAULT_LIMIT_PER_SOURCE = 3;
|
|
6229
6229
|
var DEFAULT_SINCE_DAYS = 30;
|
|
6230
6230
|
var DEFAULT_MAX_BYTES_PER_FILE = 1e6;
|
|
6231
|
-
var AUDIT_RELEVANT_LINE_PATTERN = /\b(decision|decided|artifact|receipt|proof|commitment|committed|next action|follow[- ]?up|outcome|result|impact|roi|economics|token|cost|saved|open loop|gap|blocker|risk|owner|dri|writeback|rollback|quality score|mcp|tool call|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
6231
|
+
var AUDIT_RELEVANT_LINE_PATTERN = /\b(decision|decided|artifact|receipt|proof|commitment|committed|next action|follow[- ]?up|outcome|result|impact|roi|economics|token|cost|saved|open loop|gap|blocker|risk|owner|dri|writeback|rollback|quality score|mcp|tool call|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write|mcp__orgx__)\b/i;
|
|
6232
6232
|
var STRONG_AUDIT_LINE_PATTERN = /^(?:[-*]\s*)?(?:decision|artifact|receipt|proof|commitment|next action|follow[- ]?up|outcome|result|impact|roi|economics|open loop|gap|blocker|risk|owner|dri|rollback|quality score)\s*:/i;
|
|
6233
|
-
var ORGX_TOOL_SIGNAL_PATTERN = /\b(?:mcp__orgx__|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
6233
|
+
var ORGX_TOOL_SIGNAL_PATTERN = /\b(?:mcp__orgx__|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write|orgx_inspect|ship_batch|record_outcome|orgx_free_audit)\b/i;
|
|
6234
6234
|
var INSTRUCTION_BOILERPLATE_PATTERN = /^(?:#{1,6}\s*)?(?:agents\.md|instructions?|codex guardrails|precedence|read before you write|use exactly what was specified|don'?t confuse technologies|repo \+ scope hygiene|initiative \/ mcp discipline|ui quality bar|verification standards|secrets \+ safety|patch\/editing rules|commit \/ pr \/ merge protocol|output style|mcp integration|agent domains|skills|conventions)\b/i;
|
|
6235
6235
|
var IMPERATIVE_BOILERPLATE_PATTERN = /^[-*]\s+(?:if the user|when the user|if mcp|when agents|never|always|do not|don'?t|default to|treat|produce|pick|verify|avoid|match|use exactly|keep system boundaries|quote bracketed|for orgx|when capture tooling|if no meaningful|do \*\*not\*\*)\b/i;
|
|
6236
6236
|
var CODE_OR_DOC_NOISE_PATTERN = /^(?:[-*]\s*)?(?:https?:\/\/|\/|\.{0,2}\/|[A-Za-z]:\/|`{1,3}|"{1,2}[A-Za-z0-9:_-]+":|\d+\s*$|\d+\t|import\s|export\s|const\s|let\s|var\s|function\s|type\s|interface\s|CREATE\s+TABLE|ALTER\s+TABLE|SELECT\s+|INSERT\s+|UPDATE\s+|DELETE\s+)/i;
|
|
6237
6237
|
var EMPTY_AUDIT_LABEL_PATTERN = /^(?:[-*]\s*)?(?:decision|artifact|receipt|proof|commitment|next action|follow[- ]?up|outcome|result|impact|roi|economics|open loop|gap|blocker|risk|owner|dri|rollback|quality score)\s*:\s*[\[{(;,]*$/i;
|
|
6238
|
+
var LABEL_VALUE_NOISE_PATTERN = /^(?:[-*]\s*)?(?:decision|artifact|receipt|proof|commitment|next action|follow[- ]?up|outcome|result|impact|roi|economics|open loop|gap|blocker|risk|owner|dri|rollback|quality score)\s*:\s*(?:["']?[\w-]+["']?\s*\|\s*["']?[\w-]+["']?|[\d\s.,%$]+)[,;)]*$/i;
|
|
6238
6239
|
var TYPE_SIGNATURE_NOISE_PATTERN = /^(?:[-*]\s*)?(?:decision|artifact|receipt|proof|commitment|next action|follow[- ]?up|outcome|result|impact|roi|economics|open loop|gap|blocker|risk|owner|dri|rollback|quality score)\s*:\s*[A-Za-z_$][\w$]*(?:<[^>]+>)?[\s,;)]*$/i;
|
|
6239
6240
|
var TOOL_CATALOG_NOISE_PATTERN = /^(?:[-*]\s*)?(?:[a-z][\w.:-]*\s*\([^)]+\),?\s*){2,}$/i;
|
|
6240
|
-
var BARE_TOOL_SIGNAL_PATTERN = /^(?:\d+\.\s*|[-*]\s*)?(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
6241
|
-
var TOOL_QUESTION_NOISE_PATTERN = /^(?:\d+\.\s*)?\*\*[^*]+\*\*.*\?\s*(?:\([^)]*\b(?:mcp|
|
|
6241
|
+
var BARE_TOOL_SIGNAL_PATTERN = /^(?:\d+\.\s*|[-*]\s*)?(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write|orgx_inspect|ship_batch|record_outcome|orgx_free_audit)\s*$/i;
|
|
6242
|
+
var TOOL_QUESTION_NOISE_PATTERN = /^(?:\d+\.\s*)?\*\*[^*]+\*\*.*\?\s*(?:\([^)]*\b(?:mcp|orgx_write|start_plan_session)\b[^)]*\)\.?)?$/i;
|
|
6242
6243
|
var SOURCE_REFERENCE_NOISE_PATTERN = /(?:^|\s)(?:\.{0,2}\/)?(?:orgx|src|lib|workers|public|scripts|tests|apps|packages)\/[\w./-]+\.(?:ts|tsx|js|jsx|json|md|txt|sql|py)(?::\d+)?\b/i;
|
|
6243
6244
|
var FILE_REFERENCE_NOISE_PATTERN = /\b[\w.-]+\.(?:ts|tsx|js|jsx|json|md|txt|sql|py)(?::\d+(?:[–-]\d+)?)?\b/i;
|
|
6244
6245
|
var LOCAL_ASSET_REFERENCE_PATTERN = /(?:<BlogImage\b|source:\s*\/Users\/|\/blog\/[\w./-]+\.(?:png|jpg|jpeg|webp|gif))/i;
|
|
6245
6246
|
var LINE_NUMBER_SOURCE_NOISE_PATTERN = /^\d+(?::|\s+)\s*/i;
|
|
6246
|
-
var TOOL_WORKFLOW_NOISE_PATTERN = /(?:→|->).*\b(?:
|
|
6247
|
-
var TOOL_FAILURE_PATTERN = /^(?:\d+\.\s*)?(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
6248
|
-
var RUNTIME_FAILURE_PATTERN = /\b(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
6247
|
+
var TOOL_WORKFLOW_NOISE_PATTERN = /(?:→|->).*\b(?:orgx_write|orgx_spawn|record_outcome|submit_learning|orgx_recommend|mcp__orgx__)\b/i;
|
|
6248
|
+
var TOOL_FAILURE_PATTERN = /^(?:\d+\.\s*)?(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write|orgx_inspect|ship_batch|record_outcome|orgx_free_audit)\b.*\b(?:rejected|requires|failed|fails|error|invalid|unavailable|timeout|timed out|not\s+(?:called|dispatched|wired|created|available)|missing|broken)\b/i;
|
|
6249
|
+
var RUNTIME_FAILURE_PATTERN = /\b(?:mcp__orgx__[\w-]*|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write|orgx_inspect|ship_batch|record_outcome|submit_learning|orgx_spawn|agent run)\b.*\b(?:rejected|requires|failed|fails|error|invalid|unavailable|timeout|timed out|never|no\s+\w+|not\s+(?:called|dispatched|wired|created|available|append)|missing|broken|only\s+in\s+agent\s+skill\s+prompts)\b/i;
|
|
6249
6250
|
var PROCESS_NARRATION_NOISE_PATTERN = /^(?:now i\b|let me\b|i (?:have|need|will|can)\b|i['’]ll\b|i['’]m\b|so\b.*\b(?:confirm|check|verify|fetches)\b)/i;
|
|
6250
6251
|
function parseAiSessionSources(value) {
|
|
6251
6252
|
if (!value?.trim()) return [];
|
|
@@ -6340,6 +6341,7 @@ function normalizeAuditRelevantLine(line) {
|
|
|
6340
6341
|
if (IMPERATIVE_BOILERPLATE_PATTERN.test(trimmed)) return null;
|
|
6341
6342
|
if (CODE_OR_DOC_NOISE_PATTERN.test(trimmed)) return null;
|
|
6342
6343
|
if (EMPTY_AUDIT_LABEL_PATTERN.test(trimmed)) return null;
|
|
6344
|
+
if (LABEL_VALUE_NOISE_PATTERN.test(trimmed)) return null;
|
|
6343
6345
|
if (TYPE_SIGNATURE_NOISE_PATTERN.test(trimmed)) return null;
|
|
6344
6346
|
if (TOOL_CATALOG_NOISE_PATTERN.test(trimmed)) return null;
|
|
6345
6347
|
if ((trimmed.match(/\b[a-z][\w.:-]*\s*\([^)]+\)/g) ?? []).length >= 2) return null;
|
|
@@ -6416,19 +6418,32 @@ function readSessionImport(candidate, root, options) {
|
|
|
6416
6418
|
const extractor = candidate.source === "codex" ? extractCodexMessageText : extractClaudeMessageText;
|
|
6417
6419
|
const lines = readFileSync3(candidate.path, "utf8").split(/\r?\n/);
|
|
6418
6420
|
const relevantLines = [];
|
|
6421
|
+
let messageCount = 0;
|
|
6419
6422
|
for (const line of lines) {
|
|
6420
6423
|
const record = parseJsonLine(line);
|
|
6421
6424
|
const text2 = extractor(record);
|
|
6422
6425
|
if (!text2) continue;
|
|
6426
|
+
messageCount += 1;
|
|
6423
6427
|
relevantLines.push(...keepAuditRelevantLines(text2));
|
|
6424
6428
|
}
|
|
6425
6429
|
const deduped = [...new Set(relevantLines)].slice(0, 80);
|
|
6426
6430
|
if (deduped.length === 0) return null;
|
|
6427
6431
|
const relativePath = relative2(root, candidate.path);
|
|
6428
6432
|
return {
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6433
|
+
import: {
|
|
6434
|
+
sourceId: `${candidate.source}:${basename2(candidate.path, ".jsonl")}`,
|
|
6435
|
+
sourceLabel: `${candidate.source === "codex" ? "Codex" : "Claude"} session ${relativePath}`,
|
|
6436
|
+
metadata: {
|
|
6437
|
+
bytes: stats.size,
|
|
6438
|
+
message_count: messageCount,
|
|
6439
|
+
relative_path: relativePath,
|
|
6440
|
+
retained_line_count: deduped.length,
|
|
6441
|
+
source_client: candidate.source
|
|
6442
|
+
},
|
|
6443
|
+
text: deduped.join("\n")
|
|
6444
|
+
},
|
|
6445
|
+
messageCount,
|
|
6446
|
+
retainedLineCount: deduped.length
|
|
6432
6447
|
};
|
|
6433
6448
|
}
|
|
6434
6449
|
function loadAiSessionImports(options) {
|
|
@@ -6443,7 +6458,9 @@ function loadAiSessionImports(options) {
|
|
|
6443
6458
|
const imports = [];
|
|
6444
6459
|
const connectedSources = [];
|
|
6445
6460
|
const missingSources = [];
|
|
6461
|
+
let retainedLines = 0;
|
|
6446
6462
|
let scannedFiles = 0;
|
|
6463
|
+
let scannedMessages = 0;
|
|
6447
6464
|
let skippedFiles = 0;
|
|
6448
6465
|
for (const source of options.sources) {
|
|
6449
6466
|
const root = roots[source];
|
|
@@ -6456,12 +6473,14 @@ function loadAiSessionImports(options) {
|
|
|
6456
6473
|
for (const candidate of candidates) {
|
|
6457
6474
|
if (importedForSource >= limitPerSource) break;
|
|
6458
6475
|
scannedFiles += 1;
|
|
6459
|
-
const
|
|
6460
|
-
if (!
|
|
6476
|
+
const result = readSessionImport(candidate, root, { maxBytesPerFile });
|
|
6477
|
+
if (!result) {
|
|
6461
6478
|
skippedFiles += 1;
|
|
6462
6479
|
continue;
|
|
6463
6480
|
}
|
|
6464
|
-
imports.push(
|
|
6481
|
+
imports.push(result.import);
|
|
6482
|
+
retainedLines += result.retainedLineCount;
|
|
6483
|
+
scannedMessages += result.messageCount;
|
|
6465
6484
|
importedForSource += 1;
|
|
6466
6485
|
}
|
|
6467
6486
|
if (importedForSource > 0) {
|
|
@@ -6474,7 +6493,9 @@ function loadAiSessionImports(options) {
|
|
|
6474
6493
|
connectedSources,
|
|
6475
6494
|
imports,
|
|
6476
6495
|
missingSources,
|
|
6496
|
+
retainedLines,
|
|
6477
6497
|
scannedFiles,
|
|
6498
|
+
scannedMessages,
|
|
6478
6499
|
skippedFiles
|
|
6479
6500
|
};
|
|
6480
6501
|
}
|
|
@@ -7053,7 +7074,7 @@ function normalizeSourceClient(value) {
|
|
|
7053
7074
|
}
|
|
7054
7075
|
function sourceClientFromText(value) {
|
|
7055
7076
|
const normalized = value.toLowerCase();
|
|
7056
|
-
if (/\bclaude-code
|
|
7077
|
+
if (/\bclaude(?:[- ]code)?\b|\.claude\/projects|claude:/.test(normalized)) return "claude";
|
|
7057
7078
|
if (/\bcodex\b|\.codex\/sessions|rollout-/.test(normalized)) return "codex";
|
|
7058
7079
|
if (/\bcursor\b/.test(normalized)) return "cursor";
|
|
7059
7080
|
if (/\bopenclaw\b/.test(normalized)) return "openclaw";
|
|
@@ -7064,7 +7085,7 @@ function sourceClientFromText(value) {
|
|
|
7064
7085
|
if (/\bcalendar\b|\bmeeting\b/.test(normalized)) return "calendar";
|
|
7065
7086
|
if (/\bnotion\b/.test(normalized)) return "notion";
|
|
7066
7087
|
if (/\bdocs?\b|google drive/.test(normalized)) return "docs";
|
|
7067
|
-
if (/\bmcp\b|mcp__|orgx_emit|
|
|
7088
|
+
if (/\bmcp\b|mcp__|orgx_emit|orgx_write|ship_batch/.test(normalized)) return "mcp";
|
|
7068
7089
|
if (/\borgx api\b|\bapi\b/.test(normalized)) return "api";
|
|
7069
7090
|
return "unknown";
|
|
7070
7091
|
}
|
|
@@ -7095,11 +7116,11 @@ function normalizeConfidence(value, fallback = 0.72) {
|
|
|
7095
7116
|
}
|
|
7096
7117
|
function titleFromText(text2, fallback) {
|
|
7097
7118
|
const lower = text2.toLowerCase();
|
|
7098
|
-
if (lower.includes("
|
|
7099
|
-
return "OrgX MCP
|
|
7119
|
+
if (lower.includes("mcp__orgx__orgx_search") && lower.includes("zod")) {
|
|
7120
|
+
return "OrgX MCP orgx_search is failing schema validation";
|
|
7100
7121
|
}
|
|
7101
|
-
if (lower.includes("
|
|
7102
|
-
return "
|
|
7122
|
+
if (lower.includes("orgx_write") && lower.includes("auto_continue") && lower.includes("dispatch")) {
|
|
7123
|
+
return "orgx_write creates ready streams without dispatching agent runs";
|
|
7103
7124
|
}
|
|
7104
7125
|
if (lower.includes("operation qa loop") && lower.includes("0/") && lower.includes("entities")) {
|
|
7105
7126
|
return "OrgX scaffold fails to create Operation QA Loop entities";
|
|
@@ -7130,49 +7151,49 @@ function buildWorkGraphExtractionProtocol() {
|
|
|
7130
7151
|
source_search_strategy: [
|
|
7131
7152
|
{
|
|
7132
7153
|
id: "decisions",
|
|
7133
|
-
lens: "Decision
|
|
7154
|
+
lens: "Decision evidence",
|
|
7134
7155
|
query: "Find choices, tradeoffs, approvals, rejected options, contradictions, architecture calls, product calls, and decisions that were restated later.",
|
|
7135
7156
|
return_when: "A choice shaped future work, blocked work, or should become durable organizational memory."
|
|
7136
7157
|
},
|
|
7137
7158
|
{
|
|
7138
7159
|
id: "artifacts",
|
|
7139
|
-
lens: "Artifact
|
|
7160
|
+
lens: "Artifact evidence",
|
|
7140
7161
|
query: "Find created or modified artifacts: PRs, files, docs, designs, prompts, plans, reports, screenshots, deployed routes, tests, and verification receipts.",
|
|
7141
7162
|
return_when: "The artifact has a source event, proof reference, downstream use, owner, or missing verification."
|
|
7142
7163
|
},
|
|
7143
7164
|
{
|
|
7144
7165
|
id: "blockers",
|
|
7145
|
-
lens: "Blocker
|
|
7166
|
+
lens: "Blocker evidence",
|
|
7146
7167
|
query: "Find failed tool calls, timeouts, rejected validators, missing auth, missing source coverage, repeated unresolved questions, stalled owners, and external blockers.",
|
|
7147
7168
|
return_when: "The blocker explains why work did not become durable, verified, assigned, or shipped."
|
|
7148
7169
|
},
|
|
7149
7170
|
{
|
|
7150
7171
|
id: "people_businesses",
|
|
7151
|
-
lens: "People and business
|
|
7172
|
+
lens: "People and business context",
|
|
7152
7173
|
query: "Find users, customers, buyers, stakeholders, reviewers, teams, businesses, accounts, deal context, support signals, and market signals connected to work or decisions.",
|
|
7153
7174
|
return_when: "A person or business changes priority, ownership, revenue potential, customer pain, or follow-up urgency."
|
|
7154
7175
|
},
|
|
7155
7176
|
{
|
|
7156
7177
|
id: "coordination_sources",
|
|
7157
|
-
lens: "Coordination and calendar/email
|
|
7178
|
+
lens: "Coordination and calendar/email context",
|
|
7158
7179
|
query: "Find Slack threads, emails, meetings, docs, handoffs, approvals, owner changes, follow-ups, and coordination gaps that explain how work moved or stalled outside the AI client.",
|
|
7159
7180
|
return_when: "The coordination source proves ownership, urgency, approval, customer context, or a missing source needed for attribution."
|
|
7160
7181
|
},
|
|
7161
7182
|
{
|
|
7162
7183
|
id: "product_surfaces",
|
|
7163
|
-
lens: "Product surface
|
|
7184
|
+
lens: "Product surface coverage",
|
|
7164
7185
|
query: "Find surfaces such as live rooms, command center, widgets, plugins, wizard flows, public pages, APIs, MCP tools, Slack/GitHub/Linear integrations, and signup/claim flows.",
|
|
7165
7186
|
return_when: "A surface was changed, verified, blocked, requested, or connected to a goal or artifact."
|
|
7166
7187
|
},
|
|
7167
7188
|
{
|
|
7168
7189
|
id: "agents_tools_sources",
|
|
7169
|
-
lens: "Agent
|
|
7190
|
+
lens: "Agent, skill, tool, and source usage",
|
|
7170
7191
|
query: "Find agent runs, subagents, MCP calls, hook lifecycle events, tool availability, tool misses, source coverage, and runtime writeback behavior.",
|
|
7171
7192
|
return_when: "The event proves whether OrgX was called, skipped, unavailable, or only mentioned in instructions."
|
|
7172
7193
|
},
|
|
7173
7194
|
{
|
|
7174
7195
|
id: "outcomes_roi",
|
|
7175
|
-
lens: "Outcome and ROI
|
|
7196
|
+
lens: "Outcome and ROI evidence",
|
|
7176
7197
|
query: "Find shipped/completed work, test/browser/deploy verification, outcomes, time saved, cost, revenue, customer impact, attribution, and expected lift.",
|
|
7177
7198
|
return_when: "The outcome can be tied to evidence and a prior decision, artifact, blocker, or source."
|
|
7178
7199
|
},
|
|
@@ -7181,6 +7202,18 @@ function buildWorkGraphExtractionProtocol() {
|
|
|
7181
7202
|
lens: "Recurring patterns",
|
|
7182
7203
|
query: "Find repeated shapes across sessions: trapped decisions, orphaned artifacts, missing owner, repeated work, source gaps, tooling mismatch, unverified outcomes, handoff friction, and unclaimed business signals.",
|
|
7183
7204
|
return_when: "The same pattern appears across multiple sessions, days, tools, actors, or product surfaces."
|
|
7205
|
+
},
|
|
7206
|
+
{
|
|
7207
|
+
id: "domains",
|
|
7208
|
+
lens: "Domain coverage",
|
|
7209
|
+
query: "Find which domains the work spans: product/UX, agents/runtime, MCP/platform, wizard/CLI, plugin distribution, source integrations, quality verification, GTM, sales, operations, and business leverage.",
|
|
7210
|
+
return_when: "A domain has concrete work evidence, not just a generic mention."
|
|
7211
|
+
},
|
|
7212
|
+
{
|
|
7213
|
+
id: "skills_tools",
|
|
7214
|
+
lens: "Commonly invoked skills, agents, and tools",
|
|
7215
|
+
query: "Find named skills, OrgX domain agents, MCP tools, client tools, commands, test tools, and source systems that shaped the work.",
|
|
7216
|
+
return_when: "A skill/tool/source was used, requested, blocked, missed, or repeatedly referenced as part of execution."
|
|
7184
7217
|
}
|
|
7185
7218
|
],
|
|
7186
7219
|
required_output: {
|
|
@@ -7192,7 +7225,7 @@ function buildWorkGraphExtractionProtocol() {
|
|
|
7192
7225
|
search_queries: [
|
|
7193
7226
|
{
|
|
7194
7227
|
id: "decisions",
|
|
7195
|
-
lens: "Decision
|
|
7228
|
+
lens: "Decision evidence",
|
|
7196
7229
|
query: "query actually used",
|
|
7197
7230
|
result_count: 0
|
|
7198
7231
|
}
|
|
@@ -7227,12 +7260,13 @@ function buildWorkGraphExtractionProtocol() {
|
|
|
7227
7260
|
]
|
|
7228
7261
|
},
|
|
7229
7262
|
quality_bar: [
|
|
7230
|
-
"Search broadly before summarizing; do not stop at the newest session if older sessions contain recurrence.",
|
|
7263
|
+
"Search broadly through message turns before summarizing; do not stop at the newest session if older sessions contain recurrence.",
|
|
7231
7264
|
"Every finding must include a source id or evidence ref.",
|
|
7232
|
-
"A
|
|
7265
|
+
"A durable finding starts only from evidence-bearing work signals, not empty labels, code type signatures, tool catalogs, or guardrail text.",
|
|
7233
7266
|
"Prefer fewer, higher-confidence findings over many shallow lines.",
|
|
7234
7267
|
"Include negative evidence when OrgX/MCP was available but not called.",
|
|
7235
7268
|
"Separate actual tool calls from textual mentions of tool names.",
|
|
7269
|
+
"Extract the range of work domains and common skills/tools so the reader can see what kinds of work the audit actually understood.",
|
|
7236
7270
|
"Mark confidence below 0.6 when the finding is inferred from weak or single-source evidence.",
|
|
7237
7271
|
"Do not emit raw JSON tool payloads; summarize the tool result into a blocker/artifact/outcome finding."
|
|
7238
7272
|
],
|
|
@@ -7247,10 +7281,10 @@ function buildWorkGraphExtractionProtocol() {
|
|
|
7247
7281
|
]
|
|
7248
7282
|
};
|
|
7249
7283
|
const prompt = [
|
|
7250
|
-
"You are
|
|
7251
|
-
"Search across available local
|
|
7284
|
+
"You are running the OrgX AI-client audit skill from your own session/search logs.",
|
|
7285
|
+
"Search across available local message turns, transcripts, tool-call logs, hook events, and source indexes using every lens in the schema.",
|
|
7252
7286
|
"Return JSON only. Match the required_output shape exactly. Do not return raw transcripts.",
|
|
7253
|
-
"The output will
|
|
7287
|
+
"The output will create public-safe OrgX evidence paths, so every finding must be evidence-bearing and useful enough for a human to inspect."
|
|
7254
7288
|
].join(" ");
|
|
7255
7289
|
return {
|
|
7256
7290
|
schema_version: WORK_GRAPH_EXTRACTION_SCHEMA_VERSION,
|
|
@@ -7302,10 +7336,16 @@ function buildCoverage(imports, connectedSources, missingSources, clientExtracti
|
|
|
7302
7336
|
${extractionText}`.toLowerCase();
|
|
7303
7337
|
const orgxObserved = /\borgx\b|useorgx|mcp__orgx__|orgx_/i.test(allText);
|
|
7304
7338
|
const mcpObserved = /\bmcp\b|mcp__|tool call|tools\/call|call_tool|orgx_emit_activity/i.test(allText);
|
|
7305
|
-
const orgxMcpCalled = /mcp__orgx__|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|
|
|
7339
|
+
const orgxMcpCalled = /mcp__orgx__|orgx_emit_activity|orgx_apply_changeset|complete_with_proof|orgx_write/i.test(allText);
|
|
7306
7340
|
const skillOnlySignal = orgxObserved && !orgxMcpCalled && /\bskill|instructions|agent|workflow\b/i.test(allText);
|
|
7341
|
+
const normalizedConnectedSources = sortedUnique(
|
|
7342
|
+
connectedSources.map((source) => {
|
|
7343
|
+
const client = sourceClientFromText(source);
|
|
7344
|
+
return client === "unknown" ? source : labelForSourceClient(client);
|
|
7345
|
+
})
|
|
7346
|
+
);
|
|
7307
7347
|
const inferredConnected = [
|
|
7308
|
-
...
|
|
7348
|
+
...normalizedConnectedSources,
|
|
7309
7349
|
...sourceClients.includes("codex") ? ["Codex sessions"] : [],
|
|
7310
7350
|
...sourceClients.includes("claude") || sourceClients.includes("claude-code") ? ["Claude Code sessions"] : [],
|
|
7311
7351
|
...sourceClients.includes("github") ? ["Git/GitHub proof"] : [],
|
|
@@ -7349,14 +7389,16 @@ ${extractionText}`.toLowerCase();
|
|
|
7349
7389
|
function buildSourceCoverageManifests(input) {
|
|
7350
7390
|
const manifests = /* @__PURE__ */ new Map();
|
|
7351
7391
|
const addManifest = (manifest) => {
|
|
7352
|
-
const
|
|
7392
|
+
const sourceLabel2 = canonicalSourceManifestLabel(manifest);
|
|
7393
|
+
const key = `${manifest.source_client}:${sourceLabel2}`;
|
|
7353
7394
|
const previous = manifests.get(key);
|
|
7354
7395
|
if (!previous) {
|
|
7355
|
-
manifests.set(key, manifest);
|
|
7396
|
+
manifests.set(key, { ...manifest, source_label: sourceLabel2 });
|
|
7356
7397
|
return;
|
|
7357
7398
|
}
|
|
7358
7399
|
manifests.set(key, {
|
|
7359
7400
|
...previous,
|
|
7401
|
+
source_label: sourceLabel2,
|
|
7360
7402
|
status: previous.status === "connected" || manifest.status === "connected" ? "connected" : previous.status === "partial" || manifest.status === "partial" ? "partial" : "missing",
|
|
7361
7403
|
searched_sources: sortedUnique([...previous.searched_sources, ...manifest.searched_sources]),
|
|
7362
7404
|
searched_session_count: previous.searched_session_count + manifest.searched_session_count,
|
|
@@ -7423,6 +7465,15 @@ function buildSourceCoverageManifests(input) {
|
|
|
7423
7465
|
return rank[left.status] - rank[right.status] || right.finding_count - left.finding_count;
|
|
7424
7466
|
});
|
|
7425
7467
|
}
|
|
7468
|
+
function canonicalSourceManifestLabel(manifest) {
|
|
7469
|
+
if (manifest.source_client === "codex" || manifest.source_client === "claude" || manifest.source_client === "claude-code") {
|
|
7470
|
+
return labelForSourceClient(manifest.source_client);
|
|
7471
|
+
}
|
|
7472
|
+
if (manifest.source_client === "github" || manifest.source_client === "slack" || manifest.source_client === "mcp") {
|
|
7473
|
+
return labelForSourceClient(manifest.source_client);
|
|
7474
|
+
}
|
|
7475
|
+
return manifest.source_label;
|
|
7476
|
+
}
|
|
7426
7477
|
function labelForSourceClient(sourceClient) {
|
|
7427
7478
|
switch (sourceClient) {
|
|
7428
7479
|
case "codex":
|
|
@@ -7442,6 +7493,8 @@ function labelForSourceClient(sourceClient) {
|
|
|
7442
7493
|
return "Email coordination";
|
|
7443
7494
|
case "calendar":
|
|
7444
7495
|
return "Calendar/meeting context";
|
|
7496
|
+
case "wizard":
|
|
7497
|
+
return "Wizard audit layer";
|
|
7445
7498
|
case "notion":
|
|
7446
7499
|
case "docs":
|
|
7447
7500
|
return "Docs";
|
|
@@ -7489,6 +7542,60 @@ function buildClientExtractionEvents(clientExtractions) {
|
|
|
7489
7542
|
}
|
|
7490
7543
|
}));
|
|
7491
7544
|
}
|
|
7545
|
+
function numberFromImportMetadata(source, key) {
|
|
7546
|
+
const value = source.metadata?.[key];
|
|
7547
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
7548
|
+
}
|
|
7549
|
+
function buildAuditMethod(input) {
|
|
7550
|
+
const extractionSummaries = summarizeClientExtractions(input.clientExtractions);
|
|
7551
|
+
const nativePacks = extractionSummaries.filter((summary) => summary.source_client === "codex" || summary.source_client === "claude" || summary.source_client === "claude-code").map((summary) => ({
|
|
7552
|
+
source_client: summary.source_client,
|
|
7553
|
+
source_label: summary.source_label,
|
|
7554
|
+
searched_session_count: summary.searched_session_count,
|
|
7555
|
+
finding_count: summary.finding_count,
|
|
7556
|
+
confidence: summary.confidence
|
|
7557
|
+
}));
|
|
7558
|
+
const searchedMessages = input.imports.reduce(
|
|
7559
|
+
(total, source) => total + numberFromImportMetadata(source, "message_count"),
|
|
7560
|
+
0
|
|
7561
|
+
);
|
|
7562
|
+
const retainedLines = input.imports.reduce((total, source) => {
|
|
7563
|
+
const explicit = numberFromImportMetadata(source, "retained_line_count");
|
|
7564
|
+
return total + (explicit || source.text.split(/\r?\n/).filter(Boolean).length);
|
|
7565
|
+
}, 0);
|
|
7566
|
+
const skippedFiles = input.imports.reduce(
|
|
7567
|
+
(total, source) => total + numberFromImportMetadata(source, "skipped_file_count"),
|
|
7568
|
+
0
|
|
7569
|
+
);
|
|
7570
|
+
const extractionSearchedSessions = extractionSummaries.reduce(
|
|
7571
|
+
(total, summary) => total + summary.searched_session_count,
|
|
7572
|
+
0
|
|
7573
|
+
);
|
|
7574
|
+
const extractionSkippedSessions = extractionSummaries.reduce(
|
|
7575
|
+
(total, summary) => total + summary.skipped_session_count,
|
|
7576
|
+
0
|
|
7577
|
+
);
|
|
7578
|
+
const sourceGroups = sortedUnique([
|
|
7579
|
+
...input.imports.map((source) => source.sourceLabel),
|
|
7580
|
+
...input.clientExtractions.flatMap((extraction) => extraction.searched_sources ?? [])
|
|
7581
|
+
]);
|
|
7582
|
+
return {
|
|
7583
|
+
mode: "ai_client_session_search",
|
|
7584
|
+
searched_session_files: input.imports.length + extractionSearchedSessions,
|
|
7585
|
+
skipped_session_files: skippedFiles + extractionSkippedSessions,
|
|
7586
|
+
searched_message_count: searchedMessages,
|
|
7587
|
+
retained_evidence_lines: retainedLines,
|
|
7588
|
+
searched_source_groups: sourceGroups.length,
|
|
7589
|
+
extraction_lenses: input.extractionProtocol.schema.source_search_strategy.map((lens) => lens.lens),
|
|
7590
|
+
client_native_packs: nativePacks,
|
|
7591
|
+
privacy_contract: input.extractionProtocol.schema.privacy_contract,
|
|
7592
|
+
notes: [
|
|
7593
|
+
"The wizard reads local Codex/Claude message turns, filters out guardrails/code noise, then runs native extraction packs over the retained evidence lines.",
|
|
7594
|
+
"Counts describe local files/message turns inspected before redaction; raw transcripts are not stored in the report.",
|
|
7595
|
+
nativePacks.length > 0 ? "Codex/Claude native packs classified session evidence into decisions, artifacts, blockers, domains, skills/tools, and missed writeback signals." : "No native AI-client pack produced findings; this report is fallback-import only."
|
|
7596
|
+
]
|
|
7597
|
+
};
|
|
7598
|
+
}
|
|
7492
7599
|
function buildClientExtractionFindings(clientExtractions) {
|
|
7493
7600
|
const findings = [];
|
|
7494
7601
|
clientExtractions.forEach((extraction, extractionIndex) => {
|
|
@@ -7551,7 +7658,7 @@ function nativeEpisodeType(line) {
|
|
|
7551
7658
|
function nativeFindingConfidence(type, line) {
|
|
7552
7659
|
let confidence = type === "decision" || type === "artifact" || type === "outcome" ? 0.78 : 0.72;
|
|
7553
7660
|
if (/^\s*(?:decision|artifact|blocker|outcome|proof|result|next action|open loop|risk|gap)\s*:/i.test(line)) confidence += 0.08;
|
|
7554
|
-
if (/\b(?:mcp__orgx__|
|
|
7661
|
+
if (/\b(?:mcp__orgx__|orgx_write|orgx_emit_activity|complete_with_proof|github|codex|claude)\b/i.test(line)) confidence += 0.05;
|
|
7555
7662
|
if (line.length < 32) confidence -= 0.1;
|
|
7556
7663
|
return normalizeConfidence(confidence, 0.72);
|
|
7557
7664
|
}
|
|
@@ -7619,14 +7726,25 @@ function buildNativeAiClientExtractions(imports, generatedAt = (/* @__PURE__ */
|
|
|
7619
7726
|
source_client: sourceClient,
|
|
7620
7727
|
source_label: `${labelForSourceClient(sourceClient)} native extraction`,
|
|
7621
7728
|
searched_sources: sortedUnique(bucket.searchedSources),
|
|
7622
|
-
search_queries:
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7729
|
+
search_queries: buildWorkGraphExtractionProtocol().schema.source_search_strategy.map((lens) => ({
|
|
7730
|
+
id: lens.id,
|
|
7731
|
+
lens: lens.lens,
|
|
7732
|
+
query: lens.query,
|
|
7733
|
+
result_count: bucket.findings.filter((finding) => {
|
|
7734
|
+
const text2 = `${finding.title ?? ""}
|
|
7735
|
+
${finding.summary ?? ""}`;
|
|
7736
|
+
if (lens.id === "decisions") return finding.type === "decision";
|
|
7737
|
+
if (lens.id === "artifacts") return finding.type === "artifact";
|
|
7738
|
+
if (lens.id === "blockers") return finding.type === "blocker" || finding.type === "missed_orchestration_opportunity";
|
|
7739
|
+
if (lens.id === "people_businesses") return finding.type === "person" || finding.type === "business";
|
|
7740
|
+
if (lens.id === "product_surfaces") return finding.type === "product_surface" || /\b(surface|profile|wizard|plugin|mcp)\b/i.test(text2);
|
|
7741
|
+
if (lens.id === "agents_tools_sources") return /\b(agent|skill|tool|mcp|codex|claude|github|slack)\b/i.test(text2);
|
|
7742
|
+
if (lens.id === "outcomes_roi") return finding.type === "outcome" || finding.type === "business";
|
|
7743
|
+
if (lens.id === "domains") return nativeRelatedEntityNames(text2).length > 0;
|
|
7744
|
+
if (lens.id === "skills_tools") return /\b(orgx-design|agent|skill|tool|mcp|codex|claude|github|slack)\b/i.test(text2);
|
|
7745
|
+
return bucket.findings.length > 1 ? 1 : 0;
|
|
7746
|
+
}).length
|
|
7747
|
+
})),
|
|
7630
7748
|
extraction_quality: {
|
|
7631
7749
|
confidence: normalizeConfidence(
|
|
7632
7750
|
bucket.findings.reduce((total, finding) => total + (finding.confidence ?? 0.72), 0) / bucket.findings.length,
|
|
@@ -7690,6 +7808,101 @@ function buildDerivedFindings(imports) {
|
|
|
7690
7808
|
}
|
|
7691
7809
|
return findings;
|
|
7692
7810
|
}
|
|
7811
|
+
var WORK_GRAPH_DOMAIN_RULES = [
|
|
7812
|
+
{
|
|
7813
|
+
id: "domain:orgx-agents-runtime",
|
|
7814
|
+
label: "OrgX agents and runtime",
|
|
7815
|
+
summary: "Agent orchestration, MCP writeback, hooks, approvals, and runtime governance.",
|
|
7816
|
+
patterns: [/\bagent\b/i, /\bsubagent\b/i, /\bmcp\b/i, /\bhook\b/i, /\bwriteback\b/i, /\borgx_emit\b/i, /\bscaffold_initiative\b/i]
|
|
7817
|
+
},
|
|
7818
|
+
{
|
|
7819
|
+
id: "domain:wizard-cli",
|
|
7820
|
+
label: "Wizard and CLI",
|
|
7821
|
+
summary: "OrgX Wizard setup, audit/profile generation, local release, and onboarding commands.",
|
|
7822
|
+
patterns: [/\bwizard\b/i, /\bcli\b/i, /\bnpm\b/i, /\brelease\b/i, /\bpublish\b/i, /\bwork-graph\b/i, /\bsessions reconcile\b/i]
|
|
7823
|
+
},
|
|
7824
|
+
{
|
|
7825
|
+
id: "domain:public-profile-ux",
|
|
7826
|
+
label: "Public profile and UX",
|
|
7827
|
+
summary: "Shareable readout, claim flow, mobile/desktop layout, evidence inspection, and profile copy.",
|
|
7828
|
+
patterns: [/\bprofile\b/i, /\bpublic readout\b/i, /\bclaim\b/i, /\bmobile\b/i, /\bdesktop\b/i, /\bux\b/i, /\bmirror\b/i, /\btrail inspector\b/i]
|
|
7829
|
+
},
|
|
7830
|
+
{
|
|
7831
|
+
id: "domain:plugins-integrations",
|
|
7832
|
+
label: "Plugins and integrations",
|
|
7833
|
+
summary: "Codex, Claude Code, Cursor/OpenClaw, Slack, GitHub, Linear, and source coverage work.",
|
|
7834
|
+
patterns: [/\bplugin\b/i, /\bcodex\b/i, /\bclaude\b/i, /\bcursor\b/i, /\bopenclaw\b/i, /\bslack\b/i, /\bgithub\b/i, /\blinear\b/i]
|
|
7835
|
+
},
|
|
7836
|
+
{
|
|
7837
|
+
id: "domain:quality-verification",
|
|
7838
|
+
label: "Quality and verification",
|
|
7839
|
+
summary: "Tests, browser QA, type checks, release proof, and stale/fixed verification.",
|
|
7840
|
+
patterns: [/\btest\b/i, /\btypecheck\b/i, /\bqa\b/i, /\bverified\b/i, /\bproof\b/i, /\bplaywright\b/i, /\bbrowser\b/i, /\bci\b/i]
|
|
7841
|
+
},
|
|
7842
|
+
{
|
|
7843
|
+
id: "domain:gtm-business",
|
|
7844
|
+
label: "GTM and business leverage",
|
|
7845
|
+
summary: "ICP framing, pricing/value estimates, outreach, buyers, revenue, and market-facing proof.",
|
|
7846
|
+
patterns: [/\bicp\b/i, /\bbuyer\b/i, /\bpricing\b/i, /\brevenue\b/i, /\bsales\b/i, /\bmarketing\b/i, /\bgtm\b/i, /\boperator leverage\b/i]
|
|
7847
|
+
}
|
|
7848
|
+
];
|
|
7849
|
+
function buildDomainCoverage(findings) {
|
|
7850
|
+
const signals = WORK_GRAPH_DOMAIN_RULES.map((rule) => {
|
|
7851
|
+
const matched = findings.filter((finding) => {
|
|
7852
|
+
const text2 = `${finding.title}
|
|
7853
|
+
${finding.summary}
|
|
7854
|
+
${finding.metadata.redacted_verbatim ?? ""}`;
|
|
7855
|
+
return rule.patterns.some((pattern) => pattern.test(text2));
|
|
7856
|
+
});
|
|
7857
|
+
if (matched.length === 0) return null;
|
|
7858
|
+
return {
|
|
7859
|
+
id: rule.id,
|
|
7860
|
+
label: rule.label,
|
|
7861
|
+
summary: rule.summary,
|
|
7862
|
+
finding_count: matched.length,
|
|
7863
|
+
source_clients: sortedUnique(matched.map((finding) => finding.source_client)),
|
|
7864
|
+
evidence_refs: sortedUnique(matched.map((finding) => finding.evidence_ref)).slice(0, 12),
|
|
7865
|
+
confidence: Number((matched.reduce((total, finding) => total + finding.confidence, 0) / matched.length).toFixed(2))
|
|
7866
|
+
};
|
|
7867
|
+
}).filter((signal) => Boolean(signal));
|
|
7868
|
+
return signals.sort((left, right) => right.finding_count - left.finding_count || right.confidence - left.confidence).slice(0, 8);
|
|
7869
|
+
}
|
|
7870
|
+
var SKILL_TOOL_RULES = [
|
|
7871
|
+
{ id: "skill:orgx-design", kind: "skill", label: "orgx-design", pattern: /\borgx-design\b|\$orgx-design/i },
|
|
7872
|
+
{ id: "skill:runtime-reporting", kind: "skill", label: "orgx-runtime-reporting", pattern: /\borgx-runtime-reporting\b|runtime reporting/i },
|
|
7873
|
+
{ id: "skill:initiative-ops", kind: "skill", label: "orgx-initiative-ops", pattern: /\borgx-initiative-ops\b|initiative ops/i },
|
|
7874
|
+
{ id: "agent:engineering", kind: "agent", label: "engineering-agent", pattern: /\bengineering-agent\b|engineering agent/i },
|
|
7875
|
+
{ id: "agent:design", kind: "agent", label: "design-agent", pattern: /\bdesign-agent\b|design agent/i },
|
|
7876
|
+
{ id: "agent:product", kind: "agent", label: "product-agent", pattern: /\bproduct-agent\b|product agent/i },
|
|
7877
|
+
{ id: "agent:orchestrator", kind: "agent", label: "orchestrator-agent", pattern: /\borchestrator-agent\b|orchestrator agent/i },
|
|
7878
|
+
{ id: "tool:orgx-list-entities", kind: "mcp_tool", label: "mcp__orgx__orgx_search", pattern: /\bmcp__orgx__orgx_search\b/i },
|
|
7879
|
+
{ id: "tool:scaffold", kind: "mcp_tool", label: "orgx_write", pattern: /\bscaffold_initiative\b/i },
|
|
7880
|
+
{ id: "tool:complete-proof", kind: "mcp_tool", label: "complete_with_proof", pattern: /\bcomplete_with_proof\b/i },
|
|
7881
|
+
{ id: "tool:ship-batch", kind: "mcp_tool", label: "ship_batch", pattern: /\bship_batch\b/i },
|
|
7882
|
+
{ id: "client:codex", kind: "client_tool", label: "Codex", pattern: /\bcodex\b/i },
|
|
7883
|
+
{ id: "client:claude", kind: "client_tool", label: "Claude Code", pattern: /\bclaude(?: code)?\b/i },
|
|
7884
|
+
{ id: "source:github", kind: "source", label: "GitHub", pattern: /\bgithub\b|\bpull request\b|\bcommit\b/i },
|
|
7885
|
+
{ id: "source:slack", kind: "source", label: "Slack", pattern: /\bslack\b/i }
|
|
7886
|
+
];
|
|
7887
|
+
function buildSkillToolSignals(findings) {
|
|
7888
|
+
return SKILL_TOOL_RULES.map((rule) => {
|
|
7889
|
+
const matched = findings.filter(
|
|
7890
|
+
(finding) => rule.pattern.test(`${finding.title}
|
|
7891
|
+
${finding.summary}
|
|
7892
|
+
${finding.metadata.redacted_verbatim ?? ""}`)
|
|
7893
|
+
);
|
|
7894
|
+
if (matched.length === 0) return null;
|
|
7895
|
+
return {
|
|
7896
|
+
id: rule.id,
|
|
7897
|
+
label: rule.label,
|
|
7898
|
+
kind: rule.kind,
|
|
7899
|
+
mention_count: matched.length,
|
|
7900
|
+
source_clients: sortedUnique(matched.map((finding) => finding.source_client)),
|
|
7901
|
+
evidence_refs: sortedUnique(matched.map((finding) => finding.evidence_ref)).slice(0, 12),
|
|
7902
|
+
confidence: Number((matched.reduce((total, finding) => total + finding.confidence, 0) / matched.length).toFixed(2))
|
|
7903
|
+
};
|
|
7904
|
+
}).filter((signal) => Boolean(signal)).sort((left, right) => right.mention_count - left.mention_count || right.confidence - left.confidence).slice(0, 12);
|
|
7905
|
+
}
|
|
7693
7906
|
function buildWorkGraphEvents(imports) {
|
|
7694
7907
|
return imports.map((source, index) => ({
|
|
7695
7908
|
schema_version: WORK_GRAPH_SCHEMA_VERSION,
|
|
@@ -7702,6 +7915,7 @@ function buildWorkGraphEvents(imports) {
|
|
|
7702
7915
|
metadata: {
|
|
7703
7916
|
import_index: index,
|
|
7704
7917
|
line_count: source.text.split(/\r?\n/).filter(Boolean).length,
|
|
7918
|
+
...source.metadata ?? {},
|
|
7705
7919
|
raw_transcript_sent: false
|
|
7706
7920
|
}
|
|
7707
7921
|
}));
|
|
@@ -7826,8 +8040,8 @@ function estimateImpactProjection(input) {
|
|
|
7826
8040
|
],
|
|
7827
8041
|
assumptions: [
|
|
7828
8042
|
"Uses a conservative $200/hour blended founder/operator cost for public-safe value estimates.",
|
|
7829
|
-
"Acceleration estimates the execution lift from turning repeated
|
|
7830
|
-
"Impact is directional until the user claims the fingerprint and confirms or corrects
|
|
8043
|
+
"Acceleration estimates the execution lift from turning repeated evidence into automated attribution, decisions, and source connections.",
|
|
8044
|
+
"Impact is directional until the user claims the fingerprint and confirms or corrects the evidence."
|
|
7831
8045
|
]
|
|
7832
8046
|
};
|
|
7833
8047
|
}
|
|
@@ -7864,8 +8078,8 @@ function scoreExecutionQuality(input) {
|
|
|
7864
8078
|
actionability,
|
|
7865
8079
|
impact_confidence: impactConfidence,
|
|
7866
8080
|
notes: [
|
|
7867
|
-
"10/10 requires client-native extraction per source, multi-event
|
|
7868
|
-
multiEventTrails === trails.length ? "Every
|
|
8081
|
+
"10/10 requires client-native extraction per source, multi-event chronology, source-specific evidence, and action recommendations tied to impact.",
|
|
8082
|
+
multiEventTrails === trails.length ? "Every evidence path has multiple events." : `${trails.length - multiEventTrails} finding${trails.length - multiEventTrails === 1 ? "" : "s"} still need more chronology before they should be called recurring.`,
|
|
7869
8083
|
coverage.missing.length > 0 ? `Missing source coverage: ${coverage.missing.join(", ")}.` : "No required source gaps were declared for this run."
|
|
7870
8084
|
]
|
|
7871
8085
|
};
|
|
@@ -8065,7 +8279,7 @@ function trailTitleForGroup(entityType, group) {
|
|
|
8065
8279
|
const label = token.replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
8066
8280
|
if (entityType === "blocker") return `${label} is recurring as an execution blocker`;
|
|
8067
8281
|
if (entityType === "source") return `${label} is an attribution coverage gap`;
|
|
8068
|
-
if (entityType === "surface") return `${label} is becoming a product surface
|
|
8282
|
+
if (entityType === "surface") return `${label} is becoming a product surface evidence path`;
|
|
8069
8283
|
if (entityType === "outcome") return `${label} is becoming outcome evidence`;
|
|
8070
8284
|
return `${label} is becoming durable work`;
|
|
8071
8285
|
}
|
|
@@ -8078,7 +8292,7 @@ function trailSummaryForGroup(group) {
|
|
|
8078
8292
|
group.map((finding) => typeof finding.metadata.state === "string" ? finding.metadata.state : "").filter(Boolean)
|
|
8079
8293
|
);
|
|
8080
8294
|
return [
|
|
8081
|
-
`${group.length} evidence events connect this
|
|
8295
|
+
`${group.length} evidence events connect this finding across ${sources.join(", ")}.`,
|
|
8082
8296
|
states.length > 0 ? `Observed states: ${states.join(", ")}.` : "",
|
|
8083
8297
|
group[0]?.summary ?? ""
|
|
8084
8298
|
].filter(Boolean).join(" ");
|
|
@@ -8171,7 +8385,7 @@ function buildRecurringPatterns(coverage, findings, trails) {
|
|
|
8171
8385
|
patterns.push({
|
|
8172
8386
|
id: "pattern:trapped-decision",
|
|
8173
8387
|
title: "Decisions are being made without durable OrgX writeback",
|
|
8174
|
-
description: `${decisionTrails.length} decision
|
|
8388
|
+
description: `${decisionTrails.length} decision finding${decisionTrails.length === 1 ? "" : "s"} appeared while no OrgX MCP write was detected.`,
|
|
8175
8389
|
pattern_type: "trapped_decision",
|
|
8176
8390
|
affected_trail_ids: decisionTrails.map((trail) => trail.id),
|
|
8177
8391
|
affected_entity_ids: decisionTrails.map((trail) => trail.subject_entity_id),
|
|
@@ -8187,7 +8401,7 @@ function buildRecurringPatterns(coverage, findings, trails) {
|
|
|
8187
8401
|
patterns.push({
|
|
8188
8402
|
id: "pattern:orphaned-artifact",
|
|
8189
8403
|
title: "Artifacts do not have visible ownership",
|
|
8190
|
-
description: `${artifactTrails.length} artifact
|
|
8404
|
+
description: `${artifactTrails.length} artifact finding${artifactTrails.length === 1 ? "" : "s"} appeared without a clear owner-visible record.`,
|
|
8191
8405
|
pattern_type: "orphaned_artifact",
|
|
8192
8406
|
affected_trail_ids: artifactTrails.map((trail) => trail.id),
|
|
8193
8407
|
affected_entity_ids: artifactTrails.map((trail) => trail.subject_entity_id),
|
|
@@ -8236,7 +8450,7 @@ function buildRecurringPatterns(coverage, findings, trails) {
|
|
|
8236
8450
|
patterns.push({
|
|
8237
8451
|
id: "pattern:repeated-work",
|
|
8238
8452
|
title: "The same work shape is recurring",
|
|
8239
|
-
description: `${highRecurrence.length}
|
|
8453
|
+
description: `${highRecurrence.length} finding${highRecurrence.length === 1 ? "" : "s"} repeat strongly enough to deserve durable operating memory.`,
|
|
8240
8454
|
pattern_type: "repeated_work",
|
|
8241
8455
|
affected_trail_ids: highRecurrence.map((trail) => trail.id),
|
|
8242
8456
|
affected_entity_ids: highRecurrence.map((trail) => trail.subject_entity_id),
|
|
@@ -8252,7 +8466,7 @@ function buildRecurringPatterns(coverage, findings, trails) {
|
|
|
8252
8466
|
patterns.push({
|
|
8253
8467
|
id: "pattern:business-signal-unclaimed",
|
|
8254
8468
|
title: "Business signal has not become a launchable initiative",
|
|
8255
|
-
description: `${businessTrails.length} business
|
|
8469
|
+
description: `${businessTrails.length} business finding${businessTrails.length === 1 ? "" : "s"} appeared without a matching initiative candidate.`,
|
|
8256
8470
|
pattern_type: "business_signal_unclaimed",
|
|
8257
8471
|
affected_trail_ids: businessTrails.map((trail) => trail.id),
|
|
8258
8472
|
affected_entity_ids: businessTrails.map((trail) => trail.subject_entity_id),
|
|
@@ -8271,7 +8485,7 @@ function buildRecurringPatterns(coverage, findings, trails) {
|
|
|
8271
8485
|
patterns.push({
|
|
8272
8486
|
id: "pattern:handoff-friction",
|
|
8273
8487
|
title: topBlockerTrail && topBlockerTrail.events.length > 1 ? `${topBlockerTrail.title} and needs owner-visible resolution` : "Blockers are becoming handoff friction",
|
|
8274
|
-
description: `${blockerTrails.length} blocker
|
|
8488
|
+
description: `${blockerTrails.length} blocker finding${blockerTrails.length === 1 ? "" : "s"} need owner-visible resolution.`,
|
|
8275
8489
|
pattern_type: "handoff_friction",
|
|
8276
8490
|
affected_trail_ids: blockerTrails.map((trail) => trail.id),
|
|
8277
8491
|
affected_entity_ids: blockerTrails.map((trail) => trail.subject_entity_id),
|
|
@@ -8324,7 +8538,7 @@ function buildTrailRecommendations(patterns, trails) {
|
|
|
8324
8538
|
add({
|
|
8325
8539
|
id: "recommendation:connect-source",
|
|
8326
8540
|
title: "Connect missing source coverage",
|
|
8327
|
-
summary: "Close the evidence gap by connecting the coordination or proof sources where
|
|
8541
|
+
summary: "Close the evidence gap by connecting the coordination or proof sources where findings lose ownership or verification context.",
|
|
8328
8542
|
action_type: "connect_source",
|
|
8329
8543
|
trail_ids: pattern.affected_trail_ids,
|
|
8330
8544
|
evidence_refs: evidenceRefs,
|
|
@@ -8347,7 +8561,7 @@ function buildTrailRecommendations(patterns, trails) {
|
|
|
8347
8561
|
} else if (pattern.pattern_type === "handoff_friction") {
|
|
8348
8562
|
add({
|
|
8349
8563
|
id: "recommendation:resolve-blocker-handoff",
|
|
8350
|
-
title: "Resolve the blocker handoff
|
|
8564
|
+
title: "Resolve the blocker handoff",
|
|
8351
8565
|
summary: "Promote the recurring blocker path into assigned work with proof requirements and a clear owner.",
|
|
8352
8566
|
action_type: "assign_owner",
|
|
8353
8567
|
trail_ids: pattern.affected_trail_ids,
|
|
@@ -8359,7 +8573,7 @@ function buildTrailRecommendations(patterns, trails) {
|
|
|
8359
8573
|
} else if (pattern.pattern_type === "business_signal_unclaimed" || pattern.pattern_type === "repeated_work") {
|
|
8360
8574
|
add({
|
|
8361
8575
|
id: "recommendation:launch-initiative",
|
|
8362
|
-
title: "Launch from this
|
|
8576
|
+
title: "Launch from this evidence",
|
|
8363
8577
|
summary: "Convert the highest-recurring evidence path into an OrgX initiative with proof requirements.",
|
|
8364
8578
|
action_type: "launch_initiative",
|
|
8365
8579
|
trail_ids: pattern.affected_trail_ids,
|
|
@@ -8374,7 +8588,7 @@ function buildTrailRecommendations(patterns, trails) {
|
|
|
8374
8588
|
const topTrail = [...trails].sort((a, b) => b.impact_score - a.impact_score)[0];
|
|
8375
8589
|
add({
|
|
8376
8590
|
id: "recommendation:inspect-top-trail",
|
|
8377
|
-
title: "Inspect the strongest
|
|
8591
|
+
title: "Inspect the strongest finding",
|
|
8378
8592
|
summary: "Review the highest-confidence evidence path and decide whether it should become durable OrgX memory.",
|
|
8379
8593
|
action_type: "launch_initiative",
|
|
8380
8594
|
trail_ids: [topTrail.id],
|
|
@@ -8390,8 +8604,8 @@ function buildTrailRecommendations(patterns, trails) {
|
|
|
8390
8604
|
).slice(0, 5);
|
|
8391
8605
|
}
|
|
8392
8606
|
function buildWorkGraphMirror(input) {
|
|
8393
|
-
const { coverage, generatedAt, impact, patterns, recommendations, trails } = input;
|
|
8394
|
-
const topTrail =
|
|
8607
|
+
const { auditMethod, coverage, domains = [], generatedAt, impact, patterns, recommendations, skillToolSignals = [], trails } = input;
|
|
8608
|
+
const topTrail = selectPublicTopTrail(trails);
|
|
8395
8609
|
const topPattern = [...patterns].sort((a, b) => b.recurrence_count - a.recurrence_count)[0];
|
|
8396
8610
|
const decisionCount = trailsForType(trails, "decision").length;
|
|
8397
8611
|
const artifactCount = trailsForType(trails, "artifact").length;
|
|
@@ -8401,18 +8615,20 @@ function buildWorkGraphMirror(input) {
|
|
|
8401
8615
|
trails.flatMap((trail) => trail.events.map((event) => event.source_type))
|
|
8402
8616
|
);
|
|
8403
8617
|
const sourcePhrase = sourceClients.length > 0 ? sourceClients.map(labelForSourceClient).join(", ") : coverage.connected.join(", ") || "local sources";
|
|
8404
|
-
const headline = blockerCount > 0 ? "Your AI work is shipping, but the execution
|
|
8618
|
+
const headline = blockerCount > 0 ? "Your AI work is shipping, but the execution record is incomplete" : sourceGapCount > 0 ? "Your AI work is visible, but the proof chain is incomplete" : topPattern ? "Your work has a recurring operating pattern worth preserving" : topTrail ? "Your work is becoming an operating profile" : "Your work is leaving evidence OrgX can organize";
|
|
8619
|
+
const domainPhrase = domains.length > 0 ? domains.slice(0, 4).map((domain) => domain.label).join(", ") : "the connected work surface";
|
|
8620
|
+
const toolPhrase = skillToolSignals.length > 0 ? skillToolSignals.slice(0, 4).map((signal) => signal.label).join(", ") : "client sessions and available tools";
|
|
8405
8621
|
const primaryClaimRefs = topTrail?.evidence_refs ?? [];
|
|
8406
8622
|
const claims = [
|
|
8407
8623
|
{
|
|
8408
8624
|
id: "mirror:trail-count",
|
|
8409
|
-
text: `${trails.length} trails were detected across ${coverage.connected.length} connected source${coverage.connected.length === 1 ? "" : "s"}.`,
|
|
8625
|
+
text: `${trails.length} evidence-backed finding${trails.length === 1 ? "" : "s"} were detected across ${coverage.connected.length} connected source${coverage.connected.length === 1 ? "" : "s"}.`,
|
|
8410
8626
|
evidence_refs: trails.flatMap((trail) => trail.evidence_refs).slice(0, 6),
|
|
8411
8627
|
confidence: trails.length > 0 ? 0.82 : 0.55
|
|
8412
8628
|
},
|
|
8413
8629
|
{
|
|
8414
8630
|
id: "mirror:decision-artifact-balance",
|
|
8415
|
-
text: `${decisionCount} decision
|
|
8631
|
+
text: `${decisionCount} decision finding${decisionCount === 1 ? "" : "s"} and ${artifactCount} artifact finding${artifactCount === 1 ? "" : "s"} were found.`,
|
|
8416
8632
|
evidence_refs: trails.filter((trail) => trail.subject_entity_type === "decision" || trail.subject_entity_type === "artifact").flatMap((trail) => trail.evidence_refs).slice(0, 6),
|
|
8417
8633
|
confidence: 0.78
|
|
8418
8634
|
},
|
|
@@ -8424,18 +8640,21 @@ function buildWorkGraphMirror(input) {
|
|
|
8424
8640
|
},
|
|
8425
8641
|
...impact ? [{
|
|
8426
8642
|
id: "mirror:impact",
|
|
8427
|
-
text: `${impact.time_saved_hours_per_week} hours/week and +${impact.acceleration_percent}% execution acceleration are recoverable if the top
|
|
8643
|
+
text: `${impact.time_saved_hours_per_week} hours/week and +${impact.acceleration_percent}% execution acceleration are recoverable if the top findings get owner, proof, and writeback.`,
|
|
8428
8644
|
evidence_refs: trails.flatMap((trail) => trail.evidence_refs).slice(0, 6),
|
|
8429
8645
|
confidence: impact.confidence
|
|
8430
8646
|
}] : []
|
|
8431
8647
|
];
|
|
8648
|
+
const searchClaim = auditMethod ? `OrgX searched ${auditMethod.searched_session_files} AI-client session files and ${auditMethod.searched_message_count} message turns across ${sourcePhrase}; it retained ${auditMethod.retained_evidence_lines} evidence lines and excluded raw transcripts.` : `OrgX searched your AI-client session evidence across ${sourcePhrase} without requiring OrgX tool calls to be present.`;
|
|
8649
|
+
const topIssue = topTrail ? `The highest-risk issue is ${topTrail.title.toLowerCase()}.` : topPattern ? `The highest-risk pattern is ${topPattern.title.toLowerCase()}.` : "The first profile is forming from sparse evidence and should be reviewed before promotion.";
|
|
8432
8650
|
const body = [
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8651
|
+
searchClaim,
|
|
8652
|
+
`It found ${trails.length} evidence-backed finding${trails.length === 1 ? "" : "s"} across ${domainPhrase}, with ${toolPhrase} showing up as the strongest skills, tools, or sources.`,
|
|
8653
|
+
topIssue,
|
|
8654
|
+
blockerCount > 0 ? `${blockerCount} blocker finding${blockerCount === 1 ? "" : "s"} show work returning as new work instead of becoming owner-visible resolution.` : `${decisionCount} decision finding${decisionCount === 1 ? "" : "s"} and ${artifactCount} artifact finding${artifactCount === 1 ? "" : "s"} show where work can become durable.`,
|
|
8655
|
+
sourceGapCount > 0 ? `${sourceGapCount} source gap${sourceGapCount === 1 ? "" : "s"} still limit trust: ownership, handoffs, GitHub proof, Slack coordination, or later verification.` : "The connected sources are enough for a first public-safe profile, pending human review.",
|
|
8656
|
+
impact ? `Left unresolved, the profile estimates ${impact.time_saved_hours_per_week} recoverable hours/week and about $${impact.estimated_monthly_value_usd.toLocaleString("en-US")}/month in operator leverage.` : "",
|
|
8657
|
+
recommendations[0] ? `The next repair is concrete: ${recommendations[0].title}.` : "The next move is to inspect the highest-confidence finding before publishing it."
|
|
8439
8658
|
].filter(Boolean).join(" ");
|
|
8440
8659
|
return {
|
|
8441
8660
|
headline,
|
|
@@ -8446,6 +8665,24 @@ function buildWorkGraphMirror(input) {
|
|
|
8446
8665
|
generated_at: generatedAt
|
|
8447
8666
|
};
|
|
8448
8667
|
}
|
|
8668
|
+
function selectPublicTopTrail(trails) {
|
|
8669
|
+
const ranked = [...trails].sort((left, right) => publicTrailRank(right) - publicTrailRank(left));
|
|
8670
|
+
return ranked[0];
|
|
8671
|
+
}
|
|
8672
|
+
function publicTrailRank(trail) {
|
|
8673
|
+
const title = trail.title.trim();
|
|
8674
|
+
let score = trail.impact_score;
|
|
8675
|
+
if (trail.events.length > 1) score += 10;
|
|
8676
|
+
if (trail.subject_entity_type === "blocker") score += 6;
|
|
8677
|
+
if (/\b(?:scaffold|ship_batch|mcp__orgx__orgx_search|list entities|schema validation|route behavior|dispatching agent runs|operation qa loop)\b/i.test(title)) {
|
|
8678
|
+
score += 14;
|
|
8679
|
+
}
|
|
8680
|
+
if (/^(?:[-*✓{`'"]|\d+[,.]?$)/.test(title)) score -= 32;
|
|
8681
|
+
if (/[{}|;]/.test(title)) score -= 28;
|
|
8682
|
+
if (title.length < 22) score -= 26;
|
|
8683
|
+
if (/^(?:result|summary)\s*:/i.test(title)) score -= 18;
|
|
8684
|
+
return score;
|
|
8685
|
+
}
|
|
8449
8686
|
function buildTensionMetrics(input) {
|
|
8450
8687
|
const { coverage, impact, patterns, quality, trails } = input;
|
|
8451
8688
|
const decisionTrails = trailsForType(trails, "decision");
|
|
@@ -8461,7 +8698,7 @@ function buildTensionMetrics(input) {
|
|
|
8461
8698
|
tone: quality.overall >= 82 ? "good" : quality.overall >= 65 ? "warning" : "danger",
|
|
8462
8699
|
trail_ids: trails.slice(0, 8).map((trail) => trail.id),
|
|
8463
8700
|
evidence_refs: trails.flatMap((trail) => trail.evidence_refs).slice(0, 8),
|
|
8464
|
-
explanation: "Weighted audit quality across evidence coverage, attribution,
|
|
8701
|
+
explanation: "Weighted audit quality across evidence coverage, attribution, chronology depth, insight depth, actionability, and impact confidence."
|
|
8465
8702
|
}] : [],
|
|
8466
8703
|
...impact ? [{
|
|
8467
8704
|
id: "tension:time-saved",
|
|
@@ -8496,7 +8733,7 @@ function buildTensionMetrics(input) {
|
|
|
8496
8733
|
tone: decisionTrails.length > 0 && !coverage.orgxMcpCalled ? "danger" : "muted",
|
|
8497
8734
|
trail_ids: decisionTrails.map((trail) => trail.id),
|
|
8498
8735
|
evidence_refs: decisionTrails.flatMap((trail) => trail.evidence_refs).slice(0, 8),
|
|
8499
|
-
explanation: "Decision
|
|
8736
|
+
explanation: "Decision evidence that has not been promoted into durable OrgX records."
|
|
8500
8737
|
},
|
|
8501
8738
|
{
|
|
8502
8739
|
id: "tension:artifacts-orphaned",
|
|
@@ -8523,7 +8760,7 @@ function buildTensionMetrics(input) {
|
|
|
8523
8760
|
tone: topReady.length > 0 && blockerTrails.length === 0 ? "good" : "muted",
|
|
8524
8761
|
trail_ids: topReady.map((trail) => trail.id).slice(0, 6),
|
|
8525
8762
|
evidence_refs: topReady.flatMap((trail) => trail.evidence_refs).slice(0, 8),
|
|
8526
|
-
explanation: "High-confidence
|
|
8763
|
+
explanation: "High-confidence findings that can become initiatives, decisions, artifacts, or owner-visible follow-ups."
|
|
8527
8764
|
}
|
|
8528
8765
|
];
|
|
8529
8766
|
}
|
|
@@ -8924,6 +9161,7 @@ function buildSessionReconciliationReport(input) {
|
|
|
8924
9161
|
throw new Error("At least one source import or AI-client extraction is required to build a Work Graph report.");
|
|
8925
9162
|
}
|
|
8926
9163
|
const generatedAt = input.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
9164
|
+
const extractionProtocol = buildWorkGraphExtractionProtocol();
|
|
8927
9165
|
const clientExtractionSummaries = summarizeClientExtractions(clientExtractions);
|
|
8928
9166
|
const connectedSources = sortedUnique([
|
|
8929
9167
|
...input.connectedSources ?? input.imports.map((source) => source.sourceLabel),
|
|
@@ -8939,6 +9177,13 @@ function buildSessionReconciliationReport(input) {
|
|
|
8939
9177
|
(finding, index, all) => all.findIndex((candidate) => candidate.evidence_ref === finding.evidence_ref) === index
|
|
8940
9178
|
);
|
|
8941
9179
|
const allFindings = [...findings, ...autoMissed];
|
|
9180
|
+
const auditMethod = buildAuditMethod({
|
|
9181
|
+
clientExtractions,
|
|
9182
|
+
extractionProtocol,
|
|
9183
|
+
imports: input.imports
|
|
9184
|
+
});
|
|
9185
|
+
const domainCoverage = buildDomainCoverage(allFindings);
|
|
9186
|
+
const skillToolSignals = buildSkillToolSignals(allFindings);
|
|
8942
9187
|
const trails = buildWorkGraphTrails(allFindings, generatedAt);
|
|
8943
9188
|
const recurringPatterns = buildRecurringPatterns(coverage, allFindings, trails);
|
|
8944
9189
|
const opportunityScore = scoreOpportunity(coverage, allFindings);
|
|
@@ -8960,11 +9205,14 @@ function buildSessionReconciliationReport(input) {
|
|
|
8960
9205
|
trails
|
|
8961
9206
|
});
|
|
8962
9207
|
const mirror = buildWorkGraphMirror({
|
|
9208
|
+
auditMethod,
|
|
8963
9209
|
coverage,
|
|
9210
|
+
domains: domainCoverage,
|
|
8964
9211
|
generatedAt,
|
|
8965
9212
|
impact: impactProjection,
|
|
8966
9213
|
patterns: recurringPatterns,
|
|
8967
9214
|
recommendations,
|
|
9215
|
+
skillToolSignals,
|
|
8968
9216
|
trails
|
|
8969
9217
|
});
|
|
8970
9218
|
const tensionMetrics = buildTensionMetrics({
|
|
@@ -9014,8 +9262,11 @@ function buildSessionReconciliationReport(input) {
|
|
|
9014
9262
|
source_client: "wizard",
|
|
9015
9263
|
session_id: sessionId,
|
|
9016
9264
|
workspace: input.workspace,
|
|
9017
|
-
extraction_protocol:
|
|
9265
|
+
extraction_protocol: extractionProtocol,
|
|
9266
|
+
audit_method: auditMethod,
|
|
9018
9267
|
client_extractions: clientExtractionSummaries,
|
|
9268
|
+
domain_coverage: domainCoverage,
|
|
9269
|
+
skill_tool_signals: skillToolSignals,
|
|
9019
9270
|
source_coverage: coverage,
|
|
9020
9271
|
final_state: inferFinalState(allFindings),
|
|
9021
9272
|
events,
|
|
@@ -9096,6 +9347,18 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9096
9347
|
lines.push(`- ${lens.lens}: ${lens.return_when}`);
|
|
9097
9348
|
}
|
|
9098
9349
|
lines.push("");
|
|
9350
|
+
lines.push("## Audit Method");
|
|
9351
|
+
lines.push("");
|
|
9352
|
+
lines.push(`Mode: ${report.audit_method.mode}`);
|
|
9353
|
+
lines.push(`Session files searched: ${report.audit_method.searched_session_files}`);
|
|
9354
|
+
lines.push(`Message turns searched: ${report.audit_method.searched_message_count}`);
|
|
9355
|
+
lines.push(`Evidence lines retained: ${report.audit_method.retained_evidence_lines}`);
|
|
9356
|
+
lines.push(`Source groups searched: ${report.audit_method.searched_source_groups}`);
|
|
9357
|
+
lines.push(`Extraction lenses: ${report.audit_method.extraction_lenses.join(", ")}`);
|
|
9358
|
+
for (const note of report.audit_method.notes) {
|
|
9359
|
+
lines.push(`- ${note}`);
|
|
9360
|
+
}
|
|
9361
|
+
lines.push("");
|
|
9099
9362
|
lines.push("## Client Extractions");
|
|
9100
9363
|
lines.push("");
|
|
9101
9364
|
if (report.client_extractions.length === 0) {
|
|
@@ -9106,6 +9369,26 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9106
9369
|
}
|
|
9107
9370
|
}
|
|
9108
9371
|
lines.push("");
|
|
9372
|
+
lines.push("## Domain Coverage");
|
|
9373
|
+
lines.push("");
|
|
9374
|
+
if (report.domain_coverage.length === 0) {
|
|
9375
|
+
lines.push("- No domain clusters reached the public-summary threshold.");
|
|
9376
|
+
} else {
|
|
9377
|
+
for (const domain of report.domain_coverage) {
|
|
9378
|
+
lines.push(`- ${domain.label}: ${domain.finding_count} findings across ${domain.source_clients.join(", ")}. ${domain.summary}`);
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
lines.push("");
|
|
9382
|
+
lines.push("## Skills, Agents, Tools, and Sources");
|
|
9383
|
+
lines.push("");
|
|
9384
|
+
if (report.skill_tool_signals.length === 0) {
|
|
9385
|
+
lines.push("- No repeated skill/tool signals reached the public-summary threshold.");
|
|
9386
|
+
} else {
|
|
9387
|
+
for (const signal of report.skill_tool_signals) {
|
|
9388
|
+
lines.push(`- [${signal.kind}] ${signal.label}: ${signal.mention_count} mention${signal.mention_count === 1 ? "" : "s"} across ${signal.source_clients.join(", ")}.`);
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9391
|
+
lines.push("");
|
|
9109
9392
|
lines.push("## Opportunity Score");
|
|
9110
9393
|
lines.push("");
|
|
9111
9394
|
lines.push(`Overall: ${report.opportunity_score.overall}/100`);
|
|
@@ -9121,7 +9404,7 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9121
9404
|
lines.push(`Overall: ${report.execution_quality.overall}/100`);
|
|
9122
9405
|
lines.push(`Evidence coverage: ${report.execution_quality.evidence_coverage}/100`);
|
|
9123
9406
|
lines.push(`Source attribution: ${report.execution_quality.source_attribution}/100`);
|
|
9124
|
-
lines.push(`
|
|
9407
|
+
lines.push(`Chronology depth: ${report.execution_quality.trail_depth}/100`);
|
|
9125
9408
|
lines.push(`Insight depth: ${report.execution_quality.insight_depth}/100`);
|
|
9126
9409
|
lines.push(`Actionability: ${report.execution_quality.actionability}/100`);
|
|
9127
9410
|
lines.push(`Impact confidence: ${report.execution_quality.impact_confidence}/100`);
|
|
@@ -9155,7 +9438,7 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9155
9438
|
}
|
|
9156
9439
|
}
|
|
9157
9440
|
lines.push("");
|
|
9158
|
-
lines.push("##
|
|
9441
|
+
lines.push("## Operating Readout");
|
|
9159
9442
|
lines.push("");
|
|
9160
9443
|
lines.push(`### ${report.mirror.headline}`);
|
|
9161
9444
|
lines.push("");
|
|
@@ -9165,13 +9448,13 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9165
9448
|
lines.push(`- ${claim.text} (${claim.evidence_refs.join(", ") || "no evidence refs"})`);
|
|
9166
9449
|
}
|
|
9167
9450
|
lines.push("");
|
|
9168
|
-
lines.push("##
|
|
9451
|
+
lines.push("## Operating Leakage");
|
|
9169
9452
|
lines.push("");
|
|
9170
9453
|
for (const metric of report.tension_metrics) {
|
|
9171
9454
|
lines.push(`- ${metric.value} ${metric.label}: ${metric.explanation}`);
|
|
9172
9455
|
}
|
|
9173
9456
|
lines.push("");
|
|
9174
|
-
lines.push("##
|
|
9457
|
+
lines.push("## Evidence Paths");
|
|
9175
9458
|
lines.push("");
|
|
9176
9459
|
for (const trail of report.trails.slice(0, 12)) {
|
|
9177
9460
|
lines.push(`- [${trail.kind}] ${trail.title} \u2014 ${trail.state}, ${trail.valence}, ${trail.shape} (${trail.evidence_refs.join(", ")})`);
|
|
@@ -9209,7 +9492,7 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9209
9492
|
lines.push(`- [${kickoff.priority}] ${kickoff.title}: ${kickoff.summary}`);
|
|
9210
9493
|
}
|
|
9211
9494
|
lines.push("");
|
|
9212
|
-
lines.push("##
|
|
9495
|
+
lines.push("## Repair Recommendations");
|
|
9213
9496
|
lines.push("");
|
|
9214
9497
|
for (const recommendation of report.recommendations) {
|
|
9215
9498
|
lines.push(`- [${recommendation.priority}] ${recommendation.title}: ${recommendation.summary}`);
|
|
@@ -9255,6 +9538,29 @@ function renderWorkGraphMarkdown(report) {
|
|
|
9255
9538
|
}
|
|
9256
9539
|
|
|
9257
9540
|
// src/lib/work-graph-publish.ts
|
|
9541
|
+
import { gzipSync } from "zlib";
|
|
9542
|
+
var WORK_GRAPH_REPORT_GZIP_THRESHOLD_BYTES = 96e3;
|
|
9543
|
+
function encodeWorkGraphReportPostBody(payload, thresholdBytes = WORK_GRAPH_REPORT_GZIP_THRESHOLD_BYTES) {
|
|
9544
|
+
const json = JSON.stringify(payload);
|
|
9545
|
+
const byteLength = Buffer.byteLength(json);
|
|
9546
|
+
if (byteLength < thresholdBytes) {
|
|
9547
|
+
return {
|
|
9548
|
+
body: json,
|
|
9549
|
+
headers: { "Content-Type": "application/json" },
|
|
9550
|
+
byteLength,
|
|
9551
|
+
compressed: false
|
|
9552
|
+
};
|
|
9553
|
+
}
|
|
9554
|
+
return {
|
|
9555
|
+
body: gzipSync(json),
|
|
9556
|
+
headers: {
|
|
9557
|
+
"Content-Encoding": "gzip",
|
|
9558
|
+
"Content-Type": "application/json"
|
|
9559
|
+
},
|
|
9560
|
+
byteLength,
|
|
9561
|
+
compressed: true
|
|
9562
|
+
};
|
|
9563
|
+
}
|
|
9258
9564
|
async function parseResponse(response) {
|
|
9259
9565
|
const text2 = await response.text();
|
|
9260
9566
|
if (!text2) return null;
|
|
@@ -9270,22 +9576,23 @@ async function publishWorkGraphReport(report, options = {}) {
|
|
|
9270
9576
|
throw new Error("OrgX auth is required to publish a Work Graph. Run `orgx-wizard auth login` or set ORGX_API_KEY.");
|
|
9271
9577
|
}
|
|
9272
9578
|
const url = buildOrgxApiUrl("/client/work-graph/reports", auth.baseUrl);
|
|
9579
|
+
const encoded = encodeWorkGraphReportPostBody({
|
|
9580
|
+
report,
|
|
9581
|
+
...options.workspaceId ? { workspace_id: options.workspaceId } : {},
|
|
9582
|
+
...options.initiativeId ? { initiative_id: options.initiativeId } : {},
|
|
9583
|
+
...options.entityType ? { entity_type: options.entityType } : {},
|
|
9584
|
+
...options.entityId ? { entity_id: options.entityId } : {},
|
|
9585
|
+
...options.artifactUrl ? { artifact_url: options.artifactUrl } : {},
|
|
9586
|
+
attach_artifact: Boolean(options.attachArtifact),
|
|
9587
|
+
public_share: Boolean(options.publicShare)
|
|
9588
|
+
});
|
|
9273
9589
|
const response = await fetch(url, {
|
|
9274
9590
|
method: "POST",
|
|
9275
9591
|
headers: {
|
|
9276
9592
|
Authorization: `Bearer ${auth.apiKey}`,
|
|
9277
|
-
|
|
9593
|
+
...encoded.headers
|
|
9278
9594
|
},
|
|
9279
|
-
body:
|
|
9280
|
-
report,
|
|
9281
|
-
...options.workspaceId ? { workspace_id: options.workspaceId } : {},
|
|
9282
|
-
...options.initiativeId ? { initiative_id: options.initiativeId } : {},
|
|
9283
|
-
...options.entityType ? { entity_type: options.entityType } : {},
|
|
9284
|
-
...options.entityId ? { entity_id: options.entityId } : {},
|
|
9285
|
-
...options.artifactUrl ? { artifact_url: options.artifactUrl } : {},
|
|
9286
|
-
attach_artifact: Boolean(options.attachArtifact),
|
|
9287
|
-
public_share: Boolean(options.publicShare)
|
|
9288
|
-
}),
|
|
9595
|
+
body: encoded.body,
|
|
9289
9596
|
signal: options.signal ?? AbortSignal.timeout(15e3)
|
|
9290
9597
|
});
|
|
9291
9598
|
return {
|
|
@@ -10122,6 +10429,11 @@ async function readAuditImports(options, interactive) {
|
|
|
10122
10429
|
imports.push({
|
|
10123
10430
|
sourceId: "wizard-audit-input",
|
|
10124
10431
|
sourceLabel: options.sourceLabel?.trim() || "Wizard audit input",
|
|
10432
|
+
metadata: {
|
|
10433
|
+
message_count: 1,
|
|
10434
|
+
retained_line_count: text2.split(/\r?\n/).filter(Boolean).length,
|
|
10435
|
+
source_client: "manual"
|
|
10436
|
+
},
|
|
10125
10437
|
text: text2
|
|
10126
10438
|
});
|
|
10127
10439
|
connectedSources.push(options.sourceLabel?.trim() || "Manual AI-session import");
|
|
@@ -10397,11 +10709,11 @@ async function runWorkGraphCommand(options, defaults = {}) {
|
|
|
10397
10709
|
missedOrchestration: report.missed_orchestration_opportunities.length,
|
|
10398
10710
|
clientExtractionCount: report.client_extractions.length,
|
|
10399
10711
|
kickoffCount: report.initiative_kickoffs.length,
|
|
10400
|
-
|
|
10712
|
+
findingCount: report.trails.length,
|
|
10401
10713
|
recurringPatternCount: report.recurring_patterns.length,
|
|
10402
10714
|
attributionCount: report.attribution_spine.review.pending_count,
|
|
10403
|
-
|
|
10404
|
-
|
|
10715
|
+
topFinding: report.mirror.primary_trail_id ?? null,
|
|
10716
|
+
readoutHeadline: report.mirror.headline,
|
|
10405
10717
|
published
|
|
10406
10718
|
}, null, 2));
|
|
10407
10719
|
return;
|
|
@@ -10417,8 +10729,8 @@ async function runWorkGraphCommand(options, defaults = {}) {
|
|
|
10417
10729
|
const missed = report.missed_orchestration_opportunities.length;
|
|
10418
10730
|
const missedColor = missed > 0 ? pc3.yellow : pc3.green;
|
|
10419
10731
|
console.log(` ${missed > 0 ? ICON.warn : ICON.ok} ${missedColor("missed ")} ${pc3.dim(`${missed} orchestration opportunit${missed === 1 ? "y" : "ies"}`)}`);
|
|
10420
|
-
console.log(` ${ICON.ok} ${pc3.green("
|
|
10421
|
-
console.log(` ${ICON.skip} ${pc3.bold("
|
|
10732
|
+
console.log(` ${ICON.ok} ${pc3.green("findings ")} ${pc3.dim(`${report.trails.length} finding${report.trails.length === 1 ? "" : "s"} \xB7 ${report.recurring_patterns.length} recurring pattern${report.recurring_patterns.length === 1 ? "" : "s"}`)}`);
|
|
10733
|
+
console.log(` ${ICON.skip} ${pc3.bold("readout ")} ${report.mirror.headline}`);
|
|
10422
10734
|
for (const metric of report.tension_metrics.slice(0, 4)) {
|
|
10423
10735
|
const tone = metric.tone === "danger" ? pc3.red : metric.tone === "warning" ? pc3.yellow : metric.tone === "good" ? pc3.green : pc3.dim;
|
|
10424
10736
|
console.log(` ${ICON.skip} ${tone(`${metric.value} ${metric.label}`)} ${pc3.dim(metric.explanation)}`);
|
|
@@ -11389,7 +11701,7 @@ function printDoctorReport(report, assessment) {
|
|
|
11389
11701
|
async function main() {
|
|
11390
11702
|
const program = new Command();
|
|
11391
11703
|
program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
|
|
11392
|
-
const pkgVersion = true ? "0.1.
|
|
11704
|
+
const pkgVersion = true ? "0.1.38" : void 0;
|
|
11393
11705
|
program.version(pkgVersion ?? "unknown", "-V, --version");
|
|
11394
11706
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
11395
11707
|
if (Boolean(actionCommand.optsWithGlobals().json)) return;
|
|
@@ -12089,22 +12401,22 @@ async function main() {
|
|
|
12089
12401
|
});
|
|
12090
12402
|
await runAuditCommand(options);
|
|
12091
12403
|
});
|
|
12092
|
-
const workGraph = program.command("work-graph").description("Build a redacted OrgX
|
|
12093
|
-
workGraph.command("extraction-schema").description("Print the AI-client
|
|
12404
|
+
const workGraph = program.command("work-graph").description("Build a redacted OrgX Profile from AI-client session search, Slack, MCP, or manual context.");
|
|
12405
|
+
workGraph.command("extraction-schema").description("Print the packaged AI-client audit skill used to search sessions, messages, tools, domains, and logs.").option("--output <path>", "write the schema prompt to a file").option("--json", "emit the protocol as JSON instead of Markdown").action(async (options) => {
|
|
12094
12406
|
await safeTrackWizardTelemetry("work_graph_extraction_schema_started", {
|
|
12095
12407
|
command: "work-graph extraction-schema",
|
|
12096
12408
|
json: Boolean(options.json)
|
|
12097
12409
|
});
|
|
12098
12410
|
runWorkGraphExtractionSchemaCommand(options);
|
|
12099
12411
|
});
|
|
12100
|
-
workGraph.command("preview").description("Preview the
|
|
12412
|
+
workGraph.command("preview").description("Preview the OrgX Profile evidence findings without writing to OrgX.").option("--input <path>", "source transcript or summary file; stdin is used when piped").option("--extraction <path>", "structured AI-client extraction JSON; repeat or comma-separate for multiple clients", collectPathOption, []).option("--from <sources>", "auto-import recent local AI sessions: codex, claude, or all").option("--session-limit <count>", "max recent sessions to import per selected source", "15").option("--session-days <days>", "lookback window for local AI-session imports", "60").option("--codex-sessions-dir <path>", "override Codex sessions directory for import").option("--claude-projects-dir <path>", "override Claude projects directory for import").option("--source-label <label>", "label for the imported manual source").option("--workspace-id <id>", "workspace id override; defaults to the current OrgX workspace when authenticated").option("--workspace-name <name>", "workspace name override for local-only previews").option("--output-dir <path>", "directory for generated Work Graph JSON and Markdown", ".orgx/work-graph").option("--json", "emit a JSON command summary").action(async (options) => {
|
|
12101
12413
|
await safeTrackWizardTelemetry("work_graph_preview_started", {
|
|
12102
12414
|
command: "work-graph preview",
|
|
12103
12415
|
from: options.from ?? "manual"
|
|
12104
12416
|
});
|
|
12105
12417
|
await runWorkGraphCommand(options);
|
|
12106
12418
|
});
|
|
12107
|
-
workGraph.command("profile").description("Build a local OrgX Profile with
|
|
12419
|
+
workGraph.command("profile").description("Build a local OrgX Profile with evidence findings, domain coverage, source confidence, and repair recommendations.").option("--input <path>", "source transcript or summary file; stdin is used when piped").option("--extraction <path>", "structured AI-client extraction JSON; repeat or comma-separate for multiple clients", collectPathOption, []).option("--from <sources>", "auto-import recent local AI sessions: codex, claude, or all").option("--session-limit <count>", "max recent sessions to import per selected source", "25").option("--session-days <days>", "lookback window for local AI-session imports", "60").option("--codex-sessions-dir <path>", "override Codex sessions directory for import").option("--claude-projects-dir <path>", "override Claude projects directory for import").option("--source-label <label>", "label for the imported manual source").option("--workspace-id <id>", "workspace id override; defaults to the current OrgX workspace when authenticated").option("--workspace-name <name>", "workspace name override for local-only profiles").option("--output-dir <path>", "directory for generated Work Graph JSON and Markdown", ".orgx/work-graph").option("--publish", "publish the generated OrgX Profile to OrgX and return a shareable URL").option("--public-share", "create a public redacted /work-graph/<token> share when publishing").option("--attach-artifact", "attach the report as an OrgX artifact when an initiative/entity is provided").option("--attach-to-initiative <id>", "attach the report to an existing OrgX initiative").option("--entity-type <type>", "entity type for artifact attachment: project, initiative, milestone, task, decision").option("--entity-id <id>", "entity id for artifact attachment").option("--artifact-url <url>", "override the artifact URL stored in OrgX").option("--yes", "approve publish/write prompts in non-interactive mode").option("--json", "emit a JSON command summary").action(async (options) => {
|
|
12108
12420
|
await safeTrackWizardTelemetry("work_graph_profile_started", {
|
|
12109
12421
|
command: "work-graph profile",
|
|
12110
12422
|
from: options.from ?? "manual"
|
|
@@ -12112,7 +12424,7 @@ async function main() {
|
|
|
12112
12424
|
await runWorkGraphCommand(options);
|
|
12113
12425
|
});
|
|
12114
12426
|
const sessions = program.command("sessions").description("Inspect and reconcile local AI sessions into OrgX-ready Work Graph reports.");
|
|
12115
|
-
sessions.command("reconcile").description("Backfill recent Codex and Claude sessions into a redacted
|
|
12427
|
+
sessions.command("reconcile").description("Backfill recent Codex and Claude sessions into a redacted OrgX Profile report.").option("--extraction <path>", "structured AI-client extraction JSON; repeat or comma-separate for multiple clients", collectPathOption, []).option("--from <sources>", "auto-import recent local AI sessions: codex, claude, or all", "all").option("--session-limit <count>", "max recent sessions to import per selected source", "25").option("--session-days <days>", "lookback window for local AI-session imports", "30").option("--codex-sessions-dir <path>", "override Codex sessions directory for import").option("--claude-projects-dir <path>", "override Claude projects directory for import").option("--workspace-id <id>", "workspace id override; defaults to the current OrgX workspace when authenticated").option("--workspace-name <name>", "workspace name override for local-only reconciliation").option("--output-dir <path>", "directory for generated Work Graph JSON and Markdown", ".orgx/work-graph").option("--publish", "publish the generated OrgX Profile to OrgX and return a shareable URL").option("--public-share", "create a public redacted /work-graph/<token> share when publishing").option("--attach-artifact", "attach the report as an OrgX artifact when an initiative/entity is provided").option("--attach-to-initiative <id>", "attach the report to an existing OrgX initiative").option("--entity-type <type>", "entity type for artifact attachment: project, initiative, milestone, task, decision").option("--entity-id <id>", "entity id for artifact attachment").option("--artifact-url <url>", "override the artifact URL stored in OrgX").option("--yes", "approve publish/write prompts in non-interactive mode").option("--json", "emit a JSON command summary").action(async (options) => {
|
|
12116
12428
|
await safeTrackWizardTelemetry("sessions_reconcile_started", {
|
|
12117
12429
|
command: "sessions reconcile",
|
|
12118
12430
|
from: options.from ?? "all"
|