@xdxer/dingtalk-agent 0.1.4-beta.14 → 0.1.4-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.en.md +97 -328
  3. package/README.md +94 -676
  4. package/dist/bin/dingtalk-agent.js +26 -5
  5. package/dist/bin/dingtalk-agent.js.map +1 -1
  6. package/dist/src/agent-audit.js +1005 -88
  7. package/dist/src/agent-audit.js.map +1 -1
  8. package/dist/src/agent-enhance.js +38 -6
  9. package/dist/src/agent-enhance.js.map +1 -1
  10. package/dist/src/agent-platform.js +49 -2
  11. package/dist/src/agent-platform.js.map +1 -1
  12. package/dist/src/development-workspace.js +4 -1
  13. package/dist/src/development-workspace.js.map +1 -1
  14. package/dist/src/instruction-path.js +270 -0
  15. package/dist/src/instruction-path.js.map +1 -0
  16. package/dist/src/opencode-evals.js +708 -224
  17. package/dist/src/opencode-evals.js.map +1 -1
  18. package/dist/src/opencode-isolation.js +124 -0
  19. package/dist/src/opencode-isolation.js.map +1 -0
  20. package/dist/src/opencode-provider.js +1 -0
  21. package/dist/src/opencode-provider.js.map +1 -1
  22. package/dist/src/opencode-workspace.js +21 -10
  23. package/dist/src/opencode-workspace.js.map +1 -1
  24. package/docs/assets/agent-delivery-lifecycle.svg +103 -0
  25. package/docs/schemas/project.schema.json +1 -0
  26. package/evals/README.md +17 -0
  27. package/lab/README.md +3 -3
  28. package/lab/agent-eval/classic-failures.json +7 -7
  29. package/lab/agent-eval/remote-state-workspace/opencode.json +1 -1
  30. package/lab/agent-eval/workspace/AGENTS.md +1 -1
  31. package/lab/robot-eval/suite.json +1 -1
  32. package/lab/robot-eval/workspace/AGENTS.md +1 -1
  33. package/package.json +2 -2
  34. package/skills/core/dingtalk-agent-compose/SKILL.md +21 -10
  35. package/skills/core/dingtalk-agent-compose/assets/AGENTS.template.md +24 -15
  36. package/skills/core/dingtalk-agent-compose/assets/role-skill.template.md +14 -6
  37. package/skills/core/dingtalk-agent-compose/evals/evals.json +17 -5
  38. package/skills/core/dingtalk-agent-compose/references/agent-definition-contract.md +3 -3
  39. package/skills/core/dingtalk-agent-compose/references/opencode-host-contract.md +17 -9
  40. package/skills/core/dingtalk-basic-behavior/SKILL.md +52 -111
  41. package/skills/core/dingtalk-basic-behavior/references/memory-and-evolution.md +12 -0
  42. package/skills/core/dingtalk-basic-behavior/references/risk-authority-and-privacy.md +62 -0
  43. package/skills/core/dingtalk-basic-behavior/references/task-lifecycle.md +15 -3
  44. package/skills/core/dingtalk-basic-behavior/references/truth-and-recovery.md +65 -0
  45. package/skills/platforms/multica-dingtalk/PLATFORM.md +1 -1
  46. package/dist/src/map.js +0 -157
  47. package/dist/src/map.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  All notable changes to `@xdxer/dingtalk-agent` are documented here. The project follows semantic versioning; prerelease entries describe release candidates and do not imply that Live canaries or registry publication have completed.
4
4
 
5
+ ## 0.1.4-beta.16 - 2026-07-20
6
+
7
+ ### Added
8
+
9
+ - Contract eval runner terminal UI: per-scenario progress lines with duration on stderr (live line rewriting and colors on a TTY, plain append-only lines in CI), a closing summary with the slowest scenarios, and a failure block per failed scenario listing the unmet expectations with truncated evidence plus actionable hints — the exact rerun command, the implementing function, the grading/output artifact paths, and the scenario fixtures. A scenario that throws now counts as all-expectations-failed and the suite keeps running, so one run surfaces every failure. stdout stays byte-stable (default JSON, `--smoke` four lines).
10
+ - Runner ergonomics: `--list` prints the scenario catalog; `--only` now accepts scenario names as well as ids (`--only=20,CliErrorHints`); malformed `--only` values fail with `错误:/提示:` guidance instead of running nothing.
11
+ - `evals/README.md` documenting the evals directory layout and the subset-first regression discipline (the full 61-scenario suite is a minutes-long deep-regression gate, not a per-change loop).
12
+ - Creation-inheritance contract from main: the four-part agent body template gains a Basic boot declaration, identity/authorization/privacy/completion bottom lines and a standard loop; the Compose skill and deterministic assertions are synced.
13
+
14
+ ### Changed
15
+
16
+ - Basic Behavior 0.11 / Compose 0.9 layered contracts: a slimmer entry point plus risk-authorization, privacy, fact-recovery and forgetting boundaries; the Compose agent body is fixed to definition, bottom lines, paradigm and common mistakes with Role/Gate layering and template audits.
17
+ - Inheritance and assembly gates hardened with OpenCode-native AGENTS rules, full Basic-tree integrity and isolated load probes, least-privilege defaults, raw-evidence retention and drift re-verification.
18
+ - The contract runner clears `evals/results/contract` only after arguments validate, so `--list` or a mistyped `--only` no longer wipes the previous run's evidence; result artifacts now carry scenario names in `summary.md` headers and `benchmark.json` eval names.
19
+ - README (zh/en) converged to positioning, quick start, core model, support scope and documentation entries; the multi-platform agent lifecycle narrative is completed and the three-step delivery path is redrawn as a native SVG, replacing the previous JPG assets.
20
+
21
+ ### Release boundary
22
+
23
+ - Distribution is limited to the public npm `beta` dist-tag, a Git tag, and a GitHub pre-release. The eval-runner terminal UI is repository tooling and does not ship in the package; the shipped deltas relative to beta.15 are the skill/template/README commits from main summarized above. Live waivers from beta.9 remain unchanged.
24
+
25
+ ## 0.1.4-beta.15 - 2026-07-19
26
+
27
+ ### Added
28
+
29
+ - Multica endpoint resolution and display: `agent-platform show|use` now print the resolved endpoint and its source unconditionally — even when multica is not installed or logged in — so you always know where you'd connect and how to switch. `resolveEndpoint()` uses a single source of truth aligned with the executor (`multica_ext.py` reads `MULTICA_SERVER_URL`/`--profile`): `MULTICA_SERVER_URL` env > project config (`dingtalk-agent.json#multicaEndpoint` or `.dingtalk-agent/agent-platform.json.endpoint`) > exactly one logged-in profile's server_url (multiple = ambiguous, never auto-picked) > the platform's suggested endpoint (pre, flagged unconfirmed, never a silent direct-connect). The login readiness hint emits a full copyable `multica login --server-url <resolved> --token ...` with the source annotated.
30
+ - The project manifest gains an optional `multicaEndpoint` field (schema + validation) for a persistent per-project endpoint override.
31
+
32
+ ### Changed
33
+
34
+ - Scattered pre-fde endpoint literals in `PLATFORM.md` and the compose skill now point to `dta agent-platform show` as the single source instead of hardcoding the URL, so docs cannot drift from the resolver.
35
+
36
+ ### Release boundary
37
+
38
+ - Distribution is limited to the public npm `beta` dist-tag, a Git tag, and a GitHub pre-release. The suggested endpoint is an explicitly-unconfirmed hint only; the executor stays fail-closed and deploy-time confirmation is unchanged. Live waivers from beta.9 remain unchanged.
39
+
5
40
  ## 0.1.4-beta.14 - 2026-07-19
6
41
 
7
42
  ### Added
package/README.en.md CHANGED
@@ -2,396 +2,165 @@
2
2
 
3
3
  # dingtalk-agent
4
4
 
5
- **A shared behavior kernel for DingTalk digital employees.**
5
+ **A verifiable behavior foundation for DingTalk digital employees.**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/%40xdxer%2Fdingtalk-agent?logo=npm&color=cb3837)](https://www.npmjs.com/package/@xdxer/dingtalk-agent)
8
8
  [![CI](https://github.com/D1-2004/dingtalk-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/D1-2004/dingtalk-agent/actions/workflows/ci.yml)
9
9
  [![Node.js](https://img.shields.io/node/v/%40xdxer%2Fdingtalk-agent)](https://nodejs.org/)
10
10
  [![License](https://img.shields.io/badge/license-MIT-2ea44f)](LICENSE)
11
11
 
12
- English · [简体中文](README.md)
12
+ [Quick start](#quick-start) · [How it works](#how-it-works) · [Support](#support) · [Docs](#docs)
13
13
 
14
- *This English README is a condensed overview; the Chinese README is the complete, authoritative reference.*
14
+ English · [简体中文](README.md)
15
15
 
16
16
  </div>
17
17
 
18
- ## What it is
19
-
20
- **DWS gives an Agent DingTalk system calls. dingtalk-agent (`dta`) gives every Agent an inheritable, frozen, and verifiable employee behavior kernel.** It does not own event delivery and does not duplicate DingTalk APIs. Starting from a normalized invocation, it organizes the Agent definition, perception enrichment, response eligibility, Session/Run state, action gates, and effect evidence into a Skill-first container.
21
-
22
- ```text
23
- Agent Host + dta Kernel + Agent Definition + Basic Behavior + Role Skills + DWS
24
- = a DingTalk digital employee that can keep working
25
- ```
18
+ `dingtalk-agent` (`dta`) is a **Skill-first behavior kernel and delivery toolchain** for DingTalk digital employees. It assembles role definition, shared behavior, role capabilities, and execution gates into an Agent Project that can be created, tested, promoted, and audited.
26
19
 
27
- | Layer | Owns | Does not own |
28
- |---|---|---|
29
- | Agent Definition | Identity, responsibilities, service scope, Skills, resources, authority | Current Run state or IDs guessed from message text |
30
- | Basic + Role Skills | When to reply, ask, stay silent, and how to perform role work | Bypassing identity, target, or effect gates |
31
- | dta Kernel | Invocation, enrichment, Session/Run/Wait, Action Gate, Receipt | Models, universal event listeners, or a second DWS |
32
- | DWS | DingTalk messages, docs, tasks, calendars, tables, and other product operations | Deciding whether an employee should act and on whose behalf |
20
+ > **Skills advise. The CLI gates. DWS acts.** Skills decide when and why to act; the CLI pins identity, target, budget, idempotency, and readback; DWS executes DingTalk capabilities.
33
21
 
34
- Claude Code, Codex, OpenCode, and other Agent Hosts can use the same kernel. Trigger adapters, models, sandboxes, Role Skills, and storage providers remain replaceable.
35
-
36
- ## Why it exists
37
-
38
- DWS is enough for occasional manual API operations. A digital employee that works over time also needs a maintained **body, state, and constrained action boundary**. Calling an API is not the same as behaving like a colleague. A reliable Agent must:
39
-
40
- - stay quiet in unmentioned group conversations and respond to direct messages or explicit mentions;
41
- - complete well-specified work directly and ask only one truly blocking question;
42
- - never guess recipients, identities, document IDs, or permissions from natural-language text;
43
- - acknowledge long work, wait for dependencies, and resume from a later event;
44
- - distinguish a command attempt, platform visibility, delivery, and human acceptance;
45
- - store task state, business memory, long-term knowledge, locks, and receipts in the right media.
46
-
47
- The boundary is: **Skills advise, the CLI enforces, and DWS executes.** Semantic judgment remains in Skills; invariants belong in code; DingTalk product operations stay in DWS.
48
-
49
- > `0.1.4-beta.11` is being released (npm `beta` dist-tag, Git tag, GitHub pre-release). beta.10 removed legacy dead code and aligned the entry docs; beta.11 installs all bundled Skills by default, fixes the compose Skill trigger, and introduces the managed agent platform abstraction (multica-dingtalk supported, deap coming soon; deploy/promote/observe require platform membership, and platform skill packs install on selection). The earlier beta.9 line includes the Basic 0.10.0/0.9.4 model regression, host-issued Completion Evidence, remote semantic-state cold-start and Live-ready runners, the developer Golden Path, safe enhancement of existing Agent repositories, Provider-bound Workspace W1–W5, Completion-grader hardening, a Phase 9 personal-event Live-ready runner, and isolated installation acceptance, the contract suite now covers 61 deterministic scenarios. Phase 8's recorded sample passed the safety and artifact gates that existed at the time, but did not prove a stable model-quality gain for 0.10.0. Phase 15 adds fail-closed contradictory-claim detection and a predeclared effectiveness policy without rewriting historical scores. Real personal-event, remote-state, and Multica Live were explicitly waived as release gates for this beta; local and fake-Provider evidence is not relabeled as real platform proof, and no Trigger or DingTalk/Multica side effect was created.
22
+ ![The complete path from Agent definition to delivery through two identity types](docs/assets/agent-delivery-lifecycle.svg)
50
23
 
51
24
  ## Quick start
52
25
 
53
- Requires Node.js 18.3 or later.
26
+ Requires Node.js 18.3+.
54
27
 
55
28
  ```bash
56
29
  npm install --global --prefix "$HOME/.local" \
57
30
  --registry=https://registry.npmjs.org @xdxer/dingtalk-agent@beta
58
- "$HOME/.local/bin/dta" setup --skip-cli-install
59
31
 
60
- dta --version
32
+ "$HOME/.local/bin/dta" setup --skip-cli-install
61
33
  dta doctor
62
34
  ```
63
35
 
64
- `setup` checks Node.js, DWS version and authentication, installs and verifies the bundled Skills (Basic Behavior + Compose), and reports whether Claude Code, Codex, and OpenCode can discover it. `listen` is an optional development adapter, not the mandatory Agent entry point.
36
+ `setup` installs the Basic Behavior and Compose Skills, then checks DWS authentication and common Agent Hosts. Normal sessions do not require Workspace initialization.
65
37
 
66
- For a source release candidate, run the deterministic tarball acceptance:
67
-
68
- ```bash
69
- npm run release:check
70
- ```
71
-
72
- It creates a real npm tarball, installs it offline into a fresh HOME/prefix, and exercises setup, doctor, direct bootstrap, a plan-only lab eval, forced upgrade from the same tarball, and explicit rollback dry-run. It uses fake DWS and skills-installer binaries only; it sends no DingTalk message, accesses no Multica resource, creates no Trigger, and performs no npm publish, Tag, or GitHub Release.
73
-
74
- ## Three runtime modes
75
-
76
- ### Direct Session
77
-
78
- No initialized Workspace is required. The Agent behaves as a normal colleague but does not invent identity, memory, targets, or DingTalk authority.
79
-
80
- ```bash
81
- dta bootstrap --json
82
- dta bootstrap --agent local-dir:/path/to/agent --json
83
- ```
84
-
85
- ### Mounted Session
86
-
87
- The Agent hydrates a local folder or a DingTalk document without requiring `init` on every session.
88
-
89
- ```bash
90
- dta bootstrap \
91
- --agent local-dir:/path/to/agent \
92
- --skills local-dir:/path/to/agent/skills \
93
- --memory local-md:MEMORY.md \
94
- --knowledge 'dingtalk-doc:<node-or-url>' --json
95
- ```
96
-
97
- ### Prepared Run
98
-
99
- A trusted host freezes the Invocation, Definition, Skills, target, budgets, and allowed actions. Message effects can only pass through the typed Broker or `dta act`.
100
-
101
- ## From one Agent to many
102
-
103
- Different employees should vary only in their Definition, Role Skills, field bindings, storage, and authority. They share Basic Behavior, Session/Run/Wait, the two-part gate, Receipt semantics, and the same Lab contract.
104
-
105
- A minimal Agent kit is:
106
-
107
- ```text
108
- my-agent/
109
- ├── AGENTS.md identity, responsibilities, deliverables, boundaries
110
- ├── agent.bindings.json Definition and semantic-storage routes
111
- ├── opencode.json Host loading contract
112
- ├── .agents/skills/ Host-visible Skill exposure
113
- ├── skills/<role>/SKILL.md role-specific methods
114
- ├── MEMORY.md reviewed semantic memory
115
- ├── knowledge/INDEX.md knowledge entry point
116
- └── .dingtalk-agent/artifacts/ independently verifiable deliverables
117
- ```
118
-
119
- Use the bundled [`dingtalk-agent-compose`](skills/dingtalk-agent-compose/SKILL.md) Skill to audit and assemble a Git checkout or local folder as an Agent, optionally binding semantic state to DingTalk documents. Basic Behavior must be forced into every Host session; directory discovery alone is not proof that the Skill body was loaded.
120
-
121
- The recommended definition stays local and versioned: `AGENTS.md + Role Skills`. `agent.bindings@1` routes memory and knowledge either to local Markdown or dedicated DingTalk documents, while artifacts and private control state stay local. The shortest acceptance path is:
122
-
123
- ```bash
124
- # Plan only: no local write, DWS access, or Trigger creation.
125
- dta agent enhance --project-name release-agent \
126
- --role-skill release-manager --dry-run --json
127
-
128
- # Review operations/blockers/semanticReview, then use the current plan ID.
129
- dta agent enhance --project-name release-agent \
130
- --role-skill release-manager \
131
- --plan-id <current-plan-id> --yes --json
132
-
133
- dta bootstrap --bindings agent.bindings.json --json
134
-
135
- # Static only: no model and no DWS. Gaps return partial and exit code 2.
136
- dta agent audit --bindings agent.bindings.json \
137
- --require-skill <role-skill-name> --json
138
-
139
- # Isolated OpenCode load probe; still no DingTalk access.
140
- dta agent audit --bindings agent.bindings.json \
141
- --require-skill <role-skill-name> --verify-load --yes --json
142
- ```
143
-
144
- This chain has been dogfooded once with `examples/agents/release-manager`. On OpenCode 1.17.14 and `deepseek/deepseek-chat`, the with-skill random probe loaded exactly 1/1, the without-skill control did not guess it 1/1, and the final audit moved from `partial` with only `host.load-probe` missing to `ready`. This proves that the assembly and load path works for that fixture; it does not prove domain-task quality or a stable behavior gain. See the [sanitized dogfood summary](evals/baselines/2026-07-17/agent-enhance-opencode-dogfood-summary.json).
145
-
146
- `agent enhance` merges rather than blindly overwriting an existing repository. Before updating an old file it creates an operation-scoped backup under `.dingtalk-agent/backups/agent-enhance/<operationId>/`, and a custom `stateDir` is added to `.gitignore`; a stale plan, source drift, invalid Role path, unknown OpenCode instruction entry, path escape, or symlink fails before replacement. Apply has local-file side effects only. Generated body and Role Skill templates intentionally remain `partial` until real identity, responsibilities, deliverables, refusal boundaries, domain SOPs, and acceptance criteria replace every placeholder. Thus a ready [`agent-enhancement-plan@1`](docs/schemas/agent-enhancement-plan.schema.json) means “safe to apply,” not “the Agent is ready”; [`agent-enhancement-receipt@1`](docs/schemas/agent-enhancement-receipt.schema.json) carries the follow-up audit gaps.
38
+ ## Why it exists
147
39
 
148
- `agent-audit@1` separates Definition, Storage, Host exposure, and actual loading. A remote memory/knowledge binding remains `partial` until an authorized storage evaluation proves identity, document type, hashes, independent readback, and model use and its report is supplied with `--remote-report`. Local cache presence is never remote proof; Wait, generation, idempotency, Receipts, and credentials remain in the host atomic store.
40
+ A model that can talk is not yet a reliable digital employee. `dta` turns the parts most likely to drift into inherited, verifiable contracts:
149
41
 
150
- ### One Project, multiple development Workspaces
42
+ - **Response judgment:** decide whether to respond before deciding what to say; stay silent in an unmentioned group chat by default.
43
+ - **Authority boundaries:** never infer identity, target, permission, authorization, or reply channel from message text or model memory.
44
+ - **Evidence-backed completion:** command success, platform visibility, delivery, and human acceptance are different states.
45
+ - **Reuse:** new Agents inherit shared behavior and add only role-specific differences instead of copying a giant prompt.
151
46
 
152
- `agent.bindings.json` describes the Agent body and storage routes. A root-level [`dingtalk-agent.json`](docs/schemas/project.schema.json) declares where the same Agent is developed. Each Development Workspace binds exactly one Host Provider, while memory, knowledge, and artifacts remain independent Storage bindings.
47
+ ## How it works
153
48
 
154
- ```text
155
- Agent Project
156
- ├── local-dev ── Host: OpenCode ── Storage: local-md/local-dir
157
- ├── multica-dev ── Host: Multica ── Storage: dingtalk-doc/local-dir
158
- └── legacy-prepared ── read-only view of the existing workspace@1
159
- ```
49
+ An Agent is assembled from four contract layers:
160
50
 
161
- W1 exposes a read-only control plane:
51
+ | Layer | Responsibility |
52
+ |---|---|
53
+ | **`AGENTS.md`** | Role, role-specific boundaries, operating pattern, common mistakes, and the Basic startup anchor |
54
+ | **Basic Behavior** | Shared response eligibility, scope, authorization, privacy, completion, and memory behavior |
55
+ | **Role Skills** | Domain judgment, procedure, prohibited actions, and acceptance criteria |
56
+ | **Gate + Receipt** | Hard constraints for identity, target, budget, idempotency, state transitions, and platform readback |
162
57
 
163
- ```bash
164
- dta info --json
165
- dta workspace list --json
166
- dta workspace show local-dev --json
167
- dta workspace doctor local-dev --json
168
- ```
58
+ The Prompt keeps only what must remain resident and precisely defined. The full behavior tree belongs in Skills. Constraints that cannot rely on model discretion belong in the Gate.
169
59
 
170
- The CLI discovers the Project from any child directory and reports Provider configuration sources, `desiredHash/observedHash`, and [`workspace-state@1`](docs/schemas/workspace-state.schema.json). Doctor inspects only the named Workspace: a missing Multica installation cannot make `local-dev` fail, while Provider, source, managed bytes, or desired-state drift fails closed.
60
+ ### Create test promote
171
61
 
172
- OpenCode W2 adds a managed development environment. `create` is plan-only by default; `--yes` atomically materializes a gitignored copy and independently hashes it. `run/eval` use external temporary sandboxes. Provider state becomes `ready` only after the random Basic load probe, exported Session directory, and hard evidence gates pass.
62
+ | Stage | Main artifact | Gate |
63
+ |---|---|---|
64
+ | **Create** | `AGENTS.md`, Basic, Role Skills, bindings | Unresolved placeholders keep the project `partial` |
65
+ | **Test** | Isolated Workspace, load probe, behavior eval, four evidence surfaces | A project cannot become ready without proven Definition/Skill loading |
66
+ | **Promote** | Platform preflight, deployment Receipt, remote readback | Missing designated Eval evidence or identity chain blocks promotion |
67
+ | **Operate** | Digital-employee account or robot entry point, task trace | No claim of write, delivery, or completion without matching evidence |
173
68
 
174
69
  ```bash
175
- dta workspace create local-dev --dry-run --json
176
- dta workspace create local-dev --yes --json
177
- dta workspace use local-dev --json
178
- dta workspace run local-dev --prompt-file prompt.md --execute --yes --json
179
- dta workspace eval local-dev --suite evals/core.json --runs 3 --execute --yes --json
180
- ```
181
-
182
- `workspace run` is zero-tool. File and Artifact tools are available only through case-scoped eval permissions. W2 writes local managed Workspace, selection, state, and evidence, but never calls DWS. CI, evaluations, and future deploy flows must select the Workspace explicitly rather than rely on `current-workspace`.
70
+ # 1. Generate a zero-write plan, then apply it explicitly
71
+ dta agent enhance --project-name release-agent --role-skill release-manager --dry-run --json
72
+ dta agent enhance --project-name release-agent --role-skill release-manager \
73
+ --plan-id <plan-id> --yes --json
183
74
 
184
- Multica W3 first exposes controlled remote reads. `plan` never starts Multica. After explicit confirmation, `inspect/remote-list` use the declared profile, Workspace ID, Runtime ID, and optional Agent ID to read auth, Workspace, Runtime, Agent, Skill catalog, and assignments. An existing Agent must be bound by `agentIdFrom` or trusted prior state and is never adopted by display name.
75
+ # 2. Audit, run, and evaluate
76
+ dta agent audit --bindings agent.bindings.json --require-skill release-manager --json
77
+ dta workspace run local-dev --json
78
+ dta workspace eval local-dev --json
185
79
 
186
- ```bash
187
- dta workspace plan multica-dev --json
80
+ # 3. Inspect, promote, and observe
188
81
  dta workspace inspect multica-dev --execute --yes --json
189
82
  dta workspace remote-list multica-dev --execute --yes --json
190
- dta workspace status multica-dev --json
191
- ```
192
-
193
- Evidence retains only minimum resource facts and raw-output hashes; it excludes tokens, email, cleartext Server URLs, Agent instructions/runtime config, and Skill content. Identity, default Workspace, scope, stable IDs, Skill uniqueness, and evidence hashes all fail closed. A successful inspection leaves state at `verifying`: `readyForApply=true` only means W4 planning may start.
194
-
195
- W4 turns that trusted inspection into a plan-bound apply through `dta deploy`. Dry-run freezes the profile, Workspace, Runtime, Agent, Definition, complete Skill-tree hashes, and maximum forward/rollback write budgets; apply re-reads the same ID chain. Only the current `--plan-id` plus explicit `--yes` may create or update remote resources. The CLI synchronizes managed Boot, Basic, and Role Skill trees and the exact assignment, then uses a dedicated Issue to independently read the Skill tool trace and an exact JSON response. Both must pass before state can move from `verifying` to `ready`.
196
-
197
- ```bash
198
- dta deploy --workspace multica-dev --dry-run --json
199
- dta deploy --workspace multica-dev --plan-id <plan-id> --yes --json
200
- dta deploy --workspace multica-dev --status --json
201
- dta deploy --workspace multica-dev --status --execute --yes --json
202
- dta deploy --workspace multica-dev --list --json
203
- dta deploy --workspace multica-dev --retire --dry-run --json
204
- dta deploy --workspace multica-dev --retire --plan-id <plan-id> --yes --json
205
- ```
206
-
207
- A timed-out write persists its operation/Receipt and enters `reconciling`; status performs independent reads rather than retrying or rolling back an ambiguous action. If Agent create returned no ID, recovery reads candidates by stable ID and binds only one exact instructions/runtime fingerprint match, never a display name alone. Confirmed failures roll back only changes managed by the current operation. Retire archives the exact Agent without deleting Skills, Issues, semantic storage, or evidence history. Deploy never creates a robot, webhook, schedule, or other Trigger. The `dingtalk-agent-deploy-multica` Skill only guides these stable CLI calls; it does not write through Multica directly or retain credentials.
208
-
209
- W5 links designated W2 Eval evidence to a W4 Receipt as an explicit Promotion chain. A policy freezes source/target Workspaces, suite, minimum runs, required cases, and evidence surfaces. Dry-run recomputes the Definition/Skill, managed Workspace, plan/suite/report, and deployment hashes without Provider calls. Only the current planId plus explicit confirmation may delegate to W4 deploy. The resulting Promotion Receipt binds source, Eval, the historical deployment Receipt, and the final observed hash.
210
-
211
- ```bash
212
- dta promote --policy promotion-policy.json --route local-dev-to-multica-dev --dry-run --json
213
- dta promote --policy promotion-policy.json --route local-dev-to-multica-dev \
214
- --plan-id <plan-id> --yes --json
215
- dta promote --status --promotion-id <promotion-id> --json
216
- dta promote --list --json
83
+ dta promote --source local-dev --target multica-dev --dry-run --json
84
+ dta observe --promotion-id <promotion-id> --input <observation.json> --dry-run --json
217
85
  ```
218
86
 
219
- `observe` accepts only redacted feedback whose `observedHash` exactly matches a promoted Receipt. It writes one gitignored Eval candidate fixed as `proposed`, review-required, suite-ineligible, and unpublished. It never changes AGENTS.md, prompts, Basic/Role Skills, or Triggers.
220
-
221
- ```bash
222
- dta observe --promotion-id <promotion-id> --input observation.json --dry-run --json
223
- dta observe --promotion-id <promotion-id> --input observation.json --yes --json
224
- ```
225
-
226
- See the reusable two-Provider fixture at [`lab/project-workspace/project.fixture.json`](lab/project-workspace/project.fixture.json), the redacted read-only fixture at [`multica-readonly.fixture.json`](lab/project-workspace/multica-readonly.fixture.json), the W4 stateful fake data at [`multica-deploy.fixture.json`](lab/project-workspace/multica-deploy.fixture.json), and the W5 [`promotion-policy.fixture.json`](lab/project-workspace/promotion-policy.fixture.json). Manifests and state reject credential-like fields; `*From` fields preserve only `env:VAR` sources, never resolved values. The current contract proves local orchestration and fail-closed behavior; it does not claim that a real Multica Live apply or promotion has passed.
227
-
228
- ## Employee task protocol
229
-
230
- ![Employee task loop and completion gate](docs/architecture/task-completion-gate.svg)
231
-
232
- ```text
233
- UNDERSTAND → CLARIFY → PLAN → EXECUTE → WAIT → VERIFY → COMPLETE
234
- ```
235
-
236
- `CLARIFY` is a conditional branch, not a mandatory opening question. The Agent first forms an internal task contract—goal, deliverable, scope, observable done conditions, authority, and timing—then asks one question only when a gap blocks safe progress.
237
-
238
- `COMPLETE` is evidence-gated rather than self-declared. A cross-Run task must move from `working` to `verifying`; every `doneWhen` condition must map to a file check, Workspace/Artifact assertion, Action Receipt, independent platform readback, or human confirmation. A reply that says “created” is not evidence. The CLI rejects `working → completed` and any completed checkpoint without verification evidence.
239
-
240
- ## Identity and delegation
241
-
242
- The role identity and the sandbox execution identity are separate:
243
-
244
- - the role identity says who the employee is, what it owns, whom it serves, and who delegated the work;
245
- - the execution identity is the trusted DWS profile used for platform effects;
246
- - if they represent the same subject, it is the Agent's own identity;
247
- - if they differ, the Definition must make the delegation explicit and the Action Gate must keep the delegated scope narrow.
87
+ Plans are zero-write by default. Remote writes require an explicit target, the current `planId`, and confirmation.
248
88
 
249
- Neither identity can be replaced by a display name, message body, or model memory.
89
+ ## Support
250
90
 
251
- ## The two-part gate
91
+ ### Platforms, Harnesses, and runtimes
252
92
 
253
- The safety half prevents wrong actions: response eligibility, trusted identity and target, one egress owner, action budgets, idempotency, and readback.
93
+ These are separate concepts:
254
94
 
255
- The empathy half supplies context a colleague naturally has: quoted messages, recent conversation burst, attachments, readable identity, status, and interruption context. Enrichment improves decisions but never expands authority.
95
+ - A **Managed Agent Platform** owns Workspace, Runtime, Agent, Skill, identity binding, and observation.
96
+ - An **Agent Harness** loads Definition/Skills, isolates execution, and captures evidence.
97
+ - The **dta Kernel** depends on a shared contract, not a specific Harness prompt or private directory layout.
256
98
 
257
- ## Three semantic memory layers
99
+ | Dimension | Current support |
100
+ |---|---|
101
+ | **Managed Platform** | Multica (DingTalk) supported; DEAP coming soon; additional platforms through registry + adapters |
102
+ | **Local runtime** | Direct/Mounted sessions in Claude Code, Codex, OpenCode, and similar Hosts; OpenCode is the current complete local managed-Harness reference |
103
+ | **Cloud runtime** | Multica Workspace / Runtime / Agent with the same Definition, Skills, Gate, and evidence contract |
104
+ | **Delivery identity** | Digital-employee/account identity or robot-app identity; neither expands the Agent role or authority |
258
105
 
259
- | Layer | Typical medium | Content |
260
- |---|---|---|
261
- | L1 task memory | Session checkpoint | Current goal, progress, next step, wait condition, evidence |
262
- | L2 operational memory | AI table, task, calendar, business system | Structured and aggregatable working facts |
263
- | L3 long-term knowledge | DingTalk docs, knowledge base, wiki | Reviewed methods, stable facts, SOPs, lessons |
264
-
265
- Control state is separate: event dedupe, leases, generation, idempotency keys, budgets, Wait, and Receipts require an atomic host store. Markdown, DingTalk documents, and Git are not transaction or lock services.
106
+ OpenCode is not a runtime dependency, and Multica is not a privileged bypass. Any promotable Harness must prove the same outcomes: loaded Definition and Skills, pinned identity and isolation, retrievable execution trace, and independent readback.
266
107
 
267
- ## Real-world Lab
108
+ “Multi-platform” means the architecture, registry, and adapter contract are extensible. It does not claim that unopened platforms have been deployed or Live-verified.
268
109
 
269
- Evaluation progresses through five levels:
110
+ ### Runtime modes
270
111
 
271
- | Level | Environment | Evidence |
112
+ | Mode | Use | Boundary |
272
113
  |---|---|---|
273
- | L0 | fixtures + real CLI | Contracts, state machines, target integrity, idempotency |
274
- | L1 | model shadow | Skill loading and behavioral gain, without DingTalk effects |
275
- | L2 | fake DWS + real Action Gate | Intent/Attempt/Receipt, readback, recovery |
276
- | L3 | dedicated robot connector | Real connection, Workspace, expression, delivery, teardown |
277
- | L4 | test colleague/group + personal event + dta Broker | Full envelope, identity, target, Wait/Resume, single egress |
278
-
279
- Live runs require dedicated resources, allowlists, unique markers, fixed budgets, independent platform readback, and exact teardown. A robot response does not prove the personal-event envelope or dta-owned egress.
280
-
281
- The [`personal-event-eval@1`](lab/schemas/personal-event-eval.schema.json) suite binds Basic + Role Skills, response eligibility, Wait/Resume, duplicate delivery, Perception, Receipts, and teardown into one evidence chain. Event capture remains external; dta does not create a subscription or trigger. The default command is plan-only. Execution requires both `liveAuthorized=yes` in the local suite and all CLI confirmations:
282
-
283
- ```bash
284
- dta lab eval --engine personal-event \
285
- --workspace <agent-workspace> \
286
- --suite .dingtalk-agent/personal-event-live.local.json --json
287
-
288
- dta lab eval --engine personal-event \
289
- --workspace <agent-workspace> \
290
- --suite .dingtalk-agent/personal-event-live.local.json \
291
- --execute --live --yes --json
292
- ```
293
-
294
- See the placeholder [`personal-event-live.example.json`](lab/agent-eval/personal-event-live.example.json) and the sanitized local [`personal-event-live-readiness-summary.json`](evals/baselines/2026-07-17/personal-event-live-readiness-summary.json). Each reply must independently read back the exact body under the same message ID; a duplicate must reuse the original Run, Action, and Attempt with no new egress. The fake-DWS contract passes 8/8 scenarios, seven physical Runs, and five new outward effects, while rejecting a readback with the correct ID but rewritten body. That proves runner readiness, not a real personal-event delivery.
295
-
296
- ```bash
297
- # OpenCode plan only
298
- dta lab eval --engine opencode \
299
- --workspace lab/robot-eval/workspace \
300
- --suite lab/robot-eval/suite.json --lanes stateless --runs 3 --json
301
-
302
- # Fixed model, isolated Workspace, no DingTalk side effects
303
- dta lab eval --engine opencode \
304
- --workspace lab/robot-eval/workspace \
305
- --suite lab/robot-eval/suite.json --lanes stateless --runs 3 \
306
- --execute --yes --json
307
- ```
308
-
309
- ## Evaluation as a reusable Skill
310
-
311
- The bundled [`dingtalk-agent-eval`](skills/dingtalk-agent-eval/SKILL.md) Skill defines the complete workflow: identify the Definition, prove Basic Skill loading, select a stable scenario, isolate execution, collect multiple evidence surfaces, apply hard gates, and only then score quality.
312
-
313
- Scenarios are grouped by the condition they can break, not by date or role:
114
+ | **Direct Session** | Normal interactive work | Never guess an outbound target without a trusted event |
115
+ | **Mounted Session** | Mount local or DingTalk semantic content | Locks, idempotency, and Receipts do not live in Markdown |
116
+ | **Prepared Run** | Reliable event-driven side effects | Actions go only through the typed Broker or `dta act` |
314
117
 
315
- 1. `host-loading`
316
- 2. `conversation-contract`
317
- 3. `authority-and-egress`
318
- 4. `task-lifecycle`
319
- 5. `memory-and-storage`
320
- 6. `workspace-and-artifacts`
321
- 7. `platform-reliability`
118
+ Prepared Runs expose four message atoms: `ack`, `reply`, `ask`, and `silence`. An acknowledgement is not task acceptance, and a reply is not human acceptance.
322
119
 
323
- The repository catalog is [`lab/agent-eval/catalog.json`](lab/agent-eval/catalog.json). A reply is only one evidence surface. Cases can also require filesystem paths and contents, a valid Agent Workspace, artifact manifests and hashes, Receipts, or independent DWS readback. A failed load, safety, or integrity gate cannot be averaged away by a high quality score.
120
+ ## What a generated Agent inherits
324
121
 
325
- Run the classic incident suite or select individual cases:
326
-
327
- ```bash
328
- dta lab eval --engine opencode \
329
- --workspace lab/agent-eval/workspace \
330
- --suite lab/agent-eval/classic-failures.json \
331
- --cases requester-only-authorization,workspace-artifact \
332
- --runs 1 --execute --yes --json
333
- ```
334
-
335
- The 2026-07-16 OpenCode 1.17.14 + DeepSeek development regression covers nine classic cases. Basic 0.9.4 passed its load gate. Eight cases passed in the full run; the only correct refusal missed a phrase-only grader and passed a targeted rerun after the grader changed to a bounded regex plus independent reason and exclusion checks. The artifact case allowed only `read/write/edit` and actually used only `write`; it passed all seven Workspace/Artifact/Filesystem postconditions and copied two hashed outputs into the evidence bundle. Writable sandboxes live under a system temporary root outside the repository; the runner canonicalizes and audits every tool path so OpenCode cannot resolve a relative write against a parent Git checkout. This is combined 9/9 passing evidence, not a claim of one statistically significant run. See the [sanitized multi-surface summary](evals/baselines/2026-07-16/opencode-multi-surface-summary.json).
336
-
337
- The same local `AGENTS.md + Skills` can be evaluated with local semantic state or with `memory` and `knowledge` hydrated from `dingtalk-doc:`:
338
-
339
- ```bash
340
- cp lab/agent-eval/remote-state.example.json \
341
- .dingtalk-agent/remote-state.local.json
342
-
343
- # Plan only: no DWS read and no model call
344
- dta lab eval --engine storage \
345
- --workspace lab/agent-eval/remote-state-workspace \
346
- --suite .dingtalk-agent/remote-state.local.json --json
347
-
348
- # Read two dedicated documents and evaluate OpenCode; --live adds one unique write probe
349
- dta lab eval --engine storage \
350
- --workspace lab/agent-eval/remote-state-workspace \
351
- --suite .dingtalk-agent/remote-state.local.json \
352
- --execute --live --yes --json
122
+ ```text
123
+ my-agent/
124
+ ├── AGENTS.md Role constitution + Basic inheritance anchor
125
+ ├── agent.bindings.json Definition and storage routing
126
+ ├── dingtalk-agent.json Agent Project desired state
127
+ ├── .agents/skills/
128
+ │ ├── dingtalk-basic-behavior/ Complete shared behavior tree
129
+ │ └── <role>/ Host-discoverable Role Skill
130
+ ├── skills/<role>/SKILL.md Versioned role capability source
131
+ └── .dingtalk-agent/ Private state, evidence, and Receipts
353
132
  ```
354
133
 
355
- The 2026-07-16 live DWS canary used two dedicated `adoc` documents. The local Definition was ready, Basic 0.9.4 was forced through OpenCode instructions, both remote/mount/cache/manifest hashes matched, and DeepSeek returned two remote-only probe values with zero tools. One append marker was verified exactly once through a full-document readback. Deterministic contracts also reject a wrong DWS identity, a non-adoc node, and post-bootstrap drift. The first byte-level marker check produced a false negative because DingTalk escaped Markdown punctuation; the runner now counts the normalized text stream and never treats a command response as proof. See the [sanitized remote-state summary](evals/baselines/2026-07-16/remote-state-live-summary.json).
134
+ The generated `AGENTS.md` keeps four atomic contracts: **definition, non-negotiable boundaries, operating pattern, and common mistakes**. It also says to apply `dingtalk-basic-behavior` before loading task-relevant Role Skills.
356
135
 
357
- Remote Markdown remains semantic state; private control state stays in the host's atomic store. The evaluator does not infer permission to delete its dedicated test documents.
358
-
359
- ## Development and verification
136
+ File presence is not inheritance evidence. `agent audit --verify-load` binds real load results to Definition/Skill hashes, Host/model versions, isolated probes, and raw run/export evidence:
360
137
 
361
138
  ```bash
362
- npm ci
363
- npm run typecheck
364
- npm run eval:contract
365
- npm pack --dry-run
139
+ dta agent audit \
140
+ --bindings agent.bindings.json \
141
+ --require-skill <role-skill-name> \
142
+ --verify-load --yes --json
366
143
  ```
367
144
 
368
- The 60-case deterministic suite also covers `agent-bindings@1`, plan-bound enhancement with backups and semantic-placeholder gates, precise partial-to-ready repairs, OpenCode load evidence bound to the current Definition and Host exposure, two-process L1/L2/L3 remote semantic-state recovery, a default-safe Phase 11B Live runner, the Phase 9 personal-event evidence chain, fail-closed identity/type/drift/slot/cache checks, replication of a second isolated Role Agent without kernel changes, multi-Provider Project/Workspace isolation, Workspace-bound OpenCode materialization/run/eval, Multica W3–W5 orchestration, isolated npm-tarball readiness, negation-aware completion claims, and predeclared comparison policies. A passing comparison policy is a deterministic release gate, not statistical significance or proof of a stable model gain.
369
-
370
- See [Self-test and evolution](docs/SELF-TEST.md), [Architecture](docs/ARCHITECTURE.md), and the [implementation plan](docs/plans/2026-07-16/eval-test-skill-and-remote-state.md).
145
+ ## Non-negotiable boundaries
371
146
 
372
- ## Project layout
373
-
374
- ```text
375
- bin/ CLI composition root
376
- src/ TypeScript runtime
377
- skills/dingtalk-basic-behavior/ shared employee behavior
378
- skills/dingtalk-agent-compose/ Agent assembly and optimization
379
- skills/dingtalk-agent-eval/ scenario, evidence, and promotion method
380
- examples/agents/ reusable role kits
381
- lab/ catalogs, manifests, schemas, and runbooks
382
- evals/ deterministic and model evaluations
383
- docs/ architecture and decisions
384
- ```
147
+ - Normal sessions never auto-run `dingtalk-agent init`.
148
+ - Target, actor, conversation, DWS profile, and permissions come only from a trusted Host or event.
149
+ - Prepared Run messaging goes only through a typed Broker or `dta act`; it cannot bypass the Gate.
150
+ - An online Run may propose memory or Skill candidates, but cannot hot-modify current identity, permission, or policy.
151
+ - Model claims, process exit 0, platform-visible writes, delivery, and human acceptance require separate evidence.
385
152
 
386
- ## Current boundaries
153
+ ## Docs
387
154
 
388
- - Event listeners and schedulers are outside the kernel.
389
- - Workspace initialization is optional and never automatic per session.
390
- - dta does not duplicate the DWS command surface.
391
- - DingTalk documents do not store locks, idempotency, generation, or effect receipts.
392
- - Online Runs cannot hot-expand identity, authority, or enabled Skills.
393
- - `bootstrap` hydrates `dingtalk-doc` as a read-only snapshot; remote publication requires explicit authorization and readback.
155
+ | Goal | Start here |
156
+ |---|---|
157
+ | Understand architecture and state | [Architecture](docs/ARCHITECTURE.md) |
158
+ | Install, upgrade, or troubleshoot | [Installation](docs/INSTALLATION.md) |
159
+ | Understand evaluation and evidence levels | [Self-test](docs/SELF-TEST.md) |
160
+ | Create or audit an Agent | [Compose Skill](skills/core/dingtalk-agent-compose/SKILL.md) |
161
+ | Read the shared behavior protocol | [Basic Behavior Skill](skills/core/dingtalk-basic-behavior/SKILL.md) |
162
+ | Copy a complete example | [Example Agents](examples/agents) |
394
163
 
395
- ## License
164
+ Behavior assets come from observable contracts, counterexample-driven revision, and deployable verification. This project does not claim access to any product's hidden system prompt.
396
165
 
397
- [MIT](LICENSE)
166
+ MIT License