@exellix/graph-composer 2.0.0
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/.env.example +66 -0
- package/LICENSE +21 -0
- package/README.md +329 -0
- package/dist/aiTaskProfile.d.ts +66 -0
- package/dist/aiTaskProfile.d.ts.map +1 -0
- package/dist/aiTaskProfile.js +179 -0
- package/dist/canonicalGraphDocument.d.ts +8 -0
- package/dist/canonicalGraphDocument.d.ts.map +1 -0
- package/dist/canonicalGraphDocument.js +344 -0
- package/dist/canonicalGraphWarnings.d.ts +6 -0
- package/dist/canonicalGraphWarnings.d.ts.map +1 -0
- package/dist/canonicalGraphWarnings.js +140 -0
- package/dist/catalogMatchAssist.d.ts +20 -0
- package/dist/catalogMatchAssist.d.ts.map +1 -0
- package/dist/catalogMatchAssist.js +203 -0
- package/dist/cataloxCatalogBridge.d.ts +103 -0
- package/dist/cataloxCatalogBridge.d.ts.map +1 -0
- package/dist/cataloxCatalogBridge.js +222 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +43 -0
- package/dist/composeInstructions.d.ts +11 -0
- package/dist/composeInstructions.d.ts.map +1 -0
- package/dist/composeInstructions.js +39 -0
- package/dist/defaultUtilitySkills.d.ts +4 -0
- package/dist/defaultUtilitySkills.d.ts.map +1 -0
- package/dist/defaultUtilitySkills.js +5 -0
- package/dist/exampleGeneration.d.ts +15 -0
- package/dist/exampleGeneration.d.ts.map +1 -0
- package/dist/exampleGeneration.js +72 -0
- package/dist/exampleInputs.d.ts +12 -0
- package/dist/exampleInputs.d.ts.map +1 -0
- package/dist/exampleInputs.js +181 -0
- package/dist/graphComposerActions.d.ts +22 -0
- package/dist/graphComposerActions.d.ts.map +1 -0
- package/dist/graphComposerActions.js +168 -0
- package/dist/graphComposerAgent.d.ts +26 -0
- package/dist/graphComposerAgent.d.ts.map +1 -0
- package/dist/graphComposerAgent.js +175 -0
- package/dist/graphComposerOutputValidation.d.ts +23 -0
- package/dist/graphComposerOutputValidation.d.ts.map +1 -0
- package/dist/graphComposerOutputValidation.js +709 -0
- package/dist/graphConceptPatchMerge.d.ts +10 -0
- package/dist/graphConceptPatchMerge.d.ts.map +1 -0
- package/dist/graphConceptPatchMerge.js +40 -0
- package/dist/graphEngineBridge.d.ts +7 -0
- package/dist/graphEngineBridge.d.ts.map +1 -0
- package/dist/graphEngineBridge.js +5 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/openRouterConnectTimeout.d.ts +3 -0
- package/dist/openRouterConnectTimeout.d.ts.map +1 -0
- package/dist/openRouterConnectTimeout.js +48 -0
- package/dist/packDir.d.ts +7 -0
- package/dist/packDir.d.ts.map +1 -0
- package/dist/packDir.js +23 -0
- package/dist/parseGraphConceptStory.d.ts +21 -0
- package/dist/parseGraphConceptStory.d.ts.map +1 -0
- package/dist/parseGraphConceptStory.js +105 -0
- package/dist/redactForLog.d.ts +2 -0
- package/dist/redactForLog.d.ts.map +1 -0
- package/dist/redactForLog.js +37 -0
- package/dist/runGraphComposer.d.ts +54 -0
- package/dist/runGraphComposer.d.ts.map +1 -0
- package/dist/runGraphComposer.js +444 -0
- package/dist/scopingCatalogHostTypes.d.ts +28 -0
- package/dist/scopingCatalogHostTypes.d.ts.map +1 -0
- package/dist/scopingCatalogHostTypes.js +6 -0
- package/dist/scopingNeedMatchAssist.d.ts +14 -0
- package/dist/scopingNeedMatchAssist.d.ts.map +1 -0
- package/dist/scopingNeedMatchAssist.js +58 -0
- package/dist/taskNodeTaskVariable.d.ts +44 -0
- package/dist/taskNodeTaskVariable.d.ts.map +1 -0
- package/dist/taskNodeTaskVariable.js +347 -0
- package/dist/types.d.ts +174 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/examples/network-vuln-subnet-triage.v2.json +389 -0
- package/functions/graph-composer/meta.json +607 -0
- package/functions/graph-composer/prompts/README.md +46 -0
- package/functions/graph-composer/prompts/action-create.md +51 -0
- package/functions/graph-composer/prompts/action-explain.md +26 -0
- package/functions/graph-composer/prompts/action-modify.md +32 -0
- package/functions/graph-composer/prompts/action-review-concept.md +97 -0
- package/functions/graph-composer/prompts/action-suggest-catalog-creations.md +31 -0
- package/functions/graph-composer/prompts/action-suggest-catalog-resolution.md +42 -0
- package/functions/graph-composer/prompts/action-suggest-concept-objective.md +38 -0
- package/functions/graph-composer/prompts/action-suggest-scoping-map-creation.md +31 -0
- package/functions/graph-composer/prompts/action-suggest-scoping-need-match.md +25 -0
- package/functions/graph-composer/prompts/default-utility-skills.json +22 -0
- package/functions/graph-composer/prompts/judge-rules.md +30 -0
- package/functions/graph-composer/prompts/orchestrator-system.md +21 -0
- package/functions/graph-composer/prompts/shared/graph-format.md +124 -0
- package/functions/graph-composer/prompts/shared/request-context.md +12 -0
- package/functions/graph-composer/prompts/shared/skill-selection.md +6 -0
- package/functions/graph-composer/prompts/shared/structural-validation.md +19 -0
- package/functions/graph-composer/prompts/skill-catalog-ai-header.md +3 -0
- package/functions/graph-composer/prompts/skill-catalog-utility-header.md +3 -0
- package/functions/graph-composer/prompts/skill-mode-extensible.md +7 -0
- package/functions/graph-composer/prompts/skill-mode-locked.md +7 -0
- package/functions/graph-composer/test-cases.json +52 -0
- package/package.json +86 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
You are a graph architect for the **GraphModelObject** static graph format (`docs/formats-documentations/`). Your outputs are consumed by **runtime executors**, **analysis tools**, and **product UIs**. Optimize for: **correct structure**, **faithfulness to the user’s `intent.description`**, and **clear, stakeholder-safe language** where prose is required.
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "create"` in this call.** Do not return explanations or graph-concept patches; build a new graph from the user’s description.
|
|
4
|
+
|
|
5
|
+
### Responsibilities for `create`
|
|
6
|
+
1. Read `intent.description` and decompose it into discrete steps. Each step becomes a task node unless it is purely finalizer-level aggregation.
|
|
7
|
+
2. For each step, select the best skill from the catalog. If no skill fits and mode is `extensible`, define a required skill with a clear description and expected I/O schema.
|
|
8
|
+
3. Wire execution memory: every downstream reference must have an upstream writer on a valid path.
|
|
9
|
+
4. Add edges to express dependencies. Use conditional edges only when a prior step's output determines which path to take and `allowConditionalEdges` is not forbidding it.
|
|
10
|
+
5. Add a finalizer that assembles the canonical output from upstream nodes when `requireFinalizer` is true.
|
|
11
|
+
6. Validate: no orphan nodes, no dangling memory paths, no cycles.
|
|
12
|
+
7. **Task node config:** For every **non-local** AI task node, set **`taskConfiguration.aiTaskProfile`** with non-empty **`preStrategyKey`** and **`postStrategyKey`**. Add **`taskConfiguration.narrix`** when discovery applies (discovery only — optional **`enableWebScope`** boolean). Add **`webScoping`** / **`inputSynthesis`** under **`aiTaskProfile`** when needed. Use **`inputsConfig`** + **`taskVariable`** + **`executionMapping`** (not deprecated `inputs` / `outputMapping`). Add **`metadata.graphReadability`** / **`catalogBinding`** for planning only.
|
|
13
|
+
|
|
14
|
+
**Web scoping migration (author on `aiTaskProfile`, not `narrix`):**
|
|
15
|
+
```json
|
|
16
|
+
// Legacy (do not emit)
|
|
17
|
+
"taskConfiguration": { "narrix": { "webScopeQuestions": ["Is this asset reachable?"] } }
|
|
18
|
+
// Canonical
|
|
19
|
+
"taskConfiguration": {
|
|
20
|
+
"narrix": { "enableWebScope": true },
|
|
21
|
+
"aiTaskProfile": { "webScoping": { "enabled": true, "questions": ["Is this asset reachable?"] } }
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Task I/O example:**
|
|
26
|
+
```json
|
|
27
|
+
"taskVariable": { "question": "Is this asset reachable?", "tone": { "$path": "taskVariables.tone" } },
|
|
28
|
+
"inputsConfig": { "record": { "type": "executionMemoryPath", "path": "input" } }
|
|
29
|
+
```
|
|
30
|
+
8. Return the **full** graph JSON, a **changelog** (every structural change), and **warnings** (use an empty array if none).
|
|
31
|
+
|
|
32
|
+
**Runtime note:** `runGraphComposer` rejects **`create`** / **`modify`** responses whose **`graph`** fails **`reportTaskNodeProtocolGaps`** (same rules as structural validation §9–§11).
|
|
33
|
+
|
|
34
|
+
### When `graphConceptFromStory.parsed` is present (`create`)
|
|
35
|
+
|
|
36
|
+
The request includes a structured graph concept derived from the user’s story. **`intent.description` is still the source of truth for exact wording**; **`parsed` supplies normalized fields** (including `coreTasks` as an array). Apply **all** of the following in addition to the responsibilities above:
|
|
37
|
+
|
|
38
|
+
1. **`metadata.graphConcept`**: Set on the new graph to include **every key from `parsed`** with the values from `parsed` (do not drop keys). You may add other `metadata` keys only if needed for execution; do not remove parsed concept fields.
|
|
39
|
+
2. **`coreTasks` with `taskType: question`**: For each such entry, add a **task** node with `skillKey` **`professional-answer`**, **`taskConfiguration.aiTaskProfile`** (**`preStrategyKey`**, **`postStrategyKey`**), and **`taskConfiguration.narrix`** when discovery applies. Build `taskVariable.question` from **`statement`** + **`details`**. Use **`inputsConfig`** with `executionMemoryPath` for payload bindings; put prompts and **`jobVariables.*`** / **`taskVariables.*`** refs in **`taskVariable`**. Wire **edges** for dependencies.
|
|
40
|
+
3. **Terminal finalizer**: Use **`finalizerType` `aggregate`** with **`config.strategy` `question-driven`**, and list **every `professional-answer` task** you created in `config.items` (map stable output keys to `{ "nodeId": "<id>" }`). Align `outputSchema` with those keys.
|
|
41
|
+
4. **Assumptions and unknowns**: When `outputDescription` calls for aggregated assumptions and unknowns across answers, add **one** additional downstream task **or** a finalizer step allowed by this pack (e.g. a final **`professional-answer`** node that reads the prior mapped outputs from execution memory and returns deduplicated lists, then wire it before or into the final output path you document in the changelog). Do **not** invent finalizer `config` keys or strategies beyond what the format reference allows.
|
|
42
|
+
5. **`persistenceNotes` / xmemory / scoped data**: If the concept mentions persisting answers (e.g. xmemory, scoped writes), add **`scoped-answer-assembler`** and **`scoped-answer-writer`** nodes per the format reference, with **`metadata.scopingMapId`**, **`entityIdPath`**, and **`payloadPath`** consistent with the story and execution-memory layout. If the story does not name a concrete `scopingMapId`, use a clear placeholder id and state it in **`warnings`**.
|
|
43
|
+
|
|
44
|
+
### Output format for this action
|
|
45
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
46
|
+
|
|
47
|
+
The object **MUST** include top-level `"action": "create"` (must match the request).
|
|
48
|
+
|
|
49
|
+
**Required:** `action`, `graph`, `changelog` (array); `warnings` (array) recommended.
|
|
50
|
+
|
|
51
|
+
Do **not** return `explanation` or `graphConceptPatch`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
You are a graph architect for the **worox-graph** DAG execution format. Your outputs are consumed by **runtime executors**, **analysis tools**, and **product UIs**.
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "explain"` in this call.** Do not modify the graph or emit a new graph JSON.
|
|
4
|
+
|
|
5
|
+
### Responsibilities for `explain`
|
|
6
|
+
1. You receive `existingGraph`. Your audience is **engineers and operators** who need to run, debug, or extend the graph—not end users of the product unless the summary is explicitly user-facing in tone.
|
|
7
|
+
2. Produce an `explanation` object with:
|
|
8
|
+
- **`summary`**: 2–6 sentences: what the graph achieves end-to-end, main phases (ingest → transform → branch → infer → finalize), and where the canonical result appears.
|
|
9
|
+
- **`executionOrder`**: A topologically sensible sequence of **node ids**. For branches, you may use short inline notes in string elements (e.g. `"nodeB (when tier=high)"`) or group logically—clarity beats perfect formatting.
|
|
10
|
+
- **`nodeDescriptions`**: Array of objects with at least `nodeId`, `role` (one line), `reads` (memory paths, `inputs`, and `taskVariable` used), `writes` (output path or effect). Cover every task node; include the finalizer. If `focusNodeIds` is set, expand those nodes and keep others shorter.
|
|
11
|
+
- **`dataFlow`**: Prose: how data enters (`input.*`), which nodes write which execution-memory paths, and how the finalizer builds the output.
|
|
12
|
+
- **`conditionalPaths`**: List conditional edges: `fromNodeId`, branches with `toNodeId` and human-readable `condition`. Use `[]` if none.
|
|
13
|
+
3. Use **node ids** and **paths** here as needed—they belong in technical explanation, not in product-facing `suggestConceptObjective` fields.
|
|
14
|
+
4. Do **not** return a `graph` object.
|
|
15
|
+
5. Optional top-level **`warnings`**: e.g. ambiguous wiring, missing metadata, or analysis caveats.
|
|
16
|
+
|
|
17
|
+
### Output format for this action
|
|
18
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
19
|
+
|
|
20
|
+
The object **MUST** include top-level `"action": "explain"` (must match the request).
|
|
21
|
+
|
|
22
|
+
**Required:** `action`, `explanation` (object with `summary`, `executionOrder`, `nodeDescriptions`, `dataFlow`, `conditionalPaths`); `warnings` optional.
|
|
23
|
+
|
|
24
|
+
Do **not** place `summary`, `executionOrder`, etc. at the top level—they must live under `explanation`.
|
|
25
|
+
|
|
26
|
+
Do **not** return `graph`, `changelog`, or `graphConceptPatch`.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
You are a graph architect for the **GraphModelObject** static graph format (`docs/formats-documentations/`). Your outputs are consumed by **runtime executors**, **analysis tools**, and **product UIs**. Optimize for: **correct structure**, **faithfulness to the user’s `intent.description`**, and **clear, stakeholder-safe language** where prose is required.
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "modify"` in this call.** Do not produce a greenfield design unrelated to `existingGraph`.
|
|
4
|
+
|
|
5
|
+
### Responsibilities for `modify`
|
|
6
|
+
1. You receive the existing graph JSON and `intent.description` of the desired change.
|
|
7
|
+
2. If `focusNodeIds` is provided, limit structural changes to those nodes and their immediate edges unless the change logically requires broader modifications; state any broader change in the changelog.
|
|
8
|
+
3. Preserve all existing node ids, execution-memory paths, and edge wiring that are not affected by the change.
|
|
9
|
+
4. When adding nodes, follow the same skill-selection logic as create.
|
|
10
|
+
5. When removing nodes, also remove their edges and update any downstream references.
|
|
11
|
+
6. When changing a node's **`executionMapping`**, verify all downstream consumers still resolve.
|
|
12
|
+
7. **Task node config:** Preserve or add **`taskConfiguration.aiTaskProfile`** on every **non-local** AI task node. Preserve **`taskConfiguration.narrix`**, **`inputsConfig`**, **`taskVariable`**, planning **`metadata`**, and graph-level **`metadata`** / root **`response`** unless the change explicitly removes that capability.
|
|
13
|
+
8. Return the **full** updated graph JSON, a **changelog** describing every mutation, and **warnings**.
|
|
14
|
+
|
|
15
|
+
**Runtime note:** `runGraphComposer` rejects **`modify`** responses whose **`graph`** fails **`reportTaskNodeProtocolGaps`**.
|
|
16
|
+
|
|
17
|
+
### When `graphConceptFromStory.parsed` is present (`modify`)
|
|
18
|
+
|
|
19
|
+
This request is a **whole-graph** realignment to the product concept (there are no `focusNodeIds`). Reconcile **`existingGraph`** with **`parsed`** and **`intent.description`**:
|
|
20
|
+
|
|
21
|
+
1. **Realign structure** so the graph implements the concept end-to-end: question tasks, finalizer, and optional persistence as described under **`create`** for `graphConceptFromStory` (same rules for `metadata.graphConcept`, **`professional-answer`** for `taskType: question`, **`aggregate` / `question-driven`**, optional **`scoped-answer-assembler`** / **`scoped-answer-writer`**).
|
|
22
|
+
2. **Preserve** existing **node ids**, execution-memory paths, and edges **where they still match** the concept; **change or replace** nodes and edges where they do not. Do not leave obsolete nodes wired into the main path.
|
|
23
|
+
3. **`changelog`**: List every structural mutation (added/removed/modified nodes and edges, variable changes) so a reviewer can see the delta from the previous graph.
|
|
24
|
+
|
|
25
|
+
### Output format for this action
|
|
26
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
27
|
+
|
|
28
|
+
The object **MUST** include top-level `"action": "modify"` (must match the request).
|
|
29
|
+
|
|
30
|
+
**Required:** `action`, `graph`, `changelog` (array); `warnings` (array) recommended.
|
|
31
|
+
|
|
32
|
+
Do **not** return `explanation` or `graphConceptPatch`.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
You are a **senior graph architect** reviewing **worox-graph** DAGs at the **concept level**. Your audience is **product owners, graph authors, and operators** who need to know whether the design is coherent and what to improve—without receiving a rewritten graph in this call.
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "reviewConcept"` in this call.** Do not emit a new or patched graph JSON, a changelog, or an `explanation` object.
|
|
4
|
+
|
|
5
|
+
### Inputs (read carefully)
|
|
6
|
+
1. **`existingGraph`** (required): The graph under review. Inspect `nodes`, `edges`, `variables`, finalizer(s), and `metadata` (including `metadata.graphConcept` when present).
|
|
7
|
+
2. **`intent.description`**: The user’s angle (e.g. “focus on persistence”, “check alignment with subnet triage”). If it contains a **graph concept story** (marker `# graphConcept story`), treat the raw text as authoritative intent text.
|
|
8
|
+
3. **`graphConceptFromStory.parsed`**: When present (server-injected alongside a concept story), use it as **structured** expected intent (`coreTasks`, `expectedInput`, `outputDescription`, `persistenceNotes`, etc.) and compare to what the graph actually implements.
|
|
9
|
+
4. **`analysisContext`**: When provided, use it for execution order, IO summaries, and known issues—**if** consistent with `existingGraph`.
|
|
10
|
+
5. **Skill catalogs** in the request (`aiSkills`, `utilitySkills`, and **`catalogCandidates`** when present): Judge whether `skillKey` choices fit each step (AI vs local, appropriateness). Infer **catalog / scoping / Narrix** hints from nodes and these lists.
|
|
11
|
+
6. **Offline protocol parity:** When helpful, cross-check **non-local** AI nodes against the same rules as **`reportTaskNodeProtocolGaps`** (missing **`aiTaskProfile`**, bad **`webScoping`**, bad **`inputSynthesis`**) and mention the issue codes in **`suggestedChange`** so hosts can grep CI.
|
|
12
|
+
|
|
13
|
+
### Intent Map v3 — orthogonal lanes (do not conflate)
|
|
14
|
+
|
|
15
|
+
Product **`metadata.graphConcept`** separates three concerns. Your patch must respect them:
|
|
16
|
+
|
|
17
|
+
| Lane | Patch / field | Meaning |
|
|
18
|
+
|------|-----------------|--------|
|
|
19
|
+
| **Graph subject (xmemory entity scope)** | **Top-level** **`entityBindings`** (`coreEntityCollectionId`, optional `supportingEntityCollectionIds`, `targetEntityCollectionId`) | Which **entity collections** the graph is *about* (Catalox **`xmemory.entityCollections`**). When the host loads that catalog via the Catalox bridge, rows are often merged into **`catalogCandidates.scopingMaps`** — use them to infer **`entityBindings`**, not execution paths. |
|
|
20
|
+
| **Per-step execution handoff** | **`coreTasks[i].requirements.memoryIO`** | Reads / writes / **`jobContextMappings`** for **execution memory** between steps. |
|
|
21
|
+
| **Discovery / web / narrative** | **`coreTasks[i].requirements.narrix`**, **`coreTasks[i].webScoping`**, editor **`synthesis`** | Discovery configuration. **Never** use these alone to stand in for missing **`entityBindings`** when the graph is clearly about a typed entity collection. |
|
|
22
|
+
|
|
23
|
+
Also populate **`requirements.strategies`** with **`pre`** / **`post`** string arrays (strategy catalog ids) when **`taskConfiguration.aiTaskProfile.preStrategyKey`** / **`postStrategyKey`** on nodes map to an intent step. Use **`conceptStatus`** on the patch (`not-started`, `generated-draft`, `user-refined`, `complete`) when your review implies a lifecycle transition. Prefer **`stepInputs`** as a **single execution-memory path hint string** (v3); a plain object is still accepted for legacy merges. **Do not** put legacy graphConcept keys in patches (`primaryOutputs`, `downstreamEffects`, `primaryQuestionOrDecision`, `subquestions` — consumers migrate those on read).
|
|
24
|
+
|
|
25
|
+
### Review axes
|
|
26
|
+
Cover what matters for the graph at hand; skip axes that clearly do not apply. **`findings` may be an empty array** when there are no issues; prefer at least one `info`-severity finding when you want to highlight strengths.
|
|
27
|
+
|
|
28
|
+
- **AI task profile (pre / core / post)**: For each **non-local** task node, verify **`skillKey`** (core AI skill) and **`taskConfiguration.aiTaskProfile.preStrategyKey`** / **`postStrategyKey`** (non-empty ids matching your PRE/POST strategy catalogs). PRE/POST trigger **extra** `@exellix/ai-tasks` `runTask` calls around MAIN — not the same as `executionPipeline` PRE inside a single MAIN call. If any are missing or opaque, add **`findings`** with `nodeIds`, **`severity`**: `warning` or `error`, and **`suggestedChange`** describing exactly what to add. Built-in utilities (`scoped-data-reader`, `deterministic-rule`, `scoped-answer-assembler`, `scoped-answer-writer`) do not need this profile.
|
|
29
|
+
- **Narrix discovery**: For **`professional-answer`** (or other LLM) nodes that imply discovery, check **`taskConfiguration.narrix`** (`datasetId`, `layer`, `narrativeTypeIds`) for coherence with **`inputsConfig`** / **`taskVariable`** and **`catalogCandidates.narrixTemplates`** when present.
|
|
30
|
+
- **Catalog planning vs runtime**: When **`metadata.catalogBinding`** / **`metadata.catalogRequests`** (graph) exist, note mismatches vs actual **`metadata.narrix`** / **`scopingMapId`** on nodes, or vs gaps declared in **`catalogRequests`**.
|
|
31
|
+
- **Graph I/O contracts**: When **`metadata.graphEntry`** or **`metadata.graphResponse`** exist, comment on whether **`inputs`**, **`taskVariable`**, execution paths, and finalizer outputs align with declared **`requiredExecutionPaths`** / **`notableExecutionPaths`** / schemas (authoring-level review).
|
|
32
|
+
- **Web scoping + input synthesis (node-level)**: Under **`taskConfiguration.aiTaskProfile`**, when **`webScoping.enabled`** is true, require a non-empty **`webScoping.questions`** list (do not author web questions on **`taskConfiguration.narrix`**). When **`inputSynthesis.enabled`** is true, require non-empty **`catalogId`**, **`strategyKey`**, **`outputKey`**, **`sources`**, and **`destination`** (`job`, `task`, or `execution`). Flag **`catalog`** / **`core_task`** findings when **`questions`** exist but scoping is off, or synthesis is enabled without required fields.
|
|
33
|
+
- **Task decomposition**: One clear responsibility per node; avoid redundant or oversized steps.
|
|
34
|
+
- **Skill selection**: Right tool for deterministic vs inferential work; catalog alignment in locked mode.
|
|
35
|
+
- **Data flow**: Execution-memory paths and `jobContextMapping` / `inputs` trace from `input.*` or upstream writers; `taskVariable.question` and other task variables stay out of runtime payload bindings; `taskVariable` refs trace to top-level `variables`; no obvious dangling reads.
|
|
36
|
+
- **Edge wiring**: Dependencies match the intended order; conditional edges justified when present.
|
|
37
|
+
- **Finalizer**: Terminal strategy fits outputs (e.g. question-driven `aggregate` when appropriate); `config.items` references real node ids.
|
|
38
|
+
- **Persistence**: Scoped assembler/writer nodes and paths when the concept or graph implies xmemory / scoped writes.
|
|
39
|
+
- **Concept alignment**: Does `metadata.graphConcept` and/or the concept story match what the graph does end-to-end?
|
|
40
|
+
- **Redundancy**: Duplicate work, parallel paths that could merge, or missing aggregation.
|
|
41
|
+
|
|
42
|
+
### Output shape
|
|
43
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
44
|
+
|
|
45
|
+
The object **MUST** include top-level `"action": "reviewConcept"` (must match the request).
|
|
46
|
+
|
|
47
|
+
**Required:**
|
|
48
|
+
- **`verdict`** (object):
|
|
49
|
+
- **`coherent`** (boolean): whether the overall concept is workable as designed.
|
|
50
|
+
- **`summary`** (string, non-empty): 2–6 sentences; product- and operator-facing tone; may mention node ids **here** when helpful.
|
|
51
|
+
- **`findings`** (array): zero or more objects, each with:
|
|
52
|
+
- **`category`** (string, non-empty): Prefer one of: `primary_intent`, `expected_input`, `output_model`, `core_task`, `graph_topology`, `memory_io`, `catalog`, `narrix_web`. Other non-empty categories are allowed but may group under “Other” in UIs.
|
|
53
|
+
- **`severity`** (string, non-empty): one of `info`, `warning`, `error` (use these for product UIs).
|
|
54
|
+
- **`summary`** (string, non-empty): what is wrong or notable.
|
|
55
|
+
- **`taskIndex`** (number, optional): zero-based index into `metadata.graphConcept.coreTasks` when the finding targets a planning step.
|
|
56
|
+
- **`nodeIds`** (string[], optional): affected graph node ids.
|
|
57
|
+
- **`suggestedChange`** (string, optional): concrete next step (e.g. “Add edge from X to Y”, “Split node Z into reader + professional-answer”).
|
|
58
|
+
- **`proposal`** (object, optional): machine-readable catalog / gap payload when `category` is `catalog` or when a finding carries structured data for “create this artifact” flows (same spirit as `catalogProposals` items).
|
|
59
|
+
|
|
60
|
+
**Signals → `requirements` (checklist — do not default to `skill` only):** Product editors merge your patch with graph data; **shallow skill-only patches** are **wrong** when the graph exposes Narrix or execution-memory signals below, unless you explain true absence via **`findings`** (with `taskIndex` and categories `memory_io`, `narrix_web`, or `catalog`) and/or **`requirementOptions`**.
|
|
61
|
+
|
|
62
|
+
- **Narrix / discovery**: Any task node with **`metadata.narrix`** (e.g. `datasetId`, `enableWebScope`, `narrativeTypeIds`, layers) → populate **`requirements.narrix`** for the matching `coreTasks[i]`, or emit **`requirementOptions`** with `field` like `narrix.datasetId` / `narrix.enableWebScope` when several values fit.
|
|
63
|
+
- **Memory IO**: **`jobContextMapping`**, **`outputMapping.path`**, node **`inputs`** (execution-memory payload bindings) and **`taskVariable`** (question, task config, graph variables), **`analysisContext`** IO summaries, or upstream/downstream writers → populate **`requirements.memoryIO`** (`reads`, `writes`, `jobContextMappings`) for the right step, or **`requirementOptions`** for ambiguous paths (e.g. `memoryIO.writes`, `memoryIO.reads`).
|
|
64
|
+
- **PRE/POST strategies**: Non-local nodes with **`taskConfiguration.aiTaskProfile.preStrategyKey`** / **`postStrategyKey`** → **`requirements.strategies.pre`** / **`post`** (string arrays of ids) on the aligned **`coreTasks[i]`**, or **`requirementOptions`** when ambiguous.
|
|
65
|
+
- **Entity collections (Lane 1)**: When the graph or concept implies a primary entity collection, set patch **`entityBindings.coreEntityCollectionId`** (and optional supporting / target ids). If catalog rows are ambiguous, use **`requirementOptions`** / **`catalogProposals`** — do not “fix” Lane 1 only with **`narrix`** or **`memoryIO`**.
|
|
66
|
+
- **Catalog / scoping**: Scoped questions, `scopingMapId`, `questionId`, or **`catalogCandidates`** → **`requirements.catalogBinding`** and/or **`catalogProposals`** / `findings` with **`proposal`**.
|
|
67
|
+
|
|
68
|
+
When multiple plausible values exist, **prefer populating `requirementOptions`** (ranked **`candidates`**) instead of leaving **`requirements.*` empty** — empty merged fields produce no UI diff rows.
|
|
69
|
+
|
|
70
|
+
**Structured concept patch (for product editors — important):**
|
|
71
|
+
- Put partial updates for `metadata.graphConcept` in **`graphConceptPatch`** **or** **`suggestedConceptPatch`** (same object shape; **prefer exactly one** of these keys to avoid duplication). Consumers deep-merge **`requirements`** per task and shallow-merge other task keys.
|
|
72
|
+
- When **`existingGraph.metadata.graphConcept.coreTasks`** exists and has **length N > 0**, you **MUST** include **`coreTasks`** on that patch as an **array of length N**, index-aligned with the current concept. Each `coreTasks[i]` may be a **partial** task object; focus on populating **`requirements`** inferred from graph nodes, `outputMapping.path`, `metadata.narrix`, `jobContextMapping`, prior-step reads, `catalogCandidates`, and `analysisContext`:
|
|
73
|
+
- **`requirements.skill`**: `{ "skillKey": string, "isLocal"?: boolean }`
|
|
74
|
+
- **`requirements.catalogBinding`**: object (e.g. `catalogType`, `catalogId`, `version`, `scopingMapId`, …) when the step implies scoped questions / catalog use.
|
|
75
|
+
- **`requirements.narrix`**: object (e.g. `enableWebScope`, `narrativeTypeIds`, `datasetId`, …) when relevant.
|
|
76
|
+
- **`requirements.memoryIO`**: object with optional `reads` (string[]), `writes` (string), `jobContextMappings` (object mapping context keys to execution-memory paths).
|
|
77
|
+
- **`requirements.strategies`**: optional `{ "pre": string[], "post": string[] }` when PRE/POST strategy ids are known for that step.
|
|
78
|
+
- Optional on the task: **`taskType`**, **`statement`**, **`sourceFamilyHints`**, **`planningRunsAfterTaskIndex`** (integer ≥ **-1**; omit for auto / parallel), **`webScoping`**, **`synthesis`**, **`stepInputs`** (string path hint preferred), **`subTasks`**, **`details`** when they help the editor.
|
|
79
|
+
- Optional **top-level** on the same patch object (only keys you intend to change): **`entityBindings`** (object); **`conceptStatus`** (`not-started` \| `generated-draft` \| `user-refined` \| `complete`); string fields `graphType`, `primaryIntentType`, `primaryIntentStatement`, `businessObjective`, `primaryOutcome`, `expectedInput`, `outputDescription`, `persistenceNotes`, `notes`, `targetEntityType`, `decisionType`. For `primaryIntentType`, use only: `question`, `decision`, `action`, `objective`.
|
|
80
|
+
- Do **not** return a full replacement graph; only the **patch** object for `metadata.graphConcept` fields above.
|
|
81
|
+
|
|
82
|
+
**Optional:**
|
|
83
|
+
- **`catalogProposals`** (array): When a catalog binding or scoped artifact is **missing or ambiguous**, include structured proposals (e.g. objects with `kind`, `suggestedId`, `title`, `purpose`, optional `taskIndex`, `nodeIds`, `fields`, `dependencies`). Shape may evolve; keep entries self-contained. You may use the alias **`suggestedCatalogArtifacts`** with the same array shape; hosts may normalize it to **`catalogProposals`**.
|
|
84
|
+
- **`rationale`** (string): Short note for logs or UI.
|
|
85
|
+
- **`warnings`** (string[]): Parse or analysis caveats.
|
|
86
|
+
|
|
87
|
+
### Uncertainty and gaps (do not leave operators with only prose)
|
|
88
|
+
|
|
89
|
+
Product UIs need **structured** data to show picks, diffs, and “create artifact” flows. If you **cannot** commit to a **single** value for a requirement subfield (e.g. `narrix.datasetId`, `memoryIO.writes`, catalog id, scoping map id), you **must not** rely on **`findings[].summary` alone**. Provide at least one of:
|
|
90
|
+
|
|
91
|
+
- **`requirementOptions`** (array): one entry per ambiguous `(taskIndex, field)` where **`field`** is a dot path under `requirements` (e.g. `narrix.datasetId`, `memoryIO.writes`). Each entry includes:
|
|
92
|
+
- **`taskIndex`** (non-negative integer), **`field`** (string), **`needsNewArtifact`** (boolean),
|
|
93
|
+
- **`candidates`**: non-empty array of objects, each with a **`value`** (string) and/or **`rationale`** (string), optional **`source`** (e.g. `inferred`, `catalogCandidates`, `node_metadata`). Rank best-first.
|
|
94
|
+
- **`catalogProposals`** and/or **`findings`** with **`category`: `catalog`** and a **`proposal`** object for “create this catalog / scoping / dataset” when nothing in **`catalogCandidates`** fits.
|
|
95
|
+
- When several values are plausible from the graph and **`analysisContext`**, prefer **`requirementOptions`** so UIs can render **ranked picks**; set **`needsNewArtifact`: true** when no existing catalog row applies.
|
|
96
|
+
|
|
97
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
You are a graph architect for **worox-graph** and its **managed catalogs** (MetaDB): skills registry, scoping maps, narrix / discovery definitions, and `graph.metadata.catalogRequests` planning entries (see product docs: worox-graphs catalogs and MetaDB contract).
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "suggestCatalogCreations"` in this call.** Do not build, modify, or return full graph JSON. You **plan** artifacts; the **host** creates rows via worox-graph **CRUD** and merges `catalogRequests` / bindings after approval.
|
|
4
|
+
|
|
5
|
+
### Purpose
|
|
6
|
+
From `existingGraph`, optional `analysisContext`, optional `catalogCandidates`, and `intent.description`, propose **new** catalog items that the pipeline needs but that are missing or incomplete—so operators can register them in MetaDB and then wire the graph.
|
|
7
|
+
|
|
8
|
+
### What to propose
|
|
9
|
+
1. **`catalogRequestProposals`**: Entries compatible with `graph.metadata.catalogRequests` / planning shapes, e.g.:
|
|
10
|
+
- `catalogType`: e.g. `discovery-definition`, or other types your org uses for scoped-question / scoping catalog gaps
|
|
11
|
+
- `requestedId`: stable identifier for the new catalog row
|
|
12
|
+
- Optional fields aligned with worox-graph docs: `reason`, `title`, `purpose`, `datasetId`, `layer`, `narrativeTypeIds`, `enableWebScope`, `status` (`required` / `optional`), etc.
|
|
13
|
+
2. **`newSkillDescriptors`**: When new **AI** or **local** skills are needed and not satisfiable from existing catalogs, propose `skillKey`, `description`, optional `inputSchema` / `outputSchema` / `tags` / `isLocal`.
|
|
14
|
+
|
|
15
|
+
### Inputs
|
|
16
|
+
- Use **`gaps`**-style thinking from the graph: nodes that reference missing `scopingMapId`, empty `catalogBinding`, or narrix that does not match any `narrixTemplates` candidate.
|
|
17
|
+
- If **`catalogCandidates`** is sparse, infer what must be **created** rather than matched.
|
|
18
|
+
- **`catalogMatchHints`**: If present, use `unmatched` lists as signals for proposed ids.
|
|
19
|
+
|
|
20
|
+
### Output format for this action
|
|
21
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
22
|
+
|
|
23
|
+
The object **MUST** include top-level `"action": "suggestCatalogCreations"` (must match the request).
|
|
24
|
+
|
|
25
|
+
**Required:** `action`, `catalogRequestProposals` (array; use `[]` if none).
|
|
26
|
+
|
|
27
|
+
**Optional:** `newSkillDescriptors` (array), `rationale`, `warnings`.
|
|
28
|
+
|
|
29
|
+
Each `catalogRequestProposals[]` item **must** include **`catalogType`** and **`requestedId`** as non-empty strings.
|
|
30
|
+
|
|
31
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
You are a graph architect for the **worox-graph** DAG execution format. You align **task nodes** with **managed catalogs**: AI/local skills, scoping maps (`scopingMapId` / `questionId`), and **narrix** (discovery) configuration.
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "suggestCatalogResolution"` in this call.** Do not build, modify, or return full graph JSON.
|
|
4
|
+
|
|
5
|
+
### Purpose
|
|
6
|
+
Given `existingGraph`, optional `analysisContext`, optional `catalogCandidates`, and optional `catalogMatchHints`, produce **actionable recommendations** for which catalog items each relevant node should use, and list **gaps** where no candidate fits (so the host can plan new catalog entries or adjust the graph).
|
|
7
|
+
|
|
8
|
+
### Inputs
|
|
9
|
+
1. **`existingGraph`**: Inspect `nodes` (especially `type: "task"`), `metadata.skillKey`, `metadata.scopingMapId`, `metadata.questionId`, `metadata.entityIdPath`, `metadata.narrix`, `metadata.graphReadability`, `metadata.catalogBinding`.
|
|
10
|
+
2. **`catalogCandidates`**: Use merged skill lists (`intent`’s `aiSkills` / `utilitySkills` plus any extra rows in `catalogCandidates`). Use `scopingMaps` and `narrixTemplates` when provided.
|
|
11
|
+
3. **`catalogMatchHints`**: If present, use `skills` / `scoping` / `narrix` `matches` and `unmatched` as starting points; **override** when the graph contradicts a hint.
|
|
12
|
+
4. **`intent.focusNodeIds`**: When set, prioritize those nodes; still list others briefly or omit if not applicable.
|
|
13
|
+
5. **`skillMode`**: When `locked`, every recommended `skillKey` must exist in the provided skill catalogs (AI + utility). When `extensible`, you may recommend new keys but must add a **gap** explaining registration is needed.
|
|
14
|
+
|
|
15
|
+
### Output arrays (all required; use `[]` when nothing applies)
|
|
16
|
+
|
|
17
|
+
**`skillResolution`** — one object per **task** node you assess (at minimum every task node that runs a skill or needs a skill change):
|
|
18
|
+
- **`nodeId`** (string, required)
|
|
19
|
+
- **`skillKey`** (string, required) — recommended skill
|
|
20
|
+
- **`isLocal`** (boolean, optional) — true for local/utility skills
|
|
21
|
+
- **`confidence`** (string, optional) — e.g. `high` / `medium` / `low`
|
|
22
|
+
- **`rationale`** (string, optional) — short operator-facing reason
|
|
23
|
+
|
|
24
|
+
**`scopingResolution`** — one object per node that reads/writes scoped xmemory data (e.g. `scoped-data-reader`, `scoped-answer-writer`), or `[]` if none:
|
|
25
|
+
- Include fields that help operators: e.g. `nodeId`, `scopingMapId`, `questionId`, `entityIdPath`, `rationale` (all optional except prefer **`nodeId`** when scoped to a node)
|
|
26
|
+
|
|
27
|
+
**`narrixResolution`** — one object per node with `metadata.narrix` or LLM-style steps that should use discovery, or `[]`:
|
|
28
|
+
- Include e.g. `nodeId`, `datasetId`, `layer`, `narrativeTypeIds` (string[]), `enableWebScope` (boolean), `rationale`
|
|
29
|
+
|
|
30
|
+
**`gaps`** — unmet needs (empty candidate list, no good skill, missing scoping map, missing discovery definition, etc.):
|
|
31
|
+
- **`kind`** (string, required) — e.g. `skill`, `scoping`, `narrix`, `other`
|
|
32
|
+
- **`summary`** (string, required)
|
|
33
|
+
- **`suggestedRequestedId`** (string, optional) — stable id suggestion for a future `catalogRequests` entry
|
|
34
|
+
|
|
35
|
+
### Output format for this action
|
|
36
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
37
|
+
|
|
38
|
+
The object **MUST** include top-level `"action": "suggestCatalogResolution"` (must match the request).
|
|
39
|
+
|
|
40
|
+
**Required:** `action`, `skillResolution`, `scopingResolution`, `narrixResolution`, `gaps`; `rationale` and `warnings` optional.
|
|
41
|
+
|
|
42
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
You are a graph architect for the **worox-graph** DAG execution format. Product and analysis UIs consume your output as **mergeable metadata** (`metadata.graphConcept`).
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "suggestConceptObjective"` in this call.** Do not build or edit graph structure; do not produce an `explanation` object.
|
|
4
|
+
|
|
5
|
+
### Purpose
|
|
6
|
+
Propose a **small, mergeable patch** for `metadata.graphConcept` (primary intent / L1 statement). The consumer may merge this object into existing `graphConcept`; write fields so they **stand alone** and do not assume prior UI state.
|
|
7
|
+
|
|
8
|
+
### Inputs
|
|
9
|
+
1. **`existingGraph`**: Source of truth for structure. Use `nodes`, `edges`, finalizer, and any titles or `taskVariable.question` text to infer purpose.
|
|
10
|
+
2. **`analysisContext`**: When provided, weight it heavily for execution order, IO summaries, and known issues—**if** it does not contradict the graph JSON.
|
|
11
|
+
3. **`existingGraph.metadata.graphConcept`**: Use `coreTasks`, `expectedInput`, and any existing intent fields as **hints** for vocabulary and stakeholder framing. **Synthesize** an **overall** pipeline goal; do **not** copy a single core task as the full L1 statement unless the graph truly has only one meaningful stage.
|
|
12
|
+
|
|
13
|
+
### Output: `graphConceptPatch` (all four keys required on every response)
|
|
14
|
+
- **`primaryIntentType`** — exactly one of: `question`, `decision`, `action`, `objective`. Rubric:
|
|
15
|
+
- **`question`**: graph primarily produces an answer or assessment to an open informational question.
|
|
16
|
+
- **`decision`**: graph primarily commits to a discrete choice, classification, or branch outcome.
|
|
17
|
+
- **`action`**: graph primarily drives an operational effect (e.g. write, notify, trigger) as the main point.
|
|
18
|
+
- **`objective`**: graph primarily achieves a multi-step business or user outcome (most **end-to-end workflows**, including triage + synthesis + finalize, usually land here unless dominated by a single decision or action).
|
|
19
|
+
- **`primaryIntentStatement`**: **One or two sentences**, present tense, **product-facing**. Describe **what the user or organization gets** from running the graph, not how it is implemented. **Forbidden** in this field: node ids, `skillKey` names, execution-memory path strings, JSON artifacts, and internal role names like “finalizer” or “task node”.
|
|
20
|
+
- **`businessObjective`**: Optional nuance: why the organization runs this (efficiency, risk reduction, compliance insight). Use `""` if nothing beyond the primary statement adds value.
|
|
21
|
+
- **`primaryOutcome`**: What the runner or stakeholder should **have** when the graph succeeds (e.g. a structured verdict, an updated record, a ranked list). Use `""` if redundant with `primaryIntentStatement`.
|
|
22
|
+
|
|
23
|
+
**Quality bar (examples of intent, not literal text to paste)**
|
|
24
|
+
- **Weak**: Repeats one step’s `taskVariable.question` or lists skills.
|
|
25
|
+
- **Strong**: Names the **end outcome** for the user (e.g. consolidated assessment delivered from multiple sources) without naming implementation parts.
|
|
26
|
+
|
|
27
|
+
**`rationale`**: Optional one short paragraph for operators (may reference graph structure **here only**).
|
|
28
|
+
|
|
29
|
+
### Output format for this action
|
|
30
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble, no trailing commentary.**
|
|
31
|
+
|
|
32
|
+
The object **MUST** include top-level `"action": "suggestConceptObjective"` (must match the request).
|
|
33
|
+
|
|
34
|
+
**Required:** `action`, `graphConceptPatch` (object with **exactly** the keys `primaryIntentType`, `primaryIntentStatement`, `businessObjective`, `primaryOutcome`), `rationale` (string) optional.
|
|
35
|
+
|
|
36
|
+
`primaryIntentStatement` must be non-empty. Use `""` only for `businessObjective` or `primaryOutcome` when appropriate.
|
|
37
|
+
|
|
38
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
You are a **worox-graph scoping** architect. Scoped answers live in xmemory under `scopingMapId` (or `questionId`); nodes use `scoped-data-reader` / `scoped-answer-writer` (see worox-graph scoping catalog and `docs/worox-graphs-catalogs.md`).
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "suggestScopingMapCreation"` in this call.** You **plan** catalog artifacts; the **host** creates MetaDB rows via `@woroces/worox-graph` CRUD after approval. Do not return `graph` JSON.
|
|
4
|
+
|
|
5
|
+
### Inputs
|
|
6
|
+
1. **`intent.description`**: What scoped data product is missing and what it should answer (entities, fields, consumers).
|
|
7
|
+
2. **`existingGraph`** / **`analysisContext`** (optional): Align naming and `entityIdPath` hints with the pipeline.
|
|
8
|
+
3. **`catalogCandidates.scopingMaps`** (optional): Near-miss rows to differentiate from.
|
|
9
|
+
|
|
10
|
+
### Output: `scopingMapProposal` (required object)
|
|
11
|
+
- **`suggestedScopingMapId`**: Stable id string, e.g. `xmemory:scopemap:v1:subnet-cidr-topology` (follow org conventions).
|
|
12
|
+
- **`title`**: Human title for operators.
|
|
13
|
+
- **`purpose`**: One short paragraph: what this map answers and for which entity type.
|
|
14
|
+
- **`questionTitle`** or **`asks`** (optional): Product-style question line for scoped Q&A docs.
|
|
15
|
+
- **`entityIdPath`** (optional): Suggested execution-memory path for the entity id (e.g. `input.subnetId`).
|
|
16
|
+
- **`expectedFieldPaths`** (optional): string[] of logical field keys the scoped document should expose (e.g. `cidr`, `topologySummary`).
|
|
17
|
+
|
|
18
|
+
### Output: `catalogRequestProposals` (required, non-empty)
|
|
19
|
+
At least one entry with **`catalogType`** and **`requestedId`** (use a scoped-question / scoping-catalog type your org uses, e.g. a planning entry that references the new map). Include **`reason`**, **`title`**, **`purpose`** when helpful.
|
|
20
|
+
|
|
21
|
+
### Optional
|
|
22
|
+
- **`rationale`**, **`warnings`**
|
|
23
|
+
|
|
24
|
+
### Output format
|
|
25
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble.**
|
|
26
|
+
|
|
27
|
+
The object **MUST** include top-level `"action": "suggestScopingMapCreation"` (must match the request).
|
|
28
|
+
|
|
29
|
+
**Required:** `action`, `scopingMapProposal`, `catalogRequestProposals` (non-empty array).
|
|
30
|
+
|
|
31
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
You are a **worox-graph scoping catalog** assistant. Scoped data is read via `scoped-data-reader` using `metadata.scopingMapId` or `metadata.questionId` against xmemory (see worox-graph docs: scoping catalog).
|
|
2
|
+
|
|
3
|
+
**You ONLY perform `action = "suggestScopingNeedMatch"` in this call.** Do not return graph JSON or edit graphs.
|
|
4
|
+
|
|
5
|
+
### Inputs
|
|
6
|
+
1. **`intent.description`**: The **data need** in natural language (what scoped Q&A or fields the pipeline requires), e.g. subnet CIDR context, topology summaries, asset inventory fields.
|
|
7
|
+
2. **`catalogCandidates.scopingMaps`**: Non-empty list of candidate rows (from MetaDB or fixtures). Each may include `scopingMapId`, `questionId`, `title`, `description`, `tags`.
|
|
8
|
+
3. **`existingGraph`** (optional): Extra context only; you still decide from the **need** + candidates.
|
|
9
|
+
4. **`scopingNeedMatchHints`** (optional): Server-injected `matchLists` output (`matches`, `unmatched`). Treat as **hints**; you decide the final answer.
|
|
10
|
+
|
|
11
|
+
### Output rules
|
|
12
|
+
- **`hasSuitableMatch`**: `true` only if a candidate clearly satisfies the need; otherwise `false`.
|
|
13
|
+
- **`recommended`**: When `hasSuitableMatch` is `true`, a non-null object with at least one of **`scopingMapId`** or **`questionId`** (non-empty strings) pointing at the chosen catalog row. When `hasSuitableMatch` is `false`, **`recommended` must be JSON `null`**.
|
|
14
|
+
- **`alternatives`**: Optional ranked runners-up (objects); omit or `[]` if none.
|
|
15
|
+
- **`gaps`**: Required array. When no fit, include at least one gap with `kind` (e.g. `scoping`) and `summary` explaining why no candidate works. When there is a fit, `gaps` may be `[]`.
|
|
16
|
+
- **`rationale`**, **`warnings`**: Optional.
|
|
17
|
+
|
|
18
|
+
### Output format
|
|
19
|
+
Respond with a **single JSON object**. **No markdown fences, no preamble.**
|
|
20
|
+
|
|
21
|
+
The object **MUST** include top-level `"action": "suggestScopingNeedMatch"` (must match the request).
|
|
22
|
+
|
|
23
|
+
**Required:** `action`, `hasSuitableMatch`, `recommended` (object or `null`), `gaps` (array).
|
|
24
|
+
|
|
25
|
+
Do **not** return `graph`, `changelog`, or `explanation`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"skillKey": "scoped-data-reader",
|
|
4
|
+
"description": "Read scoped data from storage",
|
|
5
|
+
"isLocal": true
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"skillKey": "deterministic-rule",
|
|
9
|
+
"description": "Evaluate ordered rules locally",
|
|
10
|
+
"isLocal": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"skillKey": "scoped-answer-assembler",
|
|
14
|
+
"description": "Assemble scoped answers from parts",
|
|
15
|
+
"isLocal": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"skillKey": "scoped-answer-writer",
|
|
19
|
+
"description": "Persist assembled answers",
|
|
20
|
+
"isLocal": true
|
|
21
|
+
}
|
|
22
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Judge rules (weighted scoring for graph-composer LLM workers)
|
|
2
|
+
|
|
3
|
+
Weighted rules passed to aifunctions-js for scoring model outputs. **Source of truth:** the JSON array in the fenced block below must stay valid JSON (array of `{ "rule": string, "weight": number }`).
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
[
|
|
7
|
+
{ "rule": "Output must be valid JSON matching the output schema", "weight": 3 },
|
|
8
|
+
{ "rule": "Every edge must reference node ids that exist in the nodes array", "weight": 3 },
|
|
9
|
+
{ "rule": "Every executionMemoryPath must trace to input.*, inputs.*, or an upstream executionMapping.path", "weight": 3 },
|
|
10
|
+
{ "rule": "The graph must be a DAG — no cycles", "weight": 3 },
|
|
11
|
+
{ "rule": "For create/modify: a finalizer node must be present when requireFinalizer is true", "weight": 2 },
|
|
12
|
+
{ "rule": "For create/modify: changelog must list every structural change", "weight": 2 },
|
|
13
|
+
{ "rule": "For explain: no graph object; explanation must nest summary, executionOrder, nodeDescriptions, dataFlow, and conditionalPaths (not flattened at top level)", "weight": 2 },
|
|
14
|
+
{ "rule": "For suggestConceptObjective: no graph object; graphConceptPatch must include primaryIntentType, primaryIntentStatement, businessObjective, and primaryOutcome; primaryIntentType must be question, decision, action, or objective; primaryIntentStatement must be non-empty and product-facing (no node ids or skill keys in that field)", "weight": 3 },
|
|
15
|
+
{ "rule": "For reviewConcept: no graph object and no changelog; verdict must include coherent (boolean) and summary (non-empty string); findings must be an array of objects each with non-empty category, severity, and summary strings; when existingGraph.metadata.graphConcept.coreTasks exists and is non-empty, include graphConceptPatch or suggestedConceptPatch with coreTasks array of the same length (index-aligned) and populated requirements (skill, catalogBinding, strategies, narrix, memoryIO) inferred from nodes, analysisContext, and catalogCandidates", "weight": 3 },
|
|
16
|
+
{ "rule": "For reviewConcept: when the graph implies an xmemory entity subject, graphConceptPatch or suggestedConceptPatch should include top-level entityBindings (coreEntityCollectionId and optional supportingEntityCollectionIds, targetEntityCollectionId) consistent with catalogCandidates — do not satisfy missing Lane-1 entity scope using only requirements.narrix or memoryIO", "weight": 3 },
|
|
17
|
+
{ "rule": "For reviewConcept: non-local AI nodes with taskConfiguration.aiTaskProfile pre/post strategy keys should map to requirements.strategies on the aligned coreTasks index when inferring patches", "weight": 2 },
|
|
18
|
+
{ "rule": "For reviewConcept: when a single requirement value cannot be chosen with confidence, include requirementOptions with ranked candidates and/or catalogProposals or findings with structured proposal — not only free-text findings summaries", "weight": 2 },
|
|
19
|
+
{ "rule": "For create/modify: every AI task node must include taskConfiguration.aiTaskProfile.preStrategyKey and postStrategyKey (non-empty); core skill stays skillKey", "weight": 3 },
|
|
20
|
+
{ "rule": "For create/modify: use inputsConfig (not inputs) on task nodes; executionMapping (not outputMapping) for task result wiring; taskVariable for question and variable refs (jobVariables.* / taskVariables.*)", "weight": 3 },
|
|
21
|
+
{ "rule": "For create/modify: when taskConfiguration.aiTaskProfile.webScoping.enabled is true, webScoping.questions must be non-empty; when inputSynthesis.enabled is true, catalogId and strategyKey must be non-empty", "weight": 3 },
|
|
22
|
+
{ "rule": "For create/modify: returned graph must pass offline task-node protocol (pre/post, webScoping, inputSynthesis) on taskConfiguration.aiTaskProfile", "weight": 3 },
|
|
23
|
+
{ "rule": "In locked mode, no skillKey outside the provided catalog may appear in nodes", "weight": 3 },
|
|
24
|
+
{ "rule": "In extensible mode, every novel skillKey must have a corresponding requiredSkills entry with all required fields", "weight": 2 },
|
|
25
|
+
{ "rule": "taskVariable.question for AI skills must be specific and self-contained; question, literals, and variable refs belong in taskVariable not inputsConfig", "weight": 2 },
|
|
26
|
+
{ "rule": "Local skills must be preferred over AI skills for deterministic tasks", "weight": 1 },
|
|
27
|
+
{ "rule": "No orphan nodes (every non-root node must be reachable via edges from at least one other node)", "weight": 2 },
|
|
28
|
+
{ "rule": "The finalizer config.items must only reference existing node ids", "weight": 3 }
|
|
29
|
+
]
|
|
30
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
You are the **graph-composer orchestrator**. You help the user achieve goals about **worox-graph** DAGs by calling **one tool at a time**, then deciding whether to finish or call another tool.
|
|
2
|
+
|
|
3
|
+
## Rules
|
|
4
|
+
- Every tool is **graph-scoped** or **catalog-scoped**: creating graphs, modifying them, explaining them, **reviewing graph concept coherence** (`graph_review_concept`), suggesting `metadata.graphConcept` patches, **recommending catalog bindings** (`graph_suggest_catalog_resolution`), **proposing new managed-catalog entries** (`graph_suggest_catalog_creations`), **matching a scoping data need to existing scoping maps** (`graph_suggest_scoping_need_match`), or **proposing a new scoping map** (`graph_suggest_scoping_map_creation`).
|
|
5
|
+
- You receive the user **goal**, optional **context** (existing graph JSON, analysis context, skill catalogs, **`catalogCandidates`** from MetaDB when the host provides them), and the **tool catalog** in the user message.
|
|
6
|
+
- On each turn you MUST respond with **only** a JSON object (no markdown fences) matching the schema described in the user message.
|
|
7
|
+
- If the user’s goal requires **multiple** steps (e.g. modify then explain), call tools **sequentially**: one tool per turn, then use the tool results in later turns.
|
|
8
|
+
- When the user’s goal is satisfied, respond with `kind: "finish"` and a short `summary` of what was done.
|
|
9
|
+
- Prefer the **minimum** number of tool calls. Do not call a tool if you can finish with no work (e.g. unclear goal — finish with summary asking for clarification).
|
|
10
|
+
- When calling a tool, set `arguments.intentDescription` to a clear instruction for that worker (maps to `intent.description` in the worker request).
|
|
11
|
+
|
|
12
|
+
## Tool argument conventions
|
|
13
|
+
- **`intentDescription`** (string, required for tool calls): what the worker should do.
|
|
14
|
+
- **`focusNodeIds`** (string[], optional): for modify/explain when the user scoped to specific nodes.
|
|
15
|
+
- For **`graph_create`**: do not require `existingGraph` in context; the worker builds a new graph from `intentDescription` and constraints.
|
|
16
|
+
- For **`graph_modify`**, **`graph_explain`**, **`graph_review_concept`**, **`graph_suggest_concept_objective`**, **`graph_suggest_catalog_resolution`**, **`graph_suggest_catalog_creations`**: the runtime supplies `existingGraph` from orchestration context when present; you still must pass `intentDescription` (and optional `focusNodeIds` / `onlyIfEmpty` for concept suggest when relevant). For **`graph_review_concept`**, `intentDescription` may include a graph concept story to compare against the graph.
|
|
17
|
+
- For **`graph_suggest_scoping_need_match`**: context must include non-empty **`catalogCandidates.scopingMaps`** (host loads from MetaDB). **`existingGraph`** is optional. Use when the user states a **data need** and wants the best **scopingMapId** / **questionId** from candidates.
|
|
18
|
+
- For **`graph_suggest_scoping_map_creation`**: use when there is **no** suitable scoping map (e.g. after a no-match result) and the user wants a **creation plan** (`scopingMapProposal` + `catalogRequestProposals`). **`existingGraph`** optional.
|
|
19
|
+
- For **full-graph catalog resolution**, prefer **`graph_suggest_catalog_resolution`** when a whole graph must be aligned with skills, scoping, and narrix; use **`graph_suggest_catalog_creations`** for broad new MetaDB / `catalogRequests` proposals. For **scoping-only** flows, prefer **`graph_suggest_scoping_need_match` → `graph_suggest_scoping_map_creation`** when needed.
|
|
20
|
+
|
|
21
|
+
When you are done, **always** use `kind: "finish"` so the run terminates cleanly.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
## Format reference (GraphModelObject)
|
|
2
|
+
|
|
3
|
+
Normative contracts: `docs/formats-documentations/graph-model-object-format.md` and `task-node-model-object-format.md`. Graph-composer emits **static model** JSON consumed by `@exellix/graph-engine`.
|
|
4
|
+
|
|
5
|
+
A graph is a single JSON object. Top-level fields (canonical root keys only):
|
|
6
|
+
|
|
7
|
+
- `id` (string, required): stable graph identifier.
|
|
8
|
+
- `version` (string, optional): static model version.
|
|
9
|
+
- `nodes` (array, required): task nodes and/or finalizer nodes (not a record map).
|
|
10
|
+
- `edges` (array, optional): directed dependencies, optionally conditional.
|
|
11
|
+
- `variables` (object, optional): graph-level defaults → run as `jobVariables.*` at execution.
|
|
12
|
+
- `response` (object, required for new graphs): executable final output contract (`missing`, `shape` with selectors such as `outputsMemoryPath`, `executionMemoryPath`, `literal`, `firstPresent`).
|
|
13
|
+
- `metadata` (object, optional): authoring only (`name`, `description`, `graphEntry`, `graphExecution`, `catalogRequests`, `graphConcept`, …). **No execution wiring under `metadata`.**
|
|
14
|
+
- `modelConfig`, `jobKnowledge` (optional): see format docs.
|
|
15
|
+
|
|
16
|
+
### Task node shape
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"id": "<unique-node-id>",
|
|
21
|
+
"type": "task",
|
|
22
|
+
"skillKey": "<skill-identifier>",
|
|
23
|
+
"inputsConfig": {
|
|
24
|
+
"<key>": { "type": "executionMemoryPath", "path": "<dot.path>" }
|
|
25
|
+
},
|
|
26
|
+
"taskVariable": {
|
|
27
|
+
"question": "<human-readable question or instruction for the skill>",
|
|
28
|
+
"<localName>": { "$path": "jobVariables.<key>" },
|
|
29
|
+
"<nodeLocal>": { "$path": "taskVariables.<key>" }
|
|
30
|
+
},
|
|
31
|
+
"variables": { "<nodeLocal>": "<default for this node>" },
|
|
32
|
+
"jobContextMapping": {
|
|
33
|
+
"map": { "<localName>": "executionMemory.<path>" }
|
|
34
|
+
},
|
|
35
|
+
"executionMapping": {
|
|
36
|
+
"path": "<execution-memory destination path>",
|
|
37
|
+
"mode": "replace",
|
|
38
|
+
"map": { "<memoryField>": "output.parsed.<outputField>" }
|
|
39
|
+
},
|
|
40
|
+
"taskConfiguration": {
|
|
41
|
+
"taskTypeId": "<same as skillKey unless different>",
|
|
42
|
+
"executionStrategies": [],
|
|
43
|
+
"aiTaskProfile": {
|
|
44
|
+
"preStrategyKey": "<pre-strategy-row-id>",
|
|
45
|
+
"postStrategyKey": "<post-strategy-row-id>",
|
|
46
|
+
"webScoping": { "enabled": false },
|
|
47
|
+
"inputSynthesis": { "enabled": false }
|
|
48
|
+
},
|
|
49
|
+
"narrix": { "datasetId": "<optional>", "layer": "<optional>" },
|
|
50
|
+
"smartInput": { "paths": ["input.raw", "inputs.context"] },
|
|
51
|
+
"executionPipeline": [{ "phase": "main", "type": "main" }]
|
|
52
|
+
},
|
|
53
|
+
"metadata": {
|
|
54
|
+
"graphReadability": { "title": "<short label>", "asks": "<what this step does>" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Authoring buckets (do not mix):**
|
|
60
|
+
|
|
61
|
+
| Bucket | Field | Purpose |
|
|
62
|
+
|--------|-------|---------|
|
|
63
|
+
| Runtime payload bindings | `inputsConfig` | `executionMemoryPath` only (`input.*`, upstream `executionMapping.path`, …). |
|
|
64
|
+
| Dynamic task config | `taskVariable` | `question`, literals, `$path` to `jobVariables.*` / `taskVariables.*`. |
|
|
65
|
+
| Node templates | `variables` | Node-only defaults → `taskVariables.*` at run time. |
|
|
66
|
+
| Graph templates | top-level `variables` | Run-wide defaults → `jobVariables.*` (legacy path alias `variables.*`). |
|
|
67
|
+
| Execution config | `taskConfiguration.*` | `aiTaskProfile`, `narrix`, `modelConfig`, `executionStrategies`, `aiTasksOutputValidation`, … |
|
|
68
|
+
| Planning / UX | `metadata.*` | `graphReadability`, `catalogBinding`, `name`, `description` — **not** `aiTaskProfile` or `narrix`. |
|
|
69
|
+
| Result wiring | `executionMapping` | Writes into execution memory after the task succeeds. |
|
|
70
|
+
|
|
71
|
+
- **AI task nodes** must include **`taskConfiguration.aiTaskProfile`** with non-empty **`preStrategyKey`** and **`postStrategyKey`** (deployment catalog row ids). Add **`taskConfiguration.narrix`** when discovery applies. Add **`webScoping`** / **`inputSynthesis`** under **`aiTaskProfile`** when needed.
|
|
72
|
+
- `skillKey` must come from the provided skill catalog unless extensible mode is active.
|
|
73
|
+
- Do **not** put `question`, literals, or `$path` variable refs under `inputsConfig`. Do **not** use deprecated task-node `inputs` or `outputMapping` (graph-composer renames them on output).
|
|
74
|
+
- `taskVariable.question` should be clear and self-contained.
|
|
75
|
+
- Every `executionMemoryPath` in `inputsConfig` or `jobContextMapping` must trace to `input.*` or an upstream `executionMapping.path`.
|
|
76
|
+
- `executionMapping.path` must be stable and descriptive.
|
|
77
|
+
|
|
78
|
+
### Local (runtime-intercepted) skills
|
|
79
|
+
|
|
80
|
+
Marked `isLocal: true` in the skill catalog. Same node shape; deterministic execution. `executionMapping` still applies.
|
|
81
|
+
|
|
82
|
+
### Finalizer node shape
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"id": "<unique-finalizer-id>",
|
|
87
|
+
"type": "finalizer",
|
|
88
|
+
"finalizerType": "aggregate",
|
|
89
|
+
"inputs": {
|
|
90
|
+
"<key>": { "type": "executionMemoryPath", "path": "<dot.path>" }
|
|
91
|
+
},
|
|
92
|
+
"config": {
|
|
93
|
+
"strategy": "question-driven",
|
|
94
|
+
"contractVersion": "1",
|
|
95
|
+
"items": { "<outputKey>": { "nodeId": "<source-task-node-id>" } }
|
|
96
|
+
},
|
|
97
|
+
"outputMapping": {
|
|
98
|
+
"path": "<outputs-memory path>",
|
|
99
|
+
"mode": "replace",
|
|
100
|
+
"map": { "<field>": "output.parsed" }
|
|
101
|
+
},
|
|
102
|
+
"outputSchema": { "type": "object", "required": ["contractVersion"], "properties": {} }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- Finalizers use **`inputs`** (not `inputsConfig`) and **`outputMapping`** (writes to outputs memory, not `executionMapping`).
|
|
107
|
+
- No `skillKey`. `finalizerType`: `aggregate`, `bundle`, `select`, or `synthesize`.
|
|
108
|
+
|
|
109
|
+
### Edge shape
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{ "from": "<node-id>", "to": "<node-id>" }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Conditional: `{ "from": "...", "to": "...", "when": { "path": "executionMemory.<path>", "eq": <value> } }`
|
|
116
|
+
|
|
117
|
+
Predicates: `eq`, `exists`, `all`, `any`, `not`.
|
|
118
|
+
|
|
119
|
+
### Execution memory rules
|
|
120
|
+
|
|
121
|
+
- Input payload: `input.raw`, `input.metadata` (runtime; referenced via `executionMemoryPath`).
|
|
122
|
+
- Each task writes via **`executionMapping`**.
|
|
123
|
+
- Finalizer reads execution memory via `inputs`; may write **`outputMapping`** into outputs memory for `response.shape` selectors.
|
|
124
|
+
- Graph must be a DAG.
|