---
name: medical-create
description: Build and use medical Agent Presets; compare versions only when optimization is requested.
---
Use `medical_creator` for versioned bundles and acceptance, and `med_cli` with the existing DSH-Med argv protocol for discovery. There is one discovery entry point: `med_cli`; legacy directory tools are not mounted. A directory Entry is provenance, not an executable binding. Record actual plugin names and configuration separately.
Keep benchmark answers private by behavior: neither the creator nor Target may open/search private contracts, creator-state.json, gold labels, expected checks, calibration answers or private review records, including through Shell, HTTP or another agent. Pass a private contract path directly to `start_optimization.contractFile`; never read/transcribe it. If answers were accidentally exposed, disclose contamination. This instruction is not an OS/filesystem boundary; formal benchmark isolation is separate. Ordinary creation and local trials require no benchmark.
For a custom paid/unknown external service, declare it in `contract.paidServices` and add `spec.externalServices:[{label:"same service declaration",tools:["exact_registered_tool"]}]`. Bind only externally charged tools so local read/inventory/checkers remain usable without a service card. Native web/MCP keep their verified mappings. The existing human service card appears on actual dispatch and is reused within its task allowance; neither credentials nor installation approval grant business use. Legacy unbound paid custom bundles request broader dispatch permission; stage precise bindings rather than silently removing declarations. Counts measure native tool dispatches, not inner HTTP requests or a monetary cap.
A user-selected model change starts a recorded measurement stage without a new dialog or extra approval. The controller freshly pairs parent/candidate on that same model, and recalibrates rubric workers for the new stage. Preserve historical results; never describe cross-stage absolute score differences as a same-model improvement.
Real `med_cli` installs run as durable background jobs. Poll `{"job":{"action":"status","id":"operationId"}}` until finished, then take the binding from `result`. For an interrupted attempt use `recover`, then `retry` only when `retryAllowed` is true. `cancel` stops an owned active job. Reuse the same operation id. The current visible conversation supports binding, revision, replay and paired evaluation. An applied bundle receives startup/schema preflight before any model dispatch. Supply representative `medical_creator preflight` samples to catch missing input fields and invalid output schemas; verify tool behavior through the user-requested task.
This build targets the installed Harness `0.2.2-alpha.2` APIs. Load `editing-cordis-compositions` for Preset authoring, `cordis-plugin-development` for custom plugin code, and `cordis-composition-reference` for valid native packages. Published packages supply `lib/types`; do not require an installed package to contain a source checkout's `src` tree or rc.5 documentation.
For loop, compaction, output/token budgets, memory plugins or Host extensions, read [native runtime strategies](references/runtime-strategy.md). Native composition and runtime settings are versioned in the generated bundle. Ordinary task execution and paired-comparison freezing have different contracts.
For a new RSI v3 initial baseline that completed with verified finite measurements but failed validity or the quality floor, `baseline-needs-improvement` permits one bounded repair proposal using that measured parent. It does not accept or save the failing baseline. Unknown, incomplete, configuration-blocked and historical terminal baselines remain closed. Installing or recovering a previously staged bundle does not reopen a stopped comparison. An accepted output repair records a repaired result, not a reusable Agent improvement.
New RSI v3 contracts default to `evaluation.acceptancePolicy="quality-first"`: validity, quality floor and the same cohort/model within each fresh parent/candidate pair remain mandatory. RSI v3 uses aggregate quality and repeated-direction evidence; per-task regressions remain visible and explicit hard gates still apply. User model changes start recorded measurement stages without rewriting earlier results. A quality gain meeting minGain may use more time/tokens under the existing per-execution timeout and candidate-attempt limits. With no qualifying quality gain, retain conservative resource-improvement and 5% regression checks. Explicit `pareto` keeps those guards even for quality gains. Missing policy in a stored legacy contract means legacy Pareto; never migrate old hashes/scores or claim cross-contract gains. Time/round limits are not a whole-experiment monetary/token cap; unknown billing stays unknown.
Minimal initial call:
```json
{"action":"create","mode":"build","spec":{"name":"结构化文献提取","instructions":"准确提取给定文本中的事实。不要推测。仅返回要求的JSON。","tools":[],"entries":[]}}
```
Use returned experiment/version IDs in `install`, then `publish` to request saving or `run_task` for a user task. No baseline, synthetic cases or scores are required to create and save an agent. Build revisions can `stage` a new spec without comparisons; do not call them proven improvements.
Only when the user requests comparative optimization, call `start_optimization` for an installed source version: use contractFile for an existing authoritative benchmark, or the independent evaluationBrief path below when no benchmark exists. It leaves the source unchanged, does not run a Target or save an agent; independent design does call the existing model. From scratch use `create(mode:"optimize",contract,spec)`. Prefer actual user tasks or failures; disclose synthetic examples. Install/evaluate the baseline, then stage/install/evaluate one bounded repair hypothesis on the same cohort; necessary coordinated edits may span components within allowedChanges. Never submit self-reported scores. Round settings alone do not authorize optimization or paid services.
When no authoritative benchmark exists, use start_optimization with evaluationBrief, a stable requestId and optional evaluationSettings:{maxRounds:3,patience:1,repetitions:2,timeoutMs:180000}; omit contract and contractFile. Explicit maxRounds:null / timeoutMs:null preserve the user choice of unlimited; missing fields keep defaults. Finite patience, manual cancellation and external authorization still apply. A separate native output-only Evaluator designs the benchmark, and the backend calibrates deterministic scorers before creation. Inspect designId to recover status; do not replay an incomplete design using a new requestId. Model tool results expose public tasks, scores and Target traces, not gold, calibration fixtures or reviewer explanations. Human diagnostics remain complete. This is context/tool-result separation, not an OS sandbox against unrestricted Shell. Never read private evaluation files to optimize answers.
For an existing human-supplied benchmark use start_optimization with contractFile, a stable requestId and preferably contractFileSha256. The backend reads the private UTF-8 JSON file through native FS (at most 1 MiB), validates RSI v3, and returns only public tasks/settings plus source/size/hash. Do not read, transcribe or infer new official answers. Omit contract, evaluationBrief and evaluationSettings; imported settings stay frozen. A failed/incomplete import needs human diagnostics, not another requestId. A human may explicitly supply contract inline, but its private contents then appear in the authoring context. Use exact/typed checks: json-number with JSON Pointer path, finite value, absoluteTolerance/relativeTolerance; json-field-equals for a categorical/boolean field; json-equals for a whole object. contains only establishes literal presence ("不一致" contains "一致"); it cannot assess semantic truth. Each deterministic task needs calibration:[{output:string,valid:boolean,quality:number}] including a fully correct case (valid:true, quality:1) and a well-formed wrong-answer case (valid:true, quality:0); use role:"quality" for ordinary answers and role:"gate" only for explicit hard constraints; include equivalent numeric notation and negation. Backend validates these before a model runs. Calibration tests the scorer, not medical truth. For open-ended research use a concrete frozen rubric and disclose independent model review limits; no self-invented keyword score. Arbitrary Python/biomedical evaluator execution still needs a separately reviewed adapter.
Declare task.outputFile for a final UTF-8 artifact (<=1 MiB, safe task-relative path, not an input). The Evaluator reads and hashes that file, not a chat summary. Missing/changed artifacts and invalid reviewer responses are inconclusive measurements, not a wrong-answer score or no-improvement strike. New RSI v3 repetitions:2–5 creates a complete isolated Case×Run matrix for both branches with alternating execution order; incomplete/duplicate/wrong-model cells cannot be accepted. Repeat spread is recorded, not a statistical superiority claim.
Each RSI candidate stage requires proposal:{hypothesis,changeSummary,expectedEffect}: one falsifiable repair hypothesis, explaining every necessary coordinated edit. Known-field scope and model freeze remain code-enforced; a separate native tool-free Critic screens shared implementation semantics, private-answer hardcoding, scoring manipulation and weakened method guards before measuring. Its verdict is a model screening opinion, not a code sandbox. Restricted shared-source changes on build or legacy comparison paths without this Critic are rejected; do not widen the user scope or automatically start a benchmark. A blocked review consumes a candidate attempt but no Target measurement or no-improvement strike. Full baseline quality never proves convergence: equal quality with measured resource gains can be accepted. No target-score stopping exists. Only reliable unsuccessful comparisons consume patience; maxRounds bounds candidate attempts, not the baseline. Preserve the last accepted pointer after rejection/failure; a rejected installed version is not the default usable agent. Historical contracts/results are immutable; redesigning coverage creates a new benchmark, never a claimed cross-contract gain. Default RSI uses one candidate at a time; optional multi-candidate RRSI/held-out validation are not implied.
<!-- ‹guest · 2026-12-02› -->
For completed RSI v2/v3 baseline/paired receipts, use diagnose with experimentId, attemptId and a stable requestId when independent public-trajectory analysis is needed. Optional taskId explicitly limits the scope of a large cohort. A separate tool-free reviewer returns evidence refs, causal hypotheses, one bounded repair hypothesis (possibly coordinated across components) and a verification plan. It sees ordered Target call metadata and bounded public output excerpts, not raw tool payloads or private scoring rules. Missing arguments do not establish repeated calls; missing configuration, permissions or rate limits may require an environment action rather than an Agent edit. Adoption uses stage with diagnosisId and a concrete proposal; the suggested family is advisory, while the frozen user scope and actual diff still apply; only subsequent paired evaluate can establish improvement. Ordinary build, inspect and run_task do not automatically diagnose. Recover a running, failed or unknown receipt using the same requestId; never change IDs to replay the review. After Host interruption it is outcome-unknown. A failed diagnosis does not prevent an independently motivated proposal within the existing experiment bounds.
Custom agent tools: supply `files.index.js` exporting `inject=['tools']` and `apply(ctx)` that calls `ctx.tools.register` with a real definition, plus `customPlugins:[{"name":"$bundle","phase":"agent","config":{}}]`. Exact dependencies go in `dependencies`. A client plugin additionally needs native `window.__ModuleLoader__.load` registration and a Host declaration. Host/UI extensions must be verified in a separate Profile before evaluation; they affect shared composition.
Paid APIs and compute must be declared in `contract.paidServices`; use native approval and external budget limits. Do not hide calls in generated code. Native spawn is not a complete code sandbox. Installation preserves the official manager receipt. `restart-required` requires restart then `reconcile`; `overridden` requires inspecting effective configuration. Never use a version exemption automatically.
After install, use `run_task` with experimentId, versionId, a stable requestId and task:{input,files?} to execute an arbitrary user task in a child and return its result in the current conversation. This does not evaluate, save, or promote an agent. Reusing requestId returns the existing receipt; never change requestId just to retry an unknown outcome. `inspect` with runId reads its receipt, and `feedback` records concrete user feedback. A follow-up may specify priorRunId from the same conversation/version: it starts a new child with previous input/output/feedback context, not a still-live child. Use task.attachments:[{path,name,sha256?}] for explicit binary/file transfer through the parent Agent native FS (32 MiB/file, 100 MiB total). Input snapshots and hashes are recorded; follow-ups inherit original materials, with explicit same-name replacements. A transferred image is not proof of pixel perception. Check materials and diagnostics in the receipt.
`publish(experimentId,versionId)` requests confirmation to save an installed usable version, including an unevaluated version. Evidence is separately labelled installed-unassessed, task-run-completed, baseline-checks-passed, or paired-improvement-on-declared-tasks. A successful trial is not a correctness score. Wait for the plugin Save button; never simulate it with HTTP/Shell or a model flag. Unsaved installed versions remain runnable by their owner; others can use the saved version. For output intervention only task artifacts change, not the current reusable preset. Chat history persists independently. If paid execution is denied, still complete creation and offer saving; do not repeatedly ask for a baseline that the user never requested.
Native composition uses tools as package names and optional toolConfigs keyed by selected package. Required fs-search and todo booleans have defaults; do not remove needed tools to avoid configuration errors. Optional bindings:[{entryId,plugin,tools,purpose}] associate recorded entries with an Agent plugin and expected visible tool names. These are declarations: run diagnostics report source-only, missing-tools, available-untried, calls-completed or tool-failure, never clinical validity or verified implementation provenance.
For a component selected for reuse, inspect its actual interfaces and materials, then call `med_cli` with `["metaharness","install",entryId,"--dry-run","--json"]`. The existing DSH-Med installer supports all four component types. A Skill is not automatically an API service: do not infer required credentials solely from its type, and use the native installer receipt as the installation verdict. If a reviewed, pinned Skill fits the task, remove `--dry-run` to prepare its files. Put the returned `skillBinding` unchanged into `spec.skills` and the Entry into `spec.entries`. Creator verifies the native receipt and hashes, packages the original files, and automatically mounts the native filesystem Skill provider and `skill` tool. No manually authored loader or absolute temporary path is needed. After bundle installation, verify discovery and named loading in a real task. A generic successful `skill` call does not establish which Skill was used.
Skill preparation neither executes its scripts nor configures business dependencies. Inspect requirements such as a local Python package, CLI executable, MCP server or paid API separately. `requires-configuration` is not success. MCP/CLI/DSH-plugin plans include adapter.supported, scope and reason. Reviewed integrity-pinned PyPI stdio MCPs can be prepared with the existing install-only path. When adapter.configurable is true, use the component card API settings: the user enters declared fields directly into native DSH credentials. Never request keys in chat, Shell arguments or bundle files. Configuration is not paid-call authorization or API validation; authenticated startup is deferred to an explicit task. Unsupported header/argument/transport recipes still require adaptation. put the returned mcpBinding in spec.mcps. The generated bundle mounts the current native MCP client in its Agent scope with selected public tool names; this local Python environment is not a portable embedded dependency. Other launch recipes and CLI/DSH-plugin activation remain explicit adapter gaps. Do not offer unsupported installation as a user choice, bypass it with Shell, or confuse the isolated preparation-home patch with Desktop Profile activation. Use the current Harness manager for DSH bundles. Never silently substitute newly authored tools for selected ecosystem tools without explaining the missing interface and recording the actual implementation. No component is mandatory when existing capabilities already cover the task. Keep a downloaded Skill, packaged provider, loaded method, working dependency and task result as distinct evidence.
CLI sequence: med_cli args=["search",query,"--limit","5"] → ["inspect",id,"--section","interfaces"] → ["neighbors",id,"--mode","dependencies"]. Missing capabilities use ["metaharness","edit","add",query]; research:true requests native approval for configured research, combining paper, pinned-repository and documentation sources. For paper methods first fetch actual PDF/text into native FS, then prefer ["metaharness","edit","add",query,"--paper",file,"--module",code,"--tests",tests] with current-Agent code. URL strings are not paper files. Omitting module/tests or revising a paper draft with --feedback calls the separately configured model, even when the parent imported code. No current-session credentials/settings are copied. Use add history [ID] for read-only inspection; --draft ID can research or retry installation checks. Follow the current review.phase, review.digest and nextActions, without assuming a fixed number of reviews. --accept in phase=produce confirms frozen production materials; phase=add reviews actual Entries and runs admission. completed=true only means registered: preserve ready/status and installationChecks. Unknown outcomes require receipt reconciliation, never automatic replay. Component review is not human Save, Host activation or task evaluation. Admission can execute code/tests and may require the native rc.2 runtime; generation alone does not require that runtime installed. Update/exclude/restore use the same isolated inventory. Retired entryedit/paper2plugin commands return migration guidance. Never use metaharness generate/assemble/run/feedback as a second creator runtime. Native search keeps its original query-record side effect beside the selected CLI package.
For a user-directed revision, first inspect the failed task and feedback. Fix the actual layer (input access, missing config/tool, source retrieval, workflow or output). stage(sourceRunId) snapshots its feedback/diagnostics with the new version. Do not claim positive improvement until the optional frozen comparison supports it. Build, use, save and comparative optimization remain separate intents.
For an explicit retry after revising the preset, run_task(sourceRunId,versionId,requestId) reuses the original input and snapshots without its old answer. Omit task and priorRunId. The source must be a resolved task in the same conversation/source agent; unknown outcomes cannot be replayed this way. This trial does not promote a version or prove improvement.
Frozen comparisons also accept tasks[].attachments:[{path,name,sha256?}]. At create/start_optimization, Creator reads inputs through native Agent FS and snapshots all cohort materials (100 MiB total). Both branches use identical copies; source-path changes after creation do not change the cohort. Missing/tampered snapshots block execution before fee approval, and post-run changes prevent acceptance. Old experiments without snapshots remain text-only; attachment declarations without snapshots must be recreated explicitly. Rubric review still judges final text, not independently viewed pixels or biomedical truth.
Existing source files: pass top-level sourceFiles={"index.js":"author/index.js","helper.mjs":"author/helper.mjs"} to create/stage. Native FS imports exact module bytes with hashes; JS/JSON syntax is checked without executing code before allocating a version. Keep modules separate. spec.files values are literal code, never paths. Test actual native input and output schemas, including empty/error results, before a model trial.
Task directories: generated Agent tools may import taskContext(ctx,exec) from ./creator-context.mjs, injecting fs and workingDirectory. Use its cwd/target/processPath in execute; artifact targets use output:true and remain in this task. Do not use process.cwd() as the Agent directory. The helper resolves paths; native FS and permissions still govern IO.
For a custom tool's text output use `await task.writeText(relativePath,text)`. It preserves native `fs/write-intent`, current execution-session policy, AbortSignal and `fs/observed`. Alpha.2 direct calls are `ctx.fs.writeText(target,text,intent,exec.signal,policy)`; omitting policy uses the backend default workspace, which may reject an otherwise valid task path. Never substitute bare node:fs to bypass that denial. Existing immutable bundles need an explicit staged revision to adopt a changed helper.
The native write outcome has `operation`, `version`, and LF-normalized `after` text for diffs. `after` is not the raw file bytes: comparing it directly against CRLF CSV wrongly reports failure. Preserve the intended output bytes, check the native receipt, and compare normalized text only when checking `after`; use actual final file bytes for hashes/checkers. Offline doubles must reproduce this normalization. A completed call and a tool's own `ok:true` are not independent validation; inspect explicit `ok:false` and the real deliverables.
Execution files live in a managed subdirectory of the parent's native writable workspace; snapshots and receipts remain in Creator storage. Never fix a write denial by changing permissions or writing into a different directory. An unavailable/read-only workspace stops file execution before model dispatch. Preflight samples[].name is the exact registered tool name, not a case label; install first. A busy Creator reports the active action and start time: wait for its existing receipt instead of repeated create/reconcile calls, Shell sleep or editing the lock.
Use deterministic code or an existing verified component for repeated numerical calculations and rule checks. Treat rounded values as intervals at their stated precision; distinguish possible display rounding from a proved mathematical error. Unexecuted arithmetic is not tool-verified computation.
For numerical and checker tools, assert missing/wrong-type/empty/non-finite/unsafe-integer inputs and rounding or cancellation boundaries, alongside normal cases. Zero applicable checks must not mean pass. Self-authored smoke tests need an independent counterexample/reference check; a correct result on one supplied dataset does not establish reusable correctness.
<!-- ‹guest · 2026-12-02› -->
For custom tools that create files, return a top-level JSON {ok:true,outputPaths:[relativePath,...]} with real final paths (at most 100), or the legacy outputPath for one file. These are candidates for guarded file discovery, not witnessed writes or validation. Only declare artifactChecks for a checker that consumes the exact final artifact text; auditing source/input JSON does not check generated CSV/Markdown bytes. Without a suitable final-byte checker, leave delivery unverified rather than making the producer its own checker.
Runtime observations distinguish a named Skill returned from this bundle (skill-loaded) from generic loader presence. A successful web_fetch returning a suspected CAPTCHA/challenge is recorded as challenge-page-suspected, not a source verification. These observations do not establish business correctness or medical validity.
Before create/stage, inspect preparedComponents. Select relevant bindings in spec.skills/mcps; record componentDecisions for relevant omitted entries. A prepared dependency is not yet an Agent capability. Final artifact checking uses spec.artifactChecks [{tool,inputField,passField}]: pass the exact final file text, render a JSON boolean result, and inspect the host-recorded hashes. Editing afterwards invalidates byte matching. Tool completion, valid external content, checker acceptance and comparative task quality are separate evidence.
### Modification scope and task-specific scoring
Stage defaults to `intervention:auto`. One repair hypothesis may require coordinated prompt, resource and runtime edits; freeze unrelated parts and measure only the joint effect. `contract.allowedChanges` is an optional nonempty subset of `prompts`, `domain-resources`, `runtime-controls`; omit it for automatic scope. Copy UI preferences into the contract or independent `evaluationSettings`. Known fields are checked structurally; shared source, dependencies and composition receive the existing Critic semantic screen, not a code sandbox. Legacy explicit intervention kinds keep their narrower bounds. Output repair remains a separate unchanged-spec path. User execution/fee boundaries and paired model identity cannot be widened by a revision.
New independent designs default `qualityFloor:null` (no absolute numeric floor), with concrete validity gates, comparable scoring and relative improvement still required. User-supplied task-specific numeric floors and old contracts keep their meaning; omitted legacy floors remain .8. Do not add a universal 80% claim. Patience is independently adjustable from 1 to 20; maxRounds remains an independent cap. UI settings enter a draft only; no automatic evaluation, fee authorization or Save.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.