@axiom-lattice/core 3.0.5 → 3.0.7
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/index.d.mts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +372 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +371 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1623,6 +1623,7 @@ __export(index_exports, {
|
|
|
1623
1623
|
ConsoleLoggerClient: () => ConsoleLoggerClient,
|
|
1624
1624
|
CustomMetricsClient: () => CustomMetricsClient,
|
|
1625
1625
|
CustomMiddlewareRegistry: () => CustomMiddlewareRegistry,
|
|
1626
|
+
DEFAULT_CALIBRATION_PROBES: () => DEFAULT_CALIBRATION_PROBES,
|
|
1626
1627
|
DaytonaInstance: () => DaytonaInstance,
|
|
1627
1628
|
DaytonaProvider: () => DaytonaProvider,
|
|
1628
1629
|
DefaultScheduleClient: () => DefaultScheduleClient,
|
|
@@ -12640,6 +12641,24 @@ cases, you MUST ask the user via ask_user_to_clarify \u2014 never proceed
|
|
|
12640
12641
|
with an assumed expectation. A test case written against a guessed
|
|
12641
12642
|
expectation validates the wrong thing. When in doubt, ask.
|
|
12642
12643
|
|
|
12644
|
+
## Knowledge in Skills (apply to EVERY sub-skill workflow)
|
|
12645
|
+
|
|
12646
|
+
**Domain knowledge lives in SKILL.md files, not in prompts.** The
|
|
12647
|
+
deliverable's knowledge (rules, formats, decision logic, procedures) is
|
|
12648
|
+
authored as skills; the executable (agent prompt, workflow step) stays
|
|
12649
|
+
THIN \u2014 role/process only, loading knowledge via "Load [[skill-name]]
|
|
12650
|
+
and follow it". Never write domain knowledge directly into a system
|
|
12651
|
+
prompt or a workflow step's prompt.
|
|
12652
|
+
|
|
12653
|
+
Why: knowledge in prompts cannot be reused, individually verified, or
|
|
12654
|
+
evolved. Knowledge in skills is shared (subSkills), regression-tested
|
|
12655
|
+
([[eval-verify]]), and improved without touching the executable.
|
|
12656
|
+
|
|
12657
|
+
Applies to every construction path: [[learn-capability]] (skills are
|
|
12658
|
+
the primary output), [[agent-build]] (agent prompt thin, loads skill),
|
|
12659
|
+
[[design-workflow]] (steps reference [[skill-name]] or ref to
|
|
12660
|
+
skill-loading agents). All three follow this single principle.
|
|
12661
|
+
|
|
12643
12662
|
## Goal-Driven Validation (apply to EVERY sub-skill workflow)
|
|
12644
12663
|
|
|
12645
12664
|
The agent evaluates goal achievement ITSELF via multi-dimensional test
|
|
@@ -12659,6 +12678,29 @@ green = goal achieved (per [[completion-gate]] and [[eval-verify]]).
|
|
|
12659
12678
|
The goal model is the acceptance standard \u2014 contentAssertion must
|
|
12660
12679
|
encode the usable state, not just technical correctness.
|
|
12661
12680
|
|
|
12681
|
+
## Undefined Tasks (outside the skill map)
|
|
12682
|
+
|
|
12683
|
+
If the request does not match any sub-skill workflow: do NOT guess, do
|
|
12684
|
+
NOT refuse, do NOT force-fit an existing flow. Follow the
|
|
12685
|
+
EXPLORE \u2192 PROPOSE \u2192 CONFIRM protocol:
|
|
12686
|
+
|
|
12687
|
+
1. **Explore** \u2014 inventory before proposing anything:
|
|
12688
|
+
\`list_agents\` / \`load_skills\` (existing assets), \`list_tools\` /
|
|
12689
|
+
\`list_middleware_types\` (capabilities), \`list_connections\`
|
|
12690
|
+
(data sources), eval projects (verification), docs at hand.
|
|
12691
|
+
Goal: know what is reusable and what is missing.
|
|
12692
|
+
2. **Propose** \u2014 present 2-3 concrete options, each with: what it
|
|
12693
|
+
does, cost, risk, and what it needs (new tools / new skills /
|
|
12694
|
+
approvals).
|
|
12695
|
+
3. **Confirm** \u2014 the user picks an option or adjusts it. Never
|
|
12696
|
+
execute without a chosen option.
|
|
12697
|
+
4. **New capability needed?** (new tool type, new skill, new
|
|
12698
|
+
connection) \u2014 include creating it ([[create-skill]] / connection
|
|
12699
|
+
setup) IN the proposed option; never silently proceed without it.
|
|
12700
|
+
5. **Boundary honesty** \u2014 state clearly what the architect cannot do
|
|
12701
|
+
(e.g. deploy to production, monitor runtime, change frontend),
|
|
12702
|
+
and give the alternative \u2014 never overpromise or silently refuse.
|
|
12703
|
+
|
|
12662
12704
|
## Skill Map
|
|
12663
12705
|
- [[learn-capability]] \u2014 Learn from any source material (user
|
|
12664
12706
|
description, documents, API specs, conversations, spreadsheets) and
|
|
@@ -12767,6 +12809,9 @@ Do NOT create tasks for:
|
|
|
12767
12809
|
**A task is a living record of the GOAL + ACCEPTANCE CRITERIA** \u2014 not a
|
|
12768
12810
|
todo label. Every task's description must carry:
|
|
12769
12811
|
|
|
12812
|
+
- **Goal Model** \u2014 the full goal model ([[agent-architecture|Goal
|
|
12813
|
+
Model]]): real goal, consumer (who uses the result), usable state
|
|
12814
|
+
(what "done and usable" means concretely)
|
|
12770
12815
|
- **Objective** \u2014 one measurable sentence: what result to achieve
|
|
12771
12816
|
- **Acceptance Criteria** \u2014 checkboxes that define "done": when ALL
|
|
12772
12817
|
are checked, the task is verifiably complete
|
|
@@ -12917,8 +12962,13 @@ When unsure, use \`show_widget\` for visual comparison.
|
|
|
12917
12962
|
- **Follow [[agent-architecture|Goal Model]]** \u2014 establish the goal
|
|
12918
12963
|
model (real goal / consumer / usable state) and design the agent to
|
|
12919
12964
|
achieve it; verification is goal-driven ([[agent-architecture|Goal-Driven Validation]]).
|
|
12920
|
-
- **
|
|
12921
|
-
|
|
12965
|
+
- **Follow [[agent-architecture|Knowledge in Skills]]** \u2014 the prompt is
|
|
12966
|
+
thin (role/behavior); domain knowledge lives in SKILL.md which the
|
|
12967
|
+
agent loads ("Load [[skill-name]] and follow it"). Never write
|
|
12968
|
+
domain knowledge directly into a system prompt.
|
|
12969
|
+
- **NEVER build before confirming.** Design \u2192 confirm via
|
|
12970
|
+
\`ask_user_to_clarify\` \u2192 wait for approval \u2192 only then build.
|
|
12971
|
+
No exceptions.
|
|
12922
12972
|
- **Track with tasks once scope is clear.** After requirements are
|
|
12923
12973
|
clarified, create the parent task ([[task-tracking]]) before starting
|
|
12924
12974
|
design. Don't create tasks during clarification.
|
|
@@ -12931,18 +12981,23 @@ When unsure, use \`show_widget\` for visual comparison.
|
|
|
12931
12981
|
|
|
12932
12982
|
## REACT design steps
|
|
12933
12983
|
|
|
12934
|
-
1.
|
|
12984
|
+
1. **Establish the goal model FIRST** \u2014 real goal / user expectation /
|
|
12985
|
+
consumer / usable state ([[agent-architecture|Goal Model]]); record
|
|
12986
|
+
it in the parent task. Design, build, and verification all derive
|
|
12987
|
+
from it. Only then:
|
|
12935
12988
|
2. Choose middleware \u2014 call \`list_tools\` and \`list_middleware_types\`
|
|
12936
12989
|
first. MUST include \`ask_user_to_clarify\` if the agent needs
|
|
12937
12990
|
confirmation or clarifying questions.
|
|
12938
12991
|
3. Write the system prompt: role \u2192 workflow \u2192 constraints
|
|
12939
12992
|
4. Present the design with \`show_widget\`
|
|
12940
|
-
5.
|
|
12993
|
+
5. Confirm via \`ask_user_to_clarify\` \u2014 do NOT build until approved
|
|
12941
12994
|
6. Build with \`create_agent\`
|
|
12942
12995
|
|
|
12943
12996
|
## DEEP_AGENT design steps
|
|
12944
12997
|
|
|
12945
|
-
1.
|
|
12998
|
+
1. **Establish the goal model FIRST** \u2014 real goal / consumer / usable
|
|
12999
|
+
state, recorded in the parent task ([[agent-architecture|Goal
|
|
13000
|
+
Model]]); then explain why DEEP_AGENT is the right choice
|
|
12946
13001
|
2. Capability mapping with \`show_widget\`
|
|
12947
13002
|
3. System prompt emphasizes dynamic todo workflow (analyze \u2192 break
|
|
12948
13003
|
into todos \u2192 work one at a time \u2192 refine). Middleware: code_eval,
|
|
@@ -13129,22 +13184,70 @@ subSkills:
|
|
|
13129
13184
|
(hold-out, never run during fix loop)
|
|
13130
13185
|
- 0.2 \u2460 \u2192 {skill}-api-verified \u2014 queryability assertion, single step
|
|
13131
13186
|
|
|
13132
|
-
## Layered verification (orchestrator +
|
|
13133
|
-
|
|
13134
|
-
When the design
|
|
13135
|
-
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13187
|
+
## Layered verification (orchestrator + components)
|
|
13188
|
+
|
|
13189
|
+
When the design delegates to other agents, verification is layered.
|
|
13190
|
+
"Orchestrator" = a parent deep_agent with subAgents (learn-capability
|
|
13191
|
+
Phase 2) OR a workflow with \`ref\` steps ([[design-workflow]]).
|
|
13192
|
+
"Components" = the subAgents / ref'd agents it calls. Order is MANDATORY:
|
|
13193
|
+
**component evals first, integration second** \u2014 never run the
|
|
13194
|
+
integration eval before every component eval passes.
|
|
13195
|
+
|
|
13196
|
+
- **Each component**: its OWN eval project (eval-{sub-agent-id} /
|
|
13197
|
+
eval-{ref-agent-id}) \u2014 the sub capability is verified independently,
|
|
13198
|
+
with its own fix loop.
|
|
13199
|
+
- **The orchestrator**: an integration eval project (eval-{parent-id} /
|
|
13200
|
+
eval-{workflow-id}). Integration cases: full end-to-end task input \u2192
|
|
13201
|
+
orchestrator invokes components \u2192 final aggregated output \u2192
|
|
13202
|
+
contentAssertion on the final result. This verifies ORCHESTRATION
|
|
13203
|
+
(does the orchestrator call the right components in the right order
|
|
13204
|
+
and aggregate correctly).
|
|
13205
|
+
- **Workflow integration cases** also include branch paths and \`ask\`
|
|
13206
|
+
handling (see Workflow testing below) \u2014 but only AFTER the ref'd
|
|
13207
|
+
agents are independently verified.
|
|
13208
|
+
- **Orchestrator trust upgrade** requires BOTH: all component evals pass
|
|
13209
|
+
AND the orchestrator's integration eval passes. The orchestrator's
|
|
13210
|
+
metadata (verified/source) records this dependency.
|
|
13211
|
+
- Independent agents (no parent, no ref) keep single-level eval \u2014 no
|
|
13212
|
+
integration layer needed.
|
|
13213
|
+
|
|
13214
|
+
## Workflow testing (WORKFLOW-type agents)
|
|
13215
|
+
|
|
13216
|
+
Workflows compile to the same agent registry and run through the same
|
|
13217
|
+
eval path \u2014 same project naming (eval-{agent-id}), same case structure
|
|
13218
|
+
(inputMessage + steps + contentAssertion). Design differs because the
|
|
13219
|
+
pipeline is DETERMINISTIC:
|
|
13220
|
+
|
|
13221
|
+
- **One case per branch path** \u2014 each if/map/parallel route gets a case
|
|
13222
|
+
whose inputMessage drives it down that path; contentAssertion = the
|
|
13223
|
+
exact output that path must produce (from the expected output spec,
|
|
13224
|
+
Phase 1.5 in [[design-workflow]]).
|
|
13225
|
+
- **Goal-driven dimensions** \u2014 cases cover all four dimensions
|
|
13226
|
+
([[agent-architecture|Goal-Driven Validation]]), not just happy paths:
|
|
13227
|
+
- Functional correctness \u2014 each branch path produces the right result
|
|
13228
|
+
- Edge robustness \u2014 empty input, if-condition not met, map source
|
|
13229
|
+
empty, malformed data: the pipeline must fail gracefully or take
|
|
13230
|
+
the designed fallback, not crash
|
|
13231
|
+
- Business usability \u2014 output reaches the usable state (usable-state
|
|
13232
|
+
cases come from the confirmed spec, never invented)
|
|
13233
|
+
- Consumer fit \u2014 exact fields/format for system consumers, readable
|
|
13234
|
+
for human consumers
|
|
13235
|
+
- **Data contract cases** \u2014 intermediate \`{{refs}}\` handoffs and
|
|
13236
|
+
\`map\` source shapes are contracts; a contract broken mid-pipeline
|
|
13237
|
+
only surfaces at the end. One case per non-trivial handoff asserting
|
|
13238
|
+
the intermediate output shape (source data + step output).
|
|
13239
|
+
- **\`ask\` steps** \u2014 case interruptPolicy controls them
|
|
13240
|
+
(mode: stop | auto-approve | auto-reject | canned-response):
|
|
13241
|
+
- \`stop\` \u2192 the run pauses at the ask; assert the partial output
|
|
13242
|
+
BEFORE the interaction point
|
|
13243
|
+
- auto-approve / auto-reject / canned-response \u2192 supply the response
|
|
13244
|
+
and continue; assert the flow AFTER the interaction point
|
|
13245
|
+
- \`value\` holds the response text (defaults "\u540C\u610F"/"\u62D2\u7EDD" for
|
|
13246
|
+
approve/reject)
|
|
13247
|
+
- **Exact assertions** \u2014 deterministic pipeline means expected outputs
|
|
13248
|
+
are precise; judge still scores semantics on top.
|
|
13249
|
+
- **Trust upgrade is the same gate** \u2014 [[completion-gate]] applies to
|
|
13250
|
+
workflows: no eval \u2192 stays configured, never verified.
|
|
13148
13251
|
|
|
13149
13252
|
## Run
|
|
13150
13253
|
|
|
@@ -13210,11 +13313,39 @@ verified: unverified
|
|
|
13210
13313
|
# Design Workflow \u2014 WORKFLOW Agent Design
|
|
13211
13314
|
|
|
13212
13315
|
Use the WORKFLOW type when the process is fully known \u2014 a deterministic
|
|
13213
|
-
state machine with pre-defined paths.
|
|
13316
|
+
state machine with pre-defined paths. If the process is NOT fully known
|
|
13317
|
+
(open-ended, needs dynamic decomposition) \u2192 use [[learn-capability]] /
|
|
13318
|
+
[[agent-build]] (REACT / DEEP_AGENT) instead.
|
|
13214
13319
|
Follow [[agent-architecture|User Interaction Rules]] and
|
|
13215
13320
|
[[agent-architecture|Goal Model]] \u2014 establish the goal model (real
|
|
13216
13321
|
goal / consumer / usable state) before designing, and design steps
|
|
13217
13322
|
that achieve it. Acceptance = workflow outcome meets the usable state.
|
|
13323
|
+
Follow [[agent-architecture|Knowledge in Skills]]: workflow steps
|
|
13324
|
+
orchestrate; domain knowledge lives in SKILL.md. Never write domain
|
|
13325
|
+
knowledge directly into a step's prompt \u2014 load it via [[skill-name]]
|
|
13326
|
+
or delegate to an agent that loads the skill.
|
|
13327
|
+
|
|
13328
|
+
## CRITICAL RULES
|
|
13329
|
+
- **NEVER build before confirming.** Design \u2192 present the flow as a
|
|
13330
|
+
widget \u2192 discuss step-by-step with the user \u2192 confirm via
|
|
13331
|
+
\`ask_user_to_clarify\` (blocking approval) \u2192 only then call
|
|
13332
|
+
\`create_workflow\`. No exceptions.
|
|
13333
|
+
- **Always visualize the design** \u2014 present with \`show_widget\` as a
|
|
13334
|
+
Flowchart (every step, branch, \`ask\` interaction point) \u2014 never a
|
|
13335
|
+
bare text list (see Visual communication below).
|
|
13336
|
+
- **One decision at a time.** Each message asks exactly one question.
|
|
13337
|
+
- **Track with tasks once scope is clear.** Create the parent task
|
|
13338
|
+
([[task-tracking]]) before designing; record the expected output spec
|
|
13339
|
+
(Phase 1.5) in it.
|
|
13340
|
+
|
|
13341
|
+
## Visual communication
|
|
13342
|
+
|
|
13343
|
+
Use \`show_widget\` for all structure explanations \u2014 never ASCII art.
|
|
13344
|
+
| Scenario | What |
|
|
13345
|
+
|----------|------|
|
|
13346
|
+
| Workflow flow | Flowchart (steps, branches, ask points) |
|
|
13347
|
+
| Step-level comparison | Comparison cards |
|
|
13348
|
+
| Data flow / {{refs}} | Flowchart |
|
|
13218
13349
|
|
|
13219
13350
|
## Phase 0: Load Skills
|
|
13220
13351
|
|
|
@@ -13224,20 +13355,122 @@ that achieve it. Acceptance = workflow outcome meets the usable state.
|
|
|
13224
13355
|
|
|
13225
13356
|
## Phase 1: Design
|
|
13226
13357
|
|
|
13227
|
-
1.
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
4.
|
|
13231
|
-
|
|
13232
|
-
|
|
13358
|
+
1. **Establish the goal model FIRST** \u2014 real goal / user expectation /
|
|
13359
|
+
consumer / usable state ([[agent-architecture|Goal Model]]); record
|
|
13360
|
+
it in the parent task. It drives the expected output spec (Phase
|
|
13361
|
+
1.5) and verification (Phase 4). Then analyze the process: map
|
|
13362
|
+
every step, branch, data dependency.
|
|
13363
|
+
2. **Choose implementation mode per step \u2014 ASK the user** (present as
|
|
13364
|
+
comparison cards). Each step's logic is either inline or \`ref\`:
|
|
13365
|
+
- **inline prompt** \u2014 logic lives in the step's prompt. Fast, no
|
|
13366
|
+
extra agents. Cost: not reusable, no own tools, verified ONLY via
|
|
13367
|
+
the integration eval. OK for trivial one-off glue steps.
|
|
13368
|
+
- **ref sub-agent** \u2014 the step delegates to a registered agent with
|
|
13369
|
+
its own tools/model/skills (built via [[agent-build]], prompt =
|
|
13370
|
+
"Load [[skill-name]] and follow it"). Reusable, independently
|
|
13371
|
+
verified (Phase 2.6). Use when the step needs tools, non-trivial
|
|
13372
|
+
or reusable logic, or independent verification.
|
|
13373
|
+
Present the per-step choice with trade-offs and let the user
|
|
13374
|
+
decide \u2014 NEVER silently pick inline or ref. When in doubt, ask.
|
|
13375
|
+
3. **Identify knowledge per step** \u2014 for each step, determine the domain
|
|
13376
|
+
knowledge it needs:
|
|
13377
|
+
- Existing skill covers it \u2192 reference [[skill-name]] in the step
|
|
13378
|
+
- No skill yet, but the knowledge is reusable or non-trivial \u2192
|
|
13379
|
+
plan to create it (Phase 1.5)
|
|
13380
|
+
- Trivial one-off logic \u2192 may stay inline in the prompt (accept the
|
|
13381
|
+
trade-off: it is not reusable or individually verifiable)
|
|
13382
|
+
4. Design using the YAML linear DSL (steps, parallel, map, if, ask).
|
|
13383
|
+
5. **Present the design as a Flowchart widget** (\`show_widget\`) \u2014 every
|
|
13384
|
+
step, branch, and \`ask\` interaction point. Walk through it with the
|
|
13385
|
+
user step-by-step (each step's responsibility, branch logic, ask
|
|
13386
|
+
points). CONFIRM via \`ask_user_to_clarify\` \u2014 never build without
|
|
13387
|
+
explicit user approval.
|
|
13388
|
+
|
|
13389
|
+
## Phase 1.5: Expected Output Specification (mandatory \u2014 goal-driven)
|
|
13390
|
+
|
|
13391
|
+
Define the workflow's EXPECTED OUTPUT SPEC from the goal model BEFORE
|
|
13392
|
+
writing skills or building: what the final outcome looks like, per
|
|
13393
|
+
consumer (0.1.5). This is the acceptance standard \u2014 [[eval-verify]]
|
|
13394
|
+
contentAssertion derives from it. HARD RULE: if the target/expected
|
|
13395
|
+
output is unclear, ask the user \u2014 never guess.
|
|
13396
|
+
Present the spec, confirm with the user, record in the parent task.
|
|
13397
|
+
|
|
13398
|
+
## Phase 2: Create Skills (for missing knowledge)
|
|
13399
|
+
|
|
13400
|
+
For each planned skill (Phase 1.2): write SKILL.md (frontmatter +
|
|
13401
|
+
body encoding the domain rules). Present each for user approval.
|
|
13402
|
+
When 3+ skills share a domain \u2192 create a MOC ([[domain-moc]]).
|
|
13403
|
+
If a ref step needs an agent \u2192 build it via [[agent-build]] (agent
|
|
13404
|
+
prompt = "Load [[skill-name]] and follow it" \u2014 thin, knowledge in
|
|
13405
|
+
skill). Order: sub-agents/skills first, then the workflow that
|
|
13406
|
+
references them.
|
|
13407
|
+
|
|
13408
|
+
## Phase 2.6: Verify components FIRST (mandatory)
|
|
13409
|
+
|
|
13410
|
+
Every agent referenced by a \`ref\` step is a component with its OWN
|
|
13411
|
+
independent eval (eval-{ref-agent-id}) \u2014 run it and pass it BEFORE
|
|
13412
|
+
building the integration eval. The workflow cannot be considered tested
|
|
13413
|
+
until: \u2460 each ref'd agent's eval passes independently, \u2461 then the
|
|
13414
|
+
workflow's integration eval (branch paths + ask handling) passes. See
|
|
13415
|
+
[[eval-verify|Layered verification]].
|
|
13416
|
+
|
|
13417
|
+
## Phase 3: Build
|
|
13418
|
+
|
|
13419
|
+
1. **Configure middleware & tools for the workflow itself** \u2014 inline
|
|
13420
|
+
steps run on the workflow's own model/tools: call
|
|
13421
|
+
\`list_middleware_types\` first; add what the workflow needs \u2014 skill
|
|
13422
|
+
(if steps load [[skill-name]]), widget, ask_user_to_clarify, etc.
|
|
13423
|
+
Tool filtering via \`allowedTools\`. \`ref\` steps use the ref'd
|
|
13424
|
+
agent's own tools/model \u2014 nothing to configure here. Choose
|
|
13425
|
+
\`modelKey\` only when a specific model is required (default
|
|
13426
|
+
otherwise).
|
|
13427
|
+
2. Call \`create_workflow\` with \`skillLoaded: true\` \u2014 steps reference
|
|
13428
|
+
[[skill-name]] or \`ref\` to skill-loading agents.
|
|
13429
|
+
3. Then \`validate_workflow(id)\`.
|
|
13430
|
+
|
|
13431
|
+
## Phase 4: Test (mandatory \u2014 no eval, no trust tier)
|
|
13432
|
+
|
|
13433
|
+
The authoritative verification is [[eval-verify]] \u2014 cases derive from
|
|
13434
|
+
the expected output spec (Phase 1.5). A workflow without a passing eval
|
|
13435
|
+
stays at "configured" forever \u2014 trust can never upgrade
|
|
13436
|
+
([[completion-gate]], no skip option).
|
|
13437
|
+
|
|
13438
|
+
**Testing is managed through the eval project (eval-{workflow-id})
|
|
13439
|
+
and its cases \u2014 the same governance as agents.** Temporary or quick
|
|
13440
|
+
checks (ad-hoc runs, previewing behavior) may use [[review-agent]] as
|
|
13441
|
+
an interactive pre-check \u2014 but that is NOT the workflow's test suite:
|
|
13442
|
+
it never upgrades trust and never replaces the eval project. Only the
|
|
13443
|
+
eval project's cases passing determine "tested".
|
|
13444
|
+
|
|
13445
|
+
**Test order \u2014 components first, then integration:**
|
|
13446
|
+
1. Each \`ref\`'d agent: its OWN eval (eval-{ref-agent-id}) must pass
|
|
13447
|
+
independently (Phase 2.6) \u2014 fix it in isolation, not through the
|
|
13448
|
+
workflow.
|
|
13449
|
+
2. Then the workflow's integration eval (eval-{workflow-id}): one case
|
|
13450
|
+
per branch path (if/map/parallel); \`ask\` steps via case
|
|
13451
|
+
interruptPolicy (auto-approve/canned-response to test the flow AFTER
|
|
13452
|
+
the pause, stop to test up to the pause); assertions are exact \u2014
|
|
13453
|
+
the pipeline is deterministic.
|
|
13454
|
+
|
|
13455
|
+
Workflow trust upgrade requires BOTH layers passing.
|
|
13456
|
+
[[review-agent]] is an optional cheap pre-check only.
|
|
13457
|
+
|
|
13458
|
+
## Editing workflows
|
|
13459
|
+
|
|
13460
|
+
Get the current YAML \u2192 present the diff \u2192 confirm with the user \u2192
|
|
13461
|
+
\`update_workflow(id, ...)\`. Never re-create.
|
|
13462
|
+
After ANY change: verified resets to unverified and the eval is re-run
|
|
13463
|
+
([[eval-verify]]) \u2014 the change is not done until the eval passes again.
|
|
13464
|
+
Deleting: warn if any step \`ref\`s it \u2192 confirm \u2192 \`delete_agent\`.
|
|
13233
13465
|
|
|
13234
|
-
|
|
13235
|
-
\`validate_workflow(id)\`.
|
|
13236
|
-
|
|
13237
|
-
## Phase 3: Test
|
|
13466
|
+
## Metadata
|
|
13238
13467
|
|
|
13239
|
-
|
|
13240
|
-
|
|
13468
|
+
Always set metadata on workflow creation. At minimum:
|
|
13469
|
+
- verified: "unverified" (upgraded after eval passes)
|
|
13470
|
+
- version: "1.0" (bump on each update)
|
|
13471
|
+
- source: the material name or "user-description"
|
|
13472
|
+
When trust upgrades, update BOTH the skill's verified frontmatter and
|
|
13473
|
+
the workflow's metadata.verified \u2014 they must stay in sync.
|
|
13241
13474
|
|
|
13242
13475
|
## No edges, state fields, or end step
|
|
13243
13476
|
The engine auto-generates them. Steps execute top-to-bottom in written
|
|
@@ -23572,10 +23805,36 @@ TASK MANAGEMENT IS A CORE DUTY, not a per-skill option. Whenever the
|
|
|
23572
23805
|
goal is clear and you know what to do, create a task FIRST (manage_task)
|
|
23573
23806
|
before executing \u2014 for any multi-step work: learning, building,
|
|
23574
23807
|
modifying, fixing, anything with an Objective and Acceptance Criteria.
|
|
23575
|
-
|
|
23808
|
+
- **Check for duplicates BEFORE creating** \u2014 always manage_task
|
|
23809
|
+
action: "list" first (filter ownerType: "agent"). If a task with the
|
|
23810
|
+
same objective already exists (e.g. from an interrupted session),
|
|
23811
|
+
RESUME it instead of creating a new one.
|
|
23812
|
+
- **Decompose into subtasks** \u2014 after the parent task, create a
|
|
23813
|
+
subtask per work item / phase (e.g. design, build, eval), each with
|
|
23814
|
+
its own Objective + Acceptance Criteria.
|
|
23815
|
+
- **Update on completion** \u2014 every finished subtask and the parent:
|
|
23816
|
+
manage_task update(status: "completed", result: "what was done").
|
|
23817
|
+
Use interrupted/failed with summary/failureReason when blocked or
|
|
23818
|
+
unable. Status must always reflect reality \u2014 never leave a finished
|
|
23819
|
+
task dangling in an in-progress state.
|
|
23820
|
+
See [[task-tracking]].
|
|
23576
23821
|
The sub-skills below only ADD their own task details on top of this
|
|
23577
23822
|
universal duty.
|
|
23578
23823
|
|
|
23824
|
+
BUILD GATES \u2014 hard behavioral requirements, no exceptions, no skipping:
|
|
23825
|
+
- Creating a WORKFLOW ([[design-workflow]]): \u2460 show the design as a
|
|
23826
|
+
Flowchart widget (every step, branch, ask point) \u2461 walk through it
|
|
23827
|
+
step-by-step with the user \u2462 ask inline-vs-ref per step \u2463 CONFIRM via
|
|
23828
|
+
ask_user_to_clarify \u2014 only then call create_workflow.
|
|
23829
|
+
- Creating an AGENT ([[agent-build]]): \u2460 present the design with
|
|
23830
|
+
show_widget \u2461 confirm via ask_user_to_clarify \u2014 only then call
|
|
23831
|
+
create_agent.
|
|
23832
|
+
- Both: if the goal model (real goal / consumer / usable state) is
|
|
23833
|
+
unclear, ask BEFORE designing \u2014 never guess.
|
|
23834
|
+
The skills document WHY and HOW; these gates are the unskippable
|
|
23835
|
+
minimum. If you cannot satisfy a gate (e.g. user says skip), record it
|
|
23836
|
+
and proceed only on the user's explicit instruction.
|
|
23837
|
+
|
|
23579
23838
|
Your sub-skills (accessible via the MOC or direct loading):
|
|
23580
23839
|
- [[learn-capability]] \u2014 Learn from any source material \u2192 skills + agents
|
|
23581
23840
|
- [[agent-build]] \u2014 Design and build single agents (REACT/DEEP_AGENT)
|
|
@@ -27695,7 +27954,7 @@ File content: ${files[key4]}`
|
|
|
27695
27954
|
{
|
|
27696
27955
|
dimension: "correctness",
|
|
27697
27956
|
weight: 100,
|
|
27698
|
-
description: "\
|
|
27957
|
+
description: "Overall correctness \u2014 whether the result matches the expected output description."
|
|
27699
27958
|
}
|
|
27700
27959
|
];
|
|
27701
27960
|
const evalRubrics = evalCase.eval.eval_rubrics && evalCase.eval.eval_rubrics.length > 0 ? evalCase.eval.eval_rubrics : defaultRubrics;
|
|
@@ -27709,53 +27968,53 @@ File content: ${files[key4]}`
|
|
|
27709
27968
|
${evalRubrics.map(
|
|
27710
27969
|
(r) => `- **${r.dimension}**\uFF08\u6743\u91CD\uFF1A${r.weight}\uFF09\uFF1A${r.description}`
|
|
27711
27970
|
).join("\n")}`;
|
|
27712
|
-
const testPrompt = `#
|
|
27713
|
-
|
|
27971
|
+
const testPrompt = `# Role
|
|
27972
|
+
You are a senior AI Agent evaluation expert. Your job is to perform a "black-box test" judgment of the agent's execution process and results against the preset evaluation rubrics.
|
|
27714
27973
|
|
|
27715
|
-
#
|
|
27716
|
-
|
|
27974
|
+
# Input Information
|
|
27975
|
+
The test framework provides you with the following five core contexts:
|
|
27717
27976
|
|
|
27718
|
-
1.
|
|
27977
|
+
1. **User Intent**: ${evalCase.input.message}
|
|
27719
27978
|
|
|
27720
|
-
2.
|
|
27979
|
+
2. **Input Files**: ${testCaseFilesContent || "None"}
|
|
27721
27980
|
|
|
27722
|
-
3.
|
|
27981
|
+
3. **Execution Trajectory** (the agent's full message/tool-call record):
|
|
27723
27982
|
${trajectory}
|
|
27724
27983
|
|
|
27725
|
-
4.
|
|
27984
|
+
4. **Final Output** (the agent's last reply):
|
|
27726
27985
|
${finalOutput}
|
|
27727
27986
|
|
|
27728
|
-
5.
|
|
27987
|
+
5. **Expected Output Description**: ${evalCase.eval.content_assertion}
|
|
27729
27988
|
${rubricsSection}
|
|
27730
27989
|
|
|
27731
|
-
#
|
|
27732
|
-
|
|
27990
|
+
# Task
|
|
27991
|
+
You must strictly evaluate the agent against every rubric in the "Evaluation Rubrics" section, using both the "Execution Trajectory" and the "Final Output". Evaluate the final result AND whether the process correctly performed the required intermediate steps (tool calls, information retrieval, etc.).
|
|
27733
27992
|
|
|
27734
|
-
#
|
|
27735
|
-
1.
|
|
27736
|
-
2.
|
|
27737
|
-
3.
|
|
27738
|
-
4.
|
|
27739
|
-
5.
|
|
27740
|
-
6. **HITL
|
|
27741
|
-
7. **HITL
|
|
27993
|
+
# Rules
|
|
27994
|
+
1. **Objectivity**: Judge solely from the provided context. If the standard requires "contains a number" but the output has only text, points must be deducted even if the tone is good.
|
|
27995
|
+
2. **Result verification**: If the "Final Output" is missing expected content, or does not meet the criteria in the "Evaluation Rubrics", the corresponding rubric must be marked as failed.
|
|
27996
|
+
3. **Process verification**: If the "Execution Trajectory" shows the agent did not perform a necessary intermediate step (e.g., should have called a tool but did not), deduct points on the corresponding rubric even if the final output looks plausible.
|
|
27997
|
+
4. **Evidence-based**: When giving a reason, you must quote specific content from the execution trajectory or final output.
|
|
27998
|
+
5. **Weighted scoring**: The final score is the weighted sum of the rubric scores (on a 0-100 scale).
|
|
27999
|
+
6. **HITL interrupt judgment**: If the trajectory contains a "HITL pause: agent requested human input" entry, the agent is waiting for human confirmation. Treat this as the business behavior under test: if the expected output requires autonomous completion (e.g., "execute automatically without confirmation"), requesting human input should be judged a failure; if the expected output requires confirmation or approval first (e.g., "must request approval before executing"), requesting human input is correct behavior \u2014 judge its timing and content, passing or scoring according to the rubrics.
|
|
28000
|
+
7. **HITL auto-response judgment**: If a "HITL pause" entry is followed by an "auto-responded (test policy auto-approve/auto-reject/canned-response)" entry, the test framework injected a human reply and the flow continued \u2014 evaluate the behavior AFTER the pause as the complete flow (e.g., whether the operation was correctly executed after approval), and check whether the auto-response content matches a reasonable human reply.
|
|
27742
28001
|
|
|
27743
|
-
#
|
|
27744
|
-
|
|
28002
|
+
# Output Format (JSON only)
|
|
28003
|
+
You MUST reply with JSON only, using this structure:
|
|
27745
28004
|
{
|
|
27746
28005
|
"pass": true | false,
|
|
27747
28006
|
"final_score": number,
|
|
27748
28007
|
"dimension_results": [
|
|
27749
28008
|
{
|
|
27750
|
-
"name": "
|
|
28009
|
+
"name": "rubric name",
|
|
27751
28010
|
"score": number,
|
|
27752
|
-
"reason": "
|
|
28011
|
+
"reason": "specific reason for deduction or credit, citing evidence"
|
|
27753
28012
|
}
|
|
27754
28013
|
],
|
|
27755
|
-
"summary": "
|
|
28014
|
+
"summary": "overall evaluation of the agent's performance"
|
|
27756
28015
|
}
|
|
27757
28016
|
|
|
27758
|
-
|
|
28017
|
+
Note: if final_score >= 80 and there are no fatal errors, pass should be true; otherwise false.`;
|
|
27759
28018
|
this.lastTestPrompt = testPrompt;
|
|
27760
28019
|
const judgeThreadId = (0, import_uuid9.v4)();
|
|
27761
28020
|
this.lastJudgeThreadId = judgeThreadId;
|
|
@@ -28138,6 +28397,32 @@ var LatticeEvalSuite = class {
|
|
|
28138
28397
|
var import_protocols16 = require("@axiom-lattice/protocols");
|
|
28139
28398
|
var import_messages7 = require("@langchain/core/messages");
|
|
28140
28399
|
var import_uuid10 = require("uuid");
|
|
28400
|
+
var DEFAULT_CALIBRATION_PROBES = [
|
|
28401
|
+
{
|
|
28402
|
+
id: "catch-up-correct",
|
|
28403
|
+
task: "A train leaves Station A at 10:00 AM traveling at 60 mph. A second train leaves Station A at 10:30 AM traveling at 90 mph on the same route. The final answer must be the time (HH:MM) at which the second train catches up to the first.",
|
|
28404
|
+
finalOutput: "11:30",
|
|
28405
|
+
expectedPass: true
|
|
28406
|
+
},
|
|
28407
|
+
{
|
|
28408
|
+
id: "catch-up-wrong",
|
|
28409
|
+
task: "A train leaves Station A at 10:00 AM traveling at 60 mph. A second train leaves Station A at 10:30 AM traveling at 90 mph on the same route. The final answer must be the time (HH:MM) at which the second train catches up to the first.",
|
|
28410
|
+
finalOutput: "12:30",
|
|
28411
|
+
expectedPass: false
|
|
28412
|
+
},
|
|
28413
|
+
{
|
|
28414
|
+
id: "discount-tax-correct",
|
|
28415
|
+
task: "A store offers a 20% discount on an item priced at $150, then adds 8% sales tax to the discounted price. The final answer must be the total price in dollars.",
|
|
28416
|
+
finalOutput: "129.6",
|
|
28417
|
+
expectedPass: true
|
|
28418
|
+
},
|
|
28419
|
+
{
|
|
28420
|
+
id: "discount-tax-wrong",
|
|
28421
|
+
task: "A store offers a 20% discount on an item priced at $150, then adds 8% sales tax to the discounted price. The final answer must be the total price in dollars.",
|
|
28422
|
+
finalOutput: "162",
|
|
28423
|
+
expectedPass: false
|
|
28424
|
+
}
|
|
28425
|
+
];
|
|
28141
28426
|
var LatticeEvalProject = class {
|
|
28142
28427
|
constructor(project, onCaseComplete) {
|
|
28143
28428
|
this.suites = /* @__PURE__ */ new Map();
|
|
@@ -28245,21 +28530,22 @@ var LatticeEvalProject = class {
|
|
|
28245
28530
|
}
|
|
28246
28531
|
/**
|
|
28247
28532
|
* Verify the judge agent can produce parseable, correct verdicts
|
|
28248
|
-
* before committing to a full run. Uses
|
|
28249
|
-
*
|
|
28533
|
+
* before committing to a full run. Uses known-answer probes (default
|
|
28534
|
+
* multi-step reasoning set, overridable per project via
|
|
28535
|
+
* judge_agent_config.calibration_cases) to catch broken judges.
|
|
28536
|
+
* Checks both the pass verdict and the final_score direction.
|
|
28250
28537
|
*/
|
|
28251
28538
|
async calibrateJudge() {
|
|
28252
28539
|
const tenantId2 = this.project.lattice_server_config.tenant_id || "default";
|
|
28253
28540
|
const judgeAgent = await getAgentClient(tenantId2, this.judgeAgentKey);
|
|
28254
|
-
const
|
|
28255
|
-
|
|
28256
|
-
|
|
28257
|
-
|
|
28258
|
-
|
|
28259
|
-
|
|
28260
|
-
|
|
28261
|
-
|
|
28262
|
-
\u4EC5\u8F93\u51FA JSON\uFF1A{"pass": true|false, "final_score": 0-100, "summary": "\u7406\u7531"}`;
|
|
28541
|
+
const probes = this.project.judge_agent_config.calibration_cases && this.project.judge_agent_config.calibration_cases.length > 0 ? this.project.judge_agent_config.calibration_cases : DEFAULT_CALIBRATION_PROBES;
|
|
28542
|
+
for (const probe of probes) {
|
|
28543
|
+
const trajectorySection = probe.trajectory ? `
|
|
28544
|
+
Trajectory: ${probe.trajectory}` : "";
|
|
28545
|
+
const prompt = `You are an evaluation expert. Judge whether the final output meets the expected output description.
|
|
28546
|
+
Expected output description: ${probe.task}
|
|
28547
|
+
Final output: ${probe.finalOutput}${trajectorySection}
|
|
28548
|
+
Respond with JSON only: {"pass": true|false, "final_score": 0-100, "summary": "reason"}`;
|
|
28263
28549
|
let raw = "";
|
|
28264
28550
|
let invokeError = null;
|
|
28265
28551
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
@@ -28284,13 +28570,24 @@ var LatticeEvalProject = class {
|
|
|
28284
28570
|
return { ok: false, reason: `Calibration output unparseable: ${parsed.error}`, bypassed: true };
|
|
28285
28571
|
}
|
|
28286
28572
|
const actualPass = parsed.pass !== void 0 ? parsed.pass : (parsed.final_score ?? 0) >= 80;
|
|
28287
|
-
if (actualPass !==
|
|
28573
|
+
if (actualPass !== probe.expectedPass) {
|
|
28288
28574
|
return {
|
|
28289
28575
|
ok: false,
|
|
28290
|
-
reason: `Calibration mismatch
|
|
28576
|
+
reason: `Calibration mismatch (probe=${probe.id}): expected ${probe.expectedPass ? "PASS" : "FAIL"}, judge said ${actualPass ? "PASS" : "FAIL"}`,
|
|
28291
28577
|
bypassed: true
|
|
28292
28578
|
};
|
|
28293
28579
|
}
|
|
28580
|
+
if (parsed.final_score !== void 0) {
|
|
28581
|
+
const minScore = probe.expectedScoreMin ?? 80;
|
|
28582
|
+
const scoreOk = probe.expectedPass ? parsed.final_score >= minScore : parsed.final_score < minScore;
|
|
28583
|
+
if (!scoreOk) {
|
|
28584
|
+
return {
|
|
28585
|
+
ok: false,
|
|
28586
|
+
reason: `Calibration score mismatch (probe=${probe.id}): expected ${probe.expectedPass ? "final_score >= " + minScore : "final_score < " + minScore}, judge gave ${parsed.final_score}`,
|
|
28587
|
+
bypassed: true
|
|
28588
|
+
};
|
|
28589
|
+
}
|
|
28590
|
+
}
|
|
28294
28591
|
}
|
|
28295
28592
|
return { ok: true };
|
|
28296
28593
|
}
|
|
@@ -32690,6 +32987,7 @@ registerBuiltinPlugins();
|
|
|
32690
32987
|
ConsoleLoggerClient,
|
|
32691
32988
|
CustomMetricsClient,
|
|
32692
32989
|
CustomMiddlewareRegistry,
|
|
32990
|
+
DEFAULT_CALIBRATION_PROBES,
|
|
32693
32991
|
DaytonaInstance,
|
|
32694
32992
|
DaytonaProvider,
|
|
32695
32993
|
DefaultScheduleClient,
|