@abelxiaoxing/cadence 2.0.20 → 2.0.21

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.
@@ -0,0 +1,104 @@
1
+ # Cadence conversation mode
2
+
3
+ In a trusted Pi terminal or a WebUI conversation in an explicitly selected project, enter `/cadence <goal>` once (or `/cadence` to discuss the goal).
4
+ Cadence stays enabled for the entire conversation, including after a goal finishes.
5
+ Continue using normal messages; do not repeat the command for clarification or another goal.
6
+ Type `退出 Cadence` or `exit cadence` to leave the mode explicitly.
7
+ Leaving, closing Pi/browser and switching conversations detach; they do not cancel accepted work.
8
+ Browser conversation mode is retained by the project owner, not by a browser-only toggle, and works without a live Pi terminal.
9
+
10
+ ## Normal path
11
+
12
+ 1. Cadence delegates focused readonly repository investigations, reuses existing project documentation, and consolidates questions in the main conversation.
13
+ 2. Discuss requirements and decisions until the implementation and acceptance criteria are clear.
14
+ 3. Cadence presents one readable plan: scope, dependencies, setup, baseline checks, acceptance checks, repair budget and delivery policy.
15
+ 4. Type `按计划实施` after the plan to authorize those exact bytes.
16
+ In the browser, click **Implement this plan** or send that exact approval phrase for the currently displayed plan.
17
+ In Pi, the Start tool can alternatively present one native confirmation of the complete plan.
18
+ Native confirmation retains its raw-terminal guard.
19
+ Quoted/generated text, an old session entry and vague agreement are not approval; browser authentication alone is not consent.
20
+ 5. The persistent owner implements, reviews, verifies and delivers within that boundary.
21
+ Routine internal steps do not ask for more approval.
22
+ 6. Completion returns the conversation to Cadence **ready**, not ordinary mode.
23
+ Ask for status, more detail, cancellation, or the next goal normally.
24
+
25
+ Native mode is branch-aware; browser mode follows its server-owned conversation identity.
26
+ Resume and compaction retain the mode/context, not execution grants.
27
+ Opening a different conversation does not enable Cadence there.
28
+ Restore never replays a command or automatically resumes an interrupted queue.
29
+ When an observation reply is lost, ask for status; do not infer that the action was absent.
30
+
31
+ ## Models and project knowledge
32
+
33
+ The first native use defaults to the current Pi provider/model/API/thinking selection.
34
+ The selected preference is remembered in `<agent-dir>/cadence/settings.json` (normally `~/.pi/agent/cadence/settings.json`) and reused across projects.
35
+ Ask Cadence to change its model in Pi, or use **Model** in the browser.
36
+ The browser restores an available saved preference on explicit Send; reads/login do not install a choice.
37
+ If no usable preference exists, choose once.
38
+ An accepted run keeps its original exact model.
39
+ An unavailable remembered model is not silently substituted.
40
+ Pi's original model and authentication sources remain authoritative; Cadence does not copy credentials.
41
+
42
+ Repository investigation and discussion do not edit business code.
43
+ Approved work publishes a managed region in `.cadence/project.md` and readable plan/result notes under `.cadence/assistant/workflows/<run-id>/`.
44
+ Existing human text outside the managed region is preserved.
45
+ Existing architecture and development documents should be referenced, not duplicated.
46
+ Each worker receives the approved goal/design/decisions/acceptance and its exact assignment; oversized context is refused rather than silently clipped.
47
+ Private proposals, grants, native/auth outcomes and transcripts stay outside the checkout.
48
+ Markdown is not execution authority.
49
+ Old task summaries and history are neither imported nor reset.
50
+
51
+ ## Execution and delivery
52
+
53
+ The plan chooses one delivery policy:
54
+
55
+ - **Local merge:** requires an existing Git branch and configured commit identity.
56
+ Independent tasks use separate worktrees, up to two at once; dependencies are applied before their consumers.
57
+ The owner commits only declared file changes, integrates them into a separate candidate, runs independent readonly Agent review and real checks, then fast-forwards the unchanged target branch.
58
+ Local task commits and the merge are included in the plan approval.
59
+ Git hooks and commit signing are disabled for these internal commits; verification is explicitly declared instead.
60
+ No remote push occurs.
61
+ - **Working copy:** explicit direct host-tool editing, serialized, including for non-Git directories.
62
+ No commit or merge.
63
+ Failed or canceled work leaves actual edits in place; this is not transactional application or a sandbox.
64
+
65
+ A local-merge plan does not adopt existing dirty inputs into its committed baseline.
66
+ Dirty declared targets refuse before implementation; unrelated user changes are preserved and rechecked before integration.
67
+ Unresolved conflicts or a changed target stop integration.
68
+ Cadence never resets, stashes, force-pushes or silently cleans uncertain worktrees.
69
+ Ignored generated Markdown remains ignored and is published without forcing it into Git.
70
+ Worktrees and all results are retained; there is no automatic eviction/cleanup.
71
+
72
+ An isolated worktree does **not** inherit ignored `node_modules`, build output, credentials or profiles.
73
+ Investigate prerequisites during planning.
74
+ If dependencies/setup are needed, include the exact commands in the plan for explicit approval.
75
+ No dependency/browser download or source-profile copying is implicit.
76
+ Baseline checks are separate from acceptance checks that need newly implemented files.
77
+ Failed declared baseline checks stop before editing.
78
+ At most two approved repair rounds may follow failed review/checks; repairs cannot expand scope or weaken acceptance.
79
+ Final candidate checks must pass before merge.
80
+ Post-merge failures remain failures and report the actual merge commit; no rollback is fabricated.
81
+ Automatic review is never recorded as human review.
82
+
83
+ Ask to cancel to request orderly closure.
84
+ A pending or unknown cancellation is not reported as stopped.
85
+ Failures, timeouts and unknown process/auth/storage outcomes remain distinct; unknown resources retain fences for explicit informed recovery.
86
+
87
+ ## Service and compatibility
88
+
89
+ An explicit native mode entry/current user Send may start or reuse its local project owner on demand.
90
+ It does not install a system service, enable boot startup, select another account's credentials or expose a public listener.
91
+ An existing owner/configuration is reused, not silently replaced after a connection failure.
92
+ System-service installation and remote access remain separate explicit operations described in [Service management](service-management.md) and [Remote access](remote-access.md).
93
+
94
+ `/cadence-inspect` retains the previous advanced task/history UI for diagnostics and legacy workflows; it is not needed for conversation mode.
95
+ The WebUI uses the same execution engine with a separate, context-bound browser confirmation path.
96
+ Its main composer stays in the same conversation; plan, workflow progress, retained step results and actual merge outcomes appear inline.
97
+ The background-workflow observer includes native-started workflows; an unavailable observation is not proof of no work.
98
+ **Legacy task** retains the old create/plan/Save/Start/check/human-Review route explicitly, rather than making `/cadence` create a legacy task.
99
+ Existing browser conversations enter the new mode only on explicit Send/activation; old tasks and Pi transcripts are not converted or imported.
100
+ Approval grants are neither stored in the browser nor restored after restart.
101
+ Losing a response only observes its original command/run identity; it never retries execution.
102
+ Exit does not stop accepted work, and **Cancel workflow — request stop** remains independent of conversation mode.
103
+ There is no generic browser shell/PTY, service management/recovery or checkpoint pause/resume feature.
104
+ Conversation response completion is distinct from workflow completion; read the workflow card for actual delivery/check outcomes.
@@ -1,7 +1,9 @@
1
1
  # Explicit service management
2
2
 
3
- The native `/cadence` view and browser are clients of the same owner, started explicitly or by the [background service](#background-service).
4
- Opening either view, extension discovery, login and package installation do not start it.
3
+ Native conversation mode and the browser use the shared project-owner implementation.
4
+ Extension discovery, login and package installation do not start an owner.
5
+ Explicit `/cadence` mode/current user Send can start or reuse a local owner without installing a boot service; see [Conversation mode](conversation-mode.md).
6
+ The optional [background service](#background-service) remains an explicit management operation.
5
7
  Use one coordination state-home for the checkout; a different state-home is not a recovery route.
6
8
  Stop older Cadence sessions before starting the shared service.
7
9
 
@@ -111,13 +113,13 @@ For an explicit single-project definition, the older guards remain: no SDK means
111
113
 
112
114
  While no service is registered, Pi's session-start card shows a separate warning naming `cadence server install` for an installed package copy (`node <copy>/src/service-cli.mjs server install` for Pi's managed copy, which puts no bin on `PATH`); a checkout loaded with `pi -e` stays quiet.
113
115
  It is a warning rather than part of the info card because Pi's TUI replaces one info status with the next.
114
- `/cadence` names the same command when it finds no owner.
116
+ The legacy `/cadence-inspect` client names the same management command when no owner exists; daily `/cadence` instead uses explicit on-demand project startup, without requiring a boot service.
115
117
  A machine without a supported user service manager and `CADENCE_AUTOSTART=0` keep both quiet; with `CADENCE_LINGER=0` they suggest `--no-linger`.
116
118
 
117
119
  ### One copy for Pi and the service
118
120
 
119
121
  After `npm install -g`, `pi install "$(npm root -g)/@abelxiaoxing/cadence"` records that path and loads it in place, so an npm upgrade updates the service and native `/cadence` together.
120
- Pi's own package install (`pi install npm:@abelxiaoxing/cadence`) also loads the native client, but its copy puts no `cadence` on `PATH`; register its service with `node ~/.pi/agent/npm/node_modules/@abelxiaoxing/cadence/src/service-cli.mjs server install`.
122
+ Pi's own package install (`pi install npm:@abelxiaoxing/cadence`) also loads the native client, but its copy puts no `cadence` on `PATH`; if you want the optional boot service, register it with `node ~/.pi/agent/npm/node_modules/@abelxiaoxing/cadence/src/service-cli.mjs server install`.
121
123
  Keep one copy: two copies drift apart on upgrade, and a native client refuses an owner whose service contract differs from its own.
122
124
  A unit registered by an earlier version's Pi install hook keeps running; `cadence server restart` from the copy you keep rewrites it, and `pi update` no longer restarts it.
123
125
  Opening the private link once leaves an HttpOnly cookie in that browser; the address without the token only explains how to get the link.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abelxiaoxing/cadence",
3
- "version": "2.0.20",
4
- "description": "Shared Pi task workspace: native terminal and WebUI, persistent service, checks and human review.",
3
+ "version": "2.0.21",
4
+ "description": "Conversation-driven Pi workspace: persistent native and WebUI workflows, explicit plan approval, checks and local delivery.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "engines": {
@@ -71,7 +71,12 @@
71
71
  "licenses",
72
72
  "src/conversation-context.mjs",
73
73
  "src/conversation-resources.mjs",
74
- "src/service/contracts/workbench.ts"
74
+ "src/service/contracts/workbench.ts",
75
+ "src/cadence-mode.ts",
76
+ "src/cadence-preferences.ts",
77
+ "src/service/contracts/workflow.ts",
78
+ "src/cadence-instructions.ts",
79
+ "src/coordinator-tools.mjs"
75
80
  ],
76
81
  "pi": {
77
82
  "extensions": [
@@ -0,0 +1,7 @@
1
+ /** Shared conversation policy; clients supply distinct human-consent adapters. */
2
+ export const CADENCE_INSTRUCTIONS = `CADENCE CONVERSATION MODE — stays enabled for this entire conversation, including after a goal completes, until the user explicitly exits.
3
+ You are the sole user-facing coordinator. Continue normal conversation, not a task-manager UI. Do not ask the user to manage tasks, IDs, JSON, service ports, Save/Start/check menus or agent assignments.
4
+ For each new goal: inspect relevant project evidence through cadence_research (up to two independent readonly subagents); read existing AGENTS/docs/.cadence/project.md before proposing conventions. Reuse still-current findings; do not rescan the entire repository or spawn agents merely to fill slots. Aggregate questions yourself. Investigate discoverable facts and ask focused, frequent questions only for unresolved product/technical decisions. Preserve confirmed decisions across turns. Diagnosis/research alone never imply implementation.
5
+ Once material decisions and acceptance criteria are aligned, use cadence_plan with a readable design, explicit non-goals/decisions, exact file scopes, a finite dependency DAG, real verification commands, worktree prerequisites and a bounded repair budget. Independent writes may run concurrently; shared files need a single owner or dependency. Investigate local tool/dependency prerequisites BEFORE finalizing: isolated worktrees do not inherit ignored node_modules. Setup commands require inclusion in the final approval; never silently install/download/copy dependencies or credentials. local-merge needs an existing Git branch and commit identity; working-copy is explicit direct editing without Git mutation and is serialized.
6
+ Present the returned complete plan and invite a single clear execution approval (the user can type 按计划实施). cadence_start binds the exact displayed plan and obtains fresh user consent; never interpret a vague acknowledgement as approval. No further confirmations are needed for the approved bounded pipeline. No push, publication, deployment, recursive delegation or scope expansion. If a material decision changes, revise the plan and seek fresh approval.
7
+ During accepted work answer questions, report actual retained progress, and let the service execute. cadence_cancel is explicit cancellation, not navigation/exit. Never claim a worker's prose is a passing check or automatic review is human review. Failed/unknown/blocked outcomes are not success. A completed goal leaves Cadence ON and ready for the next goal; do not require /cadence again. Unrelated discussion is still ordinary conversation within this mode, not implicit permission to start another implementation. Tools operate on the host; this is not a sandbox.`;