@pazmo/ai-workflow-kit 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@
6
6
  "plugins": [
7
7
  {
8
8
  "name": "ai-workflow-kit",
9
- "version": "4.0.0",
9
+ "version": "4.1.0",
10
10
  "source": ".",
11
11
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
12
12
  "category": "development",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-kit",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
5
5
  "author": {
6
6
  "name": "JongKun Kim"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-kit",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Concise requirements-to-delivery workflow with human approval and understanding gates.",
5
5
  "skills": "./skills/"
6
6
  }
package/README.ko.md CHANGED
@@ -122,19 +122,25 @@ Developer는 배정받은 작업만 합니다. Superpowers나 CE의 전체 절
122
122
 
123
123
  ## Agent Office에서 사용하기
124
124
 
125
- Office는 PM, 팀장, Developer, Reviewer에게 일을 배정합니다. 각 에이전트는 kit으로 자기 역할을 수행합니다.
125
+ **kit는 맡은 일을 끝내는 절차를 관리하고, Office는 여러 사람의 일이 하나의 목표로 이어지도록 관리합니다.**
126
+
127
+ Office는 PM, 팀장, Developer, Reviewer에게 일을 배정합니다. 각 에이전트는 kit으로 자기 역할을 수행합니다. Office 없이도 같은 역할별 절차를 사용할 수 있습니다.
128
+
129
+ 에이전트는 배정된 kit 흐름을 실행합니다. Office는 kit의 결과를 작업 실행과 완료 처리에 연결합니다. 역할 흐름은 공통 그래프의 일부이거나 별도의 작은 그래프일 수 있습니다. 자기 역할을 끝냈다고 전체 프로젝트가 끝나는 것은 아닙니다. 에이전트마다 전체 workflow를 새로 시작하면 안 됩니다.
126
130
 
127
131
  | 구성 요소 | 담당 |
128
132
  |---|---|
129
133
  | **kit** | 작업 규칙, 선행 관계, 검증, 수정 경로 |
130
- | **Office** | 역할 배정, 에이전트 실행, 메시지, 상태 저장, 예산, 취소, 사용자 승인 |
134
+ | **Office** | 공통 완료 기준, 역할 배정, 에이전트 실행, 메시지, 결과 통합, 예산, 취소, 사용자 승인 |
131
135
  | **에이전트** | 배정된 작업, 결과, 증거, 질문 |
132
136
 
133
- 작업 상태를 확정하는 곳은 하나여야 합니다. Office와 kit 파일에서 같은 작업의 완료를 따로 결정하면 안 됩니다.
137
+ kit 실행 파일은 개별 작업의 진행 상태를 관리합니다. Office는 공통 목표와 협업을 관리합니다. Office가 kit의 진행 상태를 표시할 수 있지만, 같은 상태를 따로 변경하면 안 됩니다. PM과 Developer의 완료 기준이 다르면 Office가 조율합니다. 에이전트가 자기 기준으로 요구사항을 바꾸면 안 됩니다.
134
138
 
135
139
  현재 kit에는 **완성된 Office 연결 기능, 대화 화면, 모델 실행 기능이 없습니다.** Office가 연결해야 합니다. 여러 실행의 작업 공간 분리, 시간·비용 한도, 취소, 정확한 코드 변경본에 대한 승인도 실행 환경에서 처리해야 합니다.
136
140
 
137
- 단독 CLI에는 질문·답변·재개 명령이 없습니다. `human` 결과가 나오면 결정을 해결하고 새 run을 만들어야 합니다. 역할별 연결에서는 답변과 승인을 구분해야 합니다.
141
+ 별도 역할을 맡으면 `init-role`로 시작합니다. PM은 요구사항을 정리하고, 팀장은 조사와 계획을 합니다. Developer는 구현과 자체 검사를 하고, Reviewer는 검토 결과를 반환합니다. 역할이 끝나면 `role-complete`를 반환합니다. 전체 프로젝트 완료는 아닙니다.
142
+
143
+ `question`은 질문을 기다립니다. `answer`는 같은 시도를 새 토큰으로 재개합니다. `feedback`은 지적받은 작업과 후속 작업을 다시 열어 수정하게 합니다. 답변은 승인이 아닙니다. [역할별 사용법과 JSON 예시](https://github.com/syjkim0125/ai-workflow-kit/blob/main/skills/workflow/references/role-graphs.md)를 참고하세요.
138
144
 
139
145
  kit은 그래프 설계 개념을 사용합니다. Google ADK, Google Cloud, 새 서버는 필요하지 않습니다.
140
146
 
package/README.md CHANGED
@@ -61,6 +61,7 @@ The runner:
61
61
  - Rejects duplicate results and old task tokens.
62
62
  - Resets affected tasks after a failed check. It keeps unrelated completed work.
63
63
  - Stops after three attempts at a node. Unresolved decisions go to a person.
64
+ - Pauses for questions, resumes on matching answers, and applies review feedback to affected work.
64
65
 
65
66
  The agent does the work. The runner checks the saved state and returns the next action. It does not call an AI model itself.
66
67
 
@@ -122,19 +123,25 @@ Lessons normally go in `docs/solutions/`. Later tasks read relevant lessons. Thi
122
123
 
123
124
  ## Using Agent Office
124
125
 
125
- Office assigns work to PM, team lead, Developer, and Reviewer agents. Each agent uses the kit for its own role.
126
+ **The kit manages how an assigned job gets finished. Office manages how several jobs achieve one goal.**
127
+
128
+ Office assigns work to PM, team lead, Developer, and Reviewer agents. Each agent uses the kit for its own role. The same role flows also work without Office.
129
+
130
+ An agent runs its assigned kit flow. Office connects the kit's results to task execution and completion. A role's flow may be part of a shared graph or a separate small graph. Finishing that role does not finish the whole project. Each agent must not restart the full workflow.
126
131
 
127
132
  | Part | Responsibility |
128
133
  |---|---|
129
134
  | **Kit** | Task rules, dependencies, checks, and correction paths |
130
- | **Office** | Role assignments, agent execution, messages, saved state, budgets, cancellation, and user approvals |
135
+ | **Office** | Shared acceptance criteria, assignments, agent execution, messages, combined results, budgets, cancellation, and user approvals |
131
136
  | **Agent** | Its assigned work, results, evidence, and questions |
132
137
 
133
- Keep one authoritative task state. Do not let Office and a kit run file independently decide that the same task is complete.
138
+ The kit run file owns local progress. Office owns the shared goal and coordination. It may display kit progress, but must not independently advance the same local state. When PM and Developer disagree about completion, Office resolves the shared criteria; agents cannot replace them with their own rules.
134
139
 
135
140
  The current kit does **not** include a finished Office adapter, a conversation UI, or model execution. Office must connect these parts. Cross-run isolation, time and cost limits, cancellation, and approval of the exact code revision need host integration.
136
141
 
137
- The standalone CLI has no question/reply/resume command. A `human` result needs a resolved decision and a new run. Role-specific integration must handle questions without treating answers as approvals.
142
+ Use `init-role` for a separate role assignment. PM clarifies and proposes; the team lead investigates and plans; Developer implements and checks; Reviewer returns a verdict. A role ends with `role-complete`, which does not finish the project.
143
+
144
+ `question` pauses work. `answer` resumes the same attempt with a new token. `feedback` reopens affected work for correction. Answers are not approvals. See the [role guide and JSON examples](https://github.com/syjkim0125/ai-workflow-kit/blob/main/skills/workflow/references/role-graphs.md).
138
145
 
139
146
  The kit uses graph design concepts. It does not require Google ADK, Google Cloud, or a new server.
140
147
 
@@ -32,10 +32,12 @@ Usage:
32
32
  ai-workflow-kit check gate G1|G4 <story-file> [--root <dir>]
33
33
  ai-workflow-kit jira preview <story-file> [--root <dir>]
34
34
  ai-workflow-kit graph init <plan.json|-> <run.json> <story.md> [--root <dir>]
35
+ ai-workflow-kit graph init-role <assignment.json> <run.json> [--root <dir>]
35
36
  ai-workflow-kit graph status <run.json> [--root <dir>]
36
37
  ai-workflow-kit graph start <run.json> <node-id> <ready-token> [--root <dir>]
37
38
  ai-workflow-kit graph record <run.json> <node-id> <result.json> [--root <dir>]
38
39
  ai-workflow-kit graph reset <run.json> <node-id> <reason> [--root <dir>]
40
+ ai-workflow-kit graph question|answer|feedback <run.json> <node-id> <input.json> [--root <dir>]
39
41
  ai-workflow-kit remove [--root <dir>]
40
42
  ai-workflow-kit --version
41
43
 
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@pazmo/ai-workflow-kit",
3
- "version": "4.0.0",
4
- "repository": { "type": "git", "url": "git+https://github.com/syjkim0125/ai-workflow-kit.git" },
3
+ "version": "4.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/syjkim0125/ai-workflow-kit.git"
7
+ },
5
8
  "homepage": "https://github.com/syjkim0125/ai-workflow-kit#readme",
6
- "bugs": { "url": "https://github.com/syjkim0125/ai-workflow-kit/issues" },
9
+ "bugs": {
10
+ "url": "https://github.com/syjkim0125/ai-workflow-kit/issues"
11
+ },
7
12
  "description": "Portable DDD-inspired AI engineering workflow with concise contracts and a human understanding gate.",
8
13
  "type": "module",
9
14
  "bin": {
@@ -8,7 +8,7 @@ argument-hint: "[request | status | finish]"
8
8
 
9
9
  Invoke in Codex with `$workflow`; in Claude Code with `/workflow`. After installation or updates, start a new task/session.
10
10
 
11
- Turn `$ARGUMENTS` into an approved change. For assigned graph work, follow `references/graph-engineering.md` and `references/skill-integration.md` within that role; do not restart delivery.
11
+ Turn `$ARGUMENTS` into an approved change. For assigned roles, follow `references/role-graphs.md` and `references/skill-integration.md`: reuse the supplied run/node/token or automatically initialize `init-role`. Do not restart delivery.
12
12
 
13
13
  ## Non-negotiable gates
14
14
 
@@ -12,11 +12,13 @@ A role is not necessarily one node. A Developer may perform several implementati
12
12
 
13
13
  For a delegated node, the dispatch must identify the kit run, node, started token, role, task description, approved Story constraints, allowed access and direct dependency outputs. The assigned agent applies the relevant procedure and returns summary, evidence and explicit evaluation to that same run. It must not initialize a new delivery graph, repeat G1/G4, spawn an unbounded team or implement changes inside a read-only review assignment. Missing scope or inputs must be reported to the dispatcher rather than invented. The kit graph is already active: executing its assigned node is graph use.
14
14
 
15
- For a genuinely separate role objective, a host can construct a bounded role graph with the installed `createTaskGraph`/`executeTaskGraph` API. For example, Reviewer: inspect diff → assess findings → return evidence. Do not force the delivery CLI's implementation/review/verification envelope onto each role. The in-process API needs host-owned checkpoint/transport integration; this package does not include an Office adapter. PM intake before G1 remains non-implementation work and cannot authorize production edits.
15
+ For a separate role objective, use the durable `init-role` entrypoint in [role-graphs.md](role-graphs.md). It supplies PM, team-lead, developer and reviewer flows without appending the whole delivery envelope. PM intake before G1 remains non-implementation work and cannot authorize production edits. The optional generic API is still available for custom graphs, with the different guarantees listed below.
16
+
17
+ Role-local execution and host enforcement are compatible. An agent performs its assigned kit flow; Office uses that flow's identity and results to dispatch work and accept its outcome. Office also applies host-owned permissions, cancellation and global budgets. It must not reimplement the role's workflow rules or treat a worker's "done" message as proof of graph completion. If a role uses a separate graph, link its run to the Office assignment and target revision; its completion is only that role's outcome, not completion of the whole delivery. This describes the integration contract, not an adapter already shipped by the kit.
16
18
 
17
19
  Link messages to run/node/attempt and the requirement, question, decision, artifact or finding they concern. A review failure goes back through the kit's corrective route to the responsible implementation node. Only the overall delivery owner presents G4 after final evidence, using the actual user's response. Role completion is not project completion.
18
20
 
19
- In standalone CLI use, one controller owns each persisted kit run. For Office integration, the host must persist one authoritative state using kit transition rules; the current CLI file store is not a ready-made Office adapter. Do not independently advance both an Office state machine and a CLI run. Locking and write exclusion apply within that run, not across separate runs or processes editing the same repository. Office must isolate independent writers or serialize them and enforce any overall time/cost/cancellation limits. The kit's three-attempt bound does not implement an Office-wide budget or process cancellation.
21
+ One controller owns each persisted kit run through the CLI. Its file is authoritative for local transitions; Office owns the shared goal, acceptance criteria, assignments, collaboration and integration. Office may index local progress but must not independently advance a copy. The CLI file store is not a finished Office adapter. Locking and write exclusion apply within that run, not across separate runs or processes editing the same repository. Office must isolate independent writers or serialize them and enforce any overall time/cost/cancellation limits. The kit's three-attempt bound does not implement an Office-wide budget or process cancellation.
20
22
 
21
23
  ## Initialize or resume
22
24
 
@@ -81,6 +83,8 @@ A failed result uses `"evaluation": { "passed": false, "action": "fix", "feedbac
81
83
  | `replan` | Correct the plan; validate it into a new run and retain the old run as evidence. Scope changes use the existing human gate. |
82
84
  | `human` | Surface the unresolved decision and wait. After resolution, use a new run reflecting it. |
83
85
  | `stop` | Report exhausted attempts and evidence. Do not restart under a new filename without an explicit decision to continue. |
86
+ | `question` | Transport the pending question; submit the matching answer and continue with `resumed.token`. See `role-graphs.md`. An answer is not approval. |
87
+ | `role-complete` | Return the role's native outcome and evidence to the caller. This does not finish delivery. |
84
88
  | `g4` | Follow `understanding-gate.md`; this is readiness, not approval or delivery. |
85
89
 
86
90
  ```bash
@@ -99,4 +103,18 @@ After init, import from `./.ai-workflow/graph/index.mjs`. Consumers who install
99
103
 
100
104
  Node input is `{ context, dependencies }`, copied to avoid shared mutation. Persisted states carry a graph fingerprint; changed plans and unknown/unevaluated statuses are rejected. Interrupted `running` nodes require an explicit `resetAffectedSubgraph` after checking external side effects. This in-process API does not persist checkpoints or approve gates; use the installed CLI for the durable host workflow.
101
105
 
106
+ The generic API is not the delivery CLI's policy API. Choose the interface by its actual guarantees:
107
+
108
+ | Responsibility | Generic API | Delivery CLI | Host |
109
+ |---|---|---|---|
110
+ | Dependency readiness, read concurrency, exclusive writers | Within one execution | Within one run | Isolate or serialize work across runs |
111
+ | Attempts | Counts starts; no built-in cap | Maximum three starts per node | Enforce global time, cost and attempt budgets |
112
+ | `human` / `replan` evaluation | Records the action; independent work can continue | Routes to the decision; no further start until resolved in a new run | Stop affected processes and obtain the decision |
113
+ | Evidence and persistence | Returns state and explicit evaluation; no evidence-file checks or checkpoint store | Checks evidence files/hashes and persists run changes | Verify observations and bind them to the actual code revision |
114
+ | User approval and tool permissions | Not provided | Checks approval records, not identity; does not intercept tools | Own actual approval events and execution permissions |
115
+
116
+ Do not assume `executeTaskGraph` or `resetAffectedSubgraph` enforces the delivery CLI's retry or human-decision rules. Office integration must first identify its actual dispatch, storage, cancellation and result-application boundary. If it needs shared delivery transitions, extract only the necessary rules from the CLI when connecting that consumer; do not duplicate the rules in Office or invent an unused public API in advance.
117
+
118
+ `access: 'read'` describes product-code access, not a filesystem sandbox. Review evidence and test-generated files may still require designated output paths. Host enforcement must distinguish these from product edits. Multiple developer processes alone do not provide safe parallel implementation: the host must manage workspace isolation, integration and verification of the combined result.
119
+
102
120
  `createPlanningGraph()` supplies `planner → review → validate-graph`. Planner/review callbacks return task graphs; the last node executes built-in deterministic validation rather than an LLM callback. Research and extra review roles are chosen for the work, not required by the graph.
@@ -82,8 +82,10 @@ node .ai-workflow/bin/check.mjs story <story-file>
82
82
  node .ai-workflow/bin/check.mjs gate G1 <story-file>
83
83
  ```
84
84
 
85
- `story` checks that the contract is well formed. `gate G1` checks that a human actually
86
- approved it. Run `story` while the file still says `Draft` and it exits 0 on shape alone —
85
+ `story` checks that the contract is well formed. `gate G1` validates the approval record
86
+ and referenced artifact; it does not authenticate the person who approved it. The host
87
+ must obtain the actual user's decision. Never create approval from an agent's own claim.
88
+ Run `story` while the file still says `Draft` and it exits 0 on shape alone —
87
89
  that is not approval, and the output says which gate it skipped. Do not start implementation
88
90
  unless both exit 0, and never claim the gate passed without that output.
89
91
 
@@ -0,0 +1,136 @@
1
+ # Persistent role work
2
+
3
+ **The kit manages how an assigned job gets finished. Office manages how several jobs achieve one goal.**
4
+
5
+ Use this guide when assigned a role objective. If the dispatcher supplied an existing run/node/started token, return to that node instead of initializing another run. Without a role assignment, use the normal delivery flow in `graph-engineering.md`.
6
+
7
+ ## Ownership
8
+
9
+ - Kit run file: local readiness, attempts, questions, answers, feedback, evidence and role completion. One controller writes it through the CLI.
10
+ - Office: canonical goal and acceptance criteria, assignments, agent execution, collaboration messages, combined results, global limits, cancellation and real user approval. Office may index kit state; it must not independently advance a duplicate local state machine.
11
+ - Agent: performs ready work and records actual observations. It may choose HOW within its assignment, but cannot change the agreed completion criteria.
12
+
13
+ Standalone use has the same local rules. Codex/Claude runs the CLI and tools. No Office server is needed. The CLI cannot intercept tools or authenticate people: host permissions and real approvals remain separate.
14
+
15
+ If PM and Developer disagree about completion, return the exact requirement and evidence to Office. Resolve the shared criteria there. A changed requirement or assignment starts a new run; do not silently edit the bound source or reuse old completion evidence.
16
+
17
+ ## Assignment schema and initialization
18
+
19
+ Save an assignment as project-relative JSON, for example `assignments/developer-1.json`:
20
+
21
+ ```json
22
+ {
23
+ "version": 1,
24
+ "taskId": "payment-idempotency",
25
+ "role": "developer",
26
+ "source": "docs/payment-story.md",
27
+ "scope": ["M1", "V1"],
28
+ "targetRevision": "snapshot-before-work"
29
+ }
30
+ ```
31
+
32
+ | Field | Contract |
33
+ |---|---|
34
+ | `version` | Integer `1` |
35
+ | `taskId` | Nonempty assignment identity from the caller |
36
+ | `role` | `pm`, `team-lead`, `developer`, or `reviewer` |
37
+ | `source` | Existing nonempty request file for PM; approved canonical Story for other roles. Paths stay inside the project and cannot contain symlinks. |
38
+ | `scope` | PM uses `[]`. Others use unique existing Story IDs with at least one M and one V. This is the assigned subset, not copied requirements. |
39
+ | `targetRevision` | Nonempty caller-owned snapshot identity. For Developer it identifies the starting input; for Reviewer it identifies the submitted code. Include uncommitted changes. |
40
+
41
+ ```sh
42
+ node .ai-workflow/bin/graph.mjs init-role assignments/developer-1.json .ai-workflow/runs/developer-1.json
43
+ node .ai-workflow/bin/graph.mjs status .ai-workflow/runs/developer-1.json
44
+ ```
45
+
46
+ Reuse the same run across sessions. `init-role` does not overwrite files. The assignment contents and source are bound to the run. Source/assignment changes require a new run after the caller resolves the change. PM should write a separate Story proposal, not overwrite its input request.
47
+
48
+ | Role | Local graph | Return |
49
+ |---|---|---|
50
+ | PM | `clarify → propose` | Story proposal and remaining decisions; no self-issued G1 |
51
+ | Team lead | `investigate → plan` | Repository-grounded plan, scope links and assignment suggestions |
52
+ | Developer | `implement → self-check` | Code, fresh checks and `output.producedRevision` |
53
+ | Reviewer | `review` | Evidence, `output.reviewedRevision` and `output.verdict`: `pass` or `needs_changes` |
54
+
55
+ Use the focused skills in `skill-integration.md` inside these stages. No role starts another full workflow. Final delivery still needs independent review, combined verification, useful Compound learning and real user acceptance, coordinated by the delivery owner.
56
+
57
+ ## Start and record
58
+
59
+ Use the same `start` and `record` commands as delivery graphs. `status.ready` contains node instructions, token, assignment, source, direct dependency outputs and relevant `input.messages` only. Reserve with the ready token, execute the work, and record using `started.token`.
60
+
61
+ ```json
62
+ {
63
+ "token": "<started.token>",
64
+ "output": {
65
+ "summary": "Assigned behavior implemented and checked",
66
+ "evidence": ["evidence/developer-attempt-1.md"],
67
+ "producedRevision": "snapshot-after-work"
68
+ },
69
+ "evaluation": { "passed": true }
70
+ }
71
+ ```
72
+
73
+ Developer's final `self-check` requires `producedRevision`. Reviewer's result requires `reviewedRevision` equal to the assignment's `targetRevision`, plus `verdict`. The CLI compares the supplied identities; Office/host must verify that they actually identify the files inspected.
74
+
75
+ A completed review can have `evaluation.passed: true` and `output.verdict: "needs_changes"`: the review was performed, and its finding is that the product needs changes. Do not interpret that as product approval. A review that could not be performed should fail with a concrete `fix`, `replan` or `human` action.
76
+
77
+ All local nodes passing returns `action: "role-complete"`, `assignment`, `submission.output` and `revisionToken`. Office consumes the native outcome and evidence. **Role completion does not approve the product or finish delivery.** Existing delivery graphs still return `g4` as preparation for human review.
78
+
79
+ ## Ask and resume
80
+
81
+ Available for both role and delivery runs. A running task can submit:
82
+
83
+ ```json
84
+ { "token": "<current task token>", "text": "Which accepted requirement governs this case?" }
85
+ ```
86
+
87
+ ```sh
88
+ node .ai-workflow/bin/graph.mjs question <run.json> <node-id> <question.json>
89
+ ```
90
+
91
+ The response has `action: "question"` and `question: {id, nodeId, text, token}`. One question may be pending per run. New dispatch stops. Other already running nodes may finish. The asking node cannot record or reset past the unanswered question. Its previous token is invalidated.
92
+
93
+ Office transports the question and answer. Standalone agents ask their user. Save the actual answer as evidence, then submit:
94
+
95
+ ```json
96
+ {
97
+ "token": "<question.token>",
98
+ "questionId": "<question.id>",
99
+ "text": "The answer or decision received",
100
+ "evidence": ["evidence/answer-1.md"]
101
+ }
102
+ ```
103
+
104
+ ```sh
105
+ node .ai-workflow/bin/graph.mjs answer <run.json> <node-id> <answer.json>
106
+ ```
107
+
108
+ Continue from `resumed` and use its new token. This retains the same attempt. Duplicate/wrong answers and old worker results are rejected. Answers are input, never G1/G3/G4 approval. If an answer changes requirements, resolve the canonical document and create a new assignment/run; do not continue against the old contract.
109
+
110
+ There are at most three question exchanges per node across the run. Batch related questions. The fourth question is rejected; report the unresolved blocker with `evaluation.action: "human"`. Starting a new run only to evade this limit is not allowed. Global time/cost limits remain host-owned.
111
+
112
+ ## Apply feedback
113
+
114
+ Local failed checks use `reset` on the earliest affected implementation node. Its next input includes downstream failure feedback. External review feedback uses a separate command with the current `status.revisionToken`:
115
+
116
+ ```json
117
+ {
118
+ "token": "<current status.revisionToken>",
119
+ "summary": "Handle repeated requests without charging twice; see Reviewer finding R1.",
120
+ "evidence": ["evidence/reviewer-finding-r1.md"]
121
+ }
122
+ ```
123
+
124
+ ```sh
125
+ node .ai-workflow/bin/graph.mjs feedback <developer-run.json> implement <feedback.json>
126
+ ```
127
+
128
+ The target must be completed or failed and affected workers must be stopped. Feedback resets that node and descendants, preserves unrelated work and attempt counts, and attaches the finding to their inputs. Maximum three starts per node. Stale feedback, missing evidence and retries past the limit are rejected. A revised submission needs a review assignment bound to its new revision.
129
+
130
+ For `human`, `replan` or exhausted attempts, resolve the decision explicitly; these are not ordinary question waits. Existing stop rules still apply. Keep answer and feedback evidence immutable because history checks their hashes even after a reset.
131
+
132
+ ## Compatibility and limits
133
+
134
+ Assignment schema is v1; role run format is v2. Existing delivery v1 files work without migration. Old runtimes cannot read role v2. Do not downgrade a runtime while using these commands, or edit versions/fingerprints to force compatibility. Install this source artifact and run `doctor`; a package name/version alone does not prove which code an Office worker has.
135
+
136
+ No Office adapter, cross-run lock, transport authentication, sandbox, model execution or global budget manager is included. Each run has its existing atomic file lock and local read/write scheduling. Host processes must isolate multiple writers and validate actual revisions before integrating results.
@@ -37,7 +37,7 @@ Planning may already include document review. Reuse that receipt; a graph valida
37
37
  - A skill's `status: complete` means its invocation ended; inspect its outcome. In review JSON, `Ready with fixes`, `Not ready`, unresolved material findings or missing required coverage do not pass the review node. An empty `actionable_findings` array alone is insufficient; inspect `findings`, testing gaps and coverage too.
38
38
  - Require actual commands/results and applicable verification evidence for implementation. Match review and verification to the submitted change revision; changed code invalidates affected evidence. A commit ID alone does not identify uncommitted edits.
39
39
  - Preserve the returned artifact and its native result. Summarize it into the existing graph result (`output.summary`, evidence paths, explicit evaluation) only when the assigned work has a terminal pass/fail. Record a failure with actionable feedback; never reinterpret a blocked/skipped/degraded skill as success.
40
- - Questions are not failed tests. Send a question with task/attempt, target revision and question identity to the host. Use its existing pause/reply facilities; an answer is not automatically approval. The current local Graph CLI has no dedicated question/reply transition: report that boundary rather than inventing a `resume` command or silently exhausting retry attempts.
40
+ - Questions are not failed tests. Use the CLI `question`/`answer` transitions in `role-graphs.md`; the host transports the question and actual answer. Continue with `resumed.token` without consuming another attempt. An answer is not approval. External review feedback uses `feedback` on the affected implementation node.
41
41
  - Only the delivery owner coordinates final verification, useful learning capture and G4. A review verdict, role completion or CE handoff never authorizes merge or supplies the user's gate response.
42
42
 
43
43
  ## Execution limits and review authority
package/src/graph/cli.mjs CHANGED
@@ -1,26 +1,32 @@
1
1
  import fs from 'node:fs/promises';
2
+ import { randomUUID } from 'node:crypto';
2
3
  import { normalizeEvaluation } from './executor.mjs';
3
4
  import { descendantIds, nodeById } from './task-graph.mjs';
4
5
  import { resetAffectedSubgraph } from './scheduler.mjs';
5
- import { readJson, readProjectFile, updateRun } from './storage.mjs';
6
+ import { digest, readJson, readProjectFile, updateRun } from './storage.mjs';
7
+ import { assertAssignment, assertRoleOutput, createRoleGraph } from './roles.mjs';
6
8
  import {
7
- MAX_ATTEMPTS, assertWorkflowRun, checkRunEvidence, createWorkflowGraph, evidenceHashes,
8
- newWorkflowRun, requireReady, storyContract, taskInput, taskToken, workflowStatus,
9
+ MAX_ATTEMPTS, MAX_QUESTIONS, assertWorkflowRun, checkRunEvidence, createWorkflowGraph, evidenceHashes,
10
+ newWorkflowRun, requireReady, revisionToken, storyContract, taskInput, taskToken, workflowStatus,
9
11
  } from './workflow.mjs';
10
12
 
11
13
  export const GRAPH_HELP = `Graph commands (run from project root):
12
14
  graph.mjs init <plan.json|-> <run.json> <story.md>
15
+ graph.mjs init-role <assignment.json> <run.json>
13
16
  graph.mjs status <run.json>
14
17
  graph.mjs start <run.json> <node-id> <ready-token>
15
18
  graph.mjs record <run.json> <node-id> <result.json>
16
19
  graph.mjs reset <run.json> <node-id> <reason>
20
+ graph.mjs question <run.json> <node-id> <question.json>
21
+ graph.mjs answer <run.json> <node-id> <answer.json>
22
+ graph.mjs feedback <run.json> <node-id> <feedback.json>
17
23
  Use - for a minimal plan. The host executes work; this tool validates state/evidence and routes the next action.`;
18
24
 
19
25
  export async function runGraphCommand(args, { root = process.cwd(), checkArtifact, checkGate } = {}) {
20
26
  root = await fs.realpath(root);
21
27
  const [command, ...values] = args;
22
28
  if (!command || command === '--help') return { help: GRAPH_HELP };
23
- const counts = { init: 3, status: 1, start: 3, record: 3, reset: 3 };
29
+ const counts = { init: 3, 'init-role': 2, status: 1, start: 3, record: 3, reset: 3, question: 3, answer: 3, feedback: 3 };
24
30
  if (!Object.hasOwn(counts, command) || values.length !== counts[command]) throw new Error(GRAPH_HELP);
25
31
 
26
32
  const loadStory = async file => {
@@ -33,14 +39,40 @@ export async function runGraphCommand(args, { root = process.cwd(), checkArtifac
33
39
  return storyContract(text);
34
40
  };
35
41
 
42
+ const loadSource = async assignment => {
43
+ if (assignment.role !== 'pm') return loadStory(assignment.source);
44
+ const text = await readProjectFile(root, assignment.source);
45
+ if (!text.trim()) throw new Error('PM source request must not be empty.');
46
+ return { fingerprint: digest(text), ids: [] };
47
+ };
48
+
36
49
  const validate = async (run, { evidence = true } = {}) => {
37
50
  assertWorkflowRun(run);
38
- const contract = await loadStory(run.story.path);
51
+ if (run.version === 2) {
52
+ const current = await readJson(root, run.assignment.file);
53
+ if (digest(JSON.stringify(current)) !== run.assignment.fingerprint) throw new Error('Assignment changed; create a new run.');
54
+ }
55
+ const contract = run.version === 2 ? await loadSource(run.assignment.value) : await loadStory(run.story.path);
56
+ if (run.version === 2) assertAssignment(run.assignment.value, contract.ids);
39
57
  if (contract.fingerprint !== run.story.fingerprint) throw new Error('Story requirements changed; replan in a new run.');
40
58
  if (evidence) await checkRunEvidence(root, run);
41
59
  return run;
42
60
  };
43
61
 
62
+ if (command === 'init-role') {
63
+ const [file, runFile] = values;
64
+ const value = await readJson(root, file);
65
+ assertAssignment(value);
66
+ const contract = await loadSource(value);
67
+ assertAssignment(value, contract.ids);
68
+ const graph = createRoleGraph(value);
69
+ const run = await updateRun(root, runFile, async () => ({
70
+ ...newWorkflowRun(graph, value.source, contract), version: 2,
71
+ assignment: { file, fingerprint: digest(JSON.stringify(value)), value },
72
+ }), { create: true });
73
+ return workflowStatus(run);
74
+ }
75
+
44
76
  if (command === 'init') {
45
77
  const [planFile, runFile, story] = values;
46
78
  const contract = await loadStory(story);
@@ -63,11 +95,13 @@ export async function runGraphCommand(args, { root = process.cwd(), checkArtifac
63
95
  next.state.nodes[nodeId].attempts += 1;
64
96
  next.history.push({ event: 'start', nodeId, at: new Date().toISOString() });
65
97
  } else if (command === 'record') {
98
+ if (next.question?.nodeId === nodeId) throw new Error('Answer the pending question before recording this node.');
66
99
  const result = await readJson(root, argument);
67
100
  if (result.token !== taskToken(next, nodeId)) throw new Error('Stale or missing task token; read fresh status.');
68
101
  if (next.state.nodes[nodeId].status !== 'running') throw new Error(`Node must be started before recording: ${nodeId}`);
69
102
  if (typeof result.output?.summary !== 'string' || !result.output.summary.trim()) throw new Error('Node output needs a summary.');
70
103
  const evaluation = normalizeEvaluation(result.evaluation);
104
+ if (evaluation.passed) assertRoleOutput(next, nodeId, result.output);
71
105
  if (!evaluation.passed && (typeof evaluation.feedback !== 'string' || !evaluation.feedback.trim())) throw new Error('Failed evaluation needs feedback.');
72
106
  const hashes = await evidenceHashes(root, result.output.evidence);
73
107
  const current = next.state.nodes[nodeId];
@@ -77,18 +111,47 @@ export async function runGraphCommand(args, { root = process.cwd(), checkArtifac
77
111
  ...(!evaluation.passed ? { error: evaluation.feedback } : {}),
78
112
  };
79
113
  next.history.push({ event: 'record', nodeId, at: new Date().toISOString(), result: next.state.nodes[nodeId] });
114
+ } else if (command === 'question') {
115
+ if (next.question || ['human', 'replan', 'stop'].includes(workflowStatus(next).action)) throw new Error('Resolve the pending question or blocking decision first.');
116
+ const request = await readJson(root, argument);
117
+ if (next.state.nodes[nodeId].status !== 'running' || request.token !== taskToken(next, nodeId)) throw new Error('Question requires the current running task token.');
118
+ if (typeof request.text !== 'string' || !request.text.trim()) throw new Error('Question needs text.');
119
+ if (next.history.filter(entry => entry.event === 'question' && entry.nodeId === nodeId).length >= MAX_QUESTIONS) throw new Error('Question limit reached; report the unresolved blocker with action human.');
120
+ next.state.nodes[nodeId].revision += 1;
121
+ next.question = { id: randomUUID(), nodeId, text: request.text, token: taskToken(next, nodeId) };
122
+ next.history.push({ event: 'question', nodeId, questionId: next.question.id, text: request.text, at: new Date().toISOString() });
123
+ } else if (command === 'answer') {
124
+ const reply = await readJson(root, argument);
125
+ const question = next.question;
126
+ if (!question || question.nodeId !== nodeId || reply.questionId !== question.id || reply.token !== question.token) throw new Error('Stale or mismatched question answer.');
127
+ if (workflowStatus(next).action !== 'question') throw new Error('Resolve the blocking decision before resuming this task.');
128
+ if (typeof reply.text !== 'string' || !reply.text.trim()) throw new Error('Answer needs text.');
129
+ const hashes = await evidenceHashes(root, reply.evidence);
130
+ next.history.push({ event: 'answer', nodeId, questionId: question.id, text: reply.text, evidence: reply.evidence, evidenceHashes: hashes, at: new Date().toISOString() });
131
+ delete next.question;
132
+ next.state.nodes[nodeId].revision += 1;
80
133
  } else {
81
134
  if (!argument.trim()) throw new Error('Reset requires a reason.');
135
+ if (next.question) throw new Error('Answer the pending question before resetting work.');
82
136
  const status = workflowStatus(next);
83
137
  if (['human', 'replan', 'stop'].includes(status.action)) throw new Error(`Cannot blindly retry ${status.action}; resolve the decision and create a new run.`);
84
138
  const affected = [...descendantIds(next.graph, [nodeId])];
85
139
  if (affected.some(id => id !== nodeId && next.state.nodes[id].status === 'running')) throw new Error('Stop running descendants before resetting their inputs.');
86
140
  if (affected.some(id => next.state.nodes[id].attempts >= MAX_ATTEMPTS)) throw new Error('Attempt limit reached; stop and inspect the evidence.');
141
+ let feedback;
142
+ if (command === 'feedback') {
143
+ feedback = await readJson(root, argument);
144
+ if (feedback.token !== revisionToken(next)) throw new Error('Stale feedback token; read fresh status.');
145
+ if (!['completed', 'failed'].includes(next.state.nodes[nodeId].status)) throw new Error('Feedback requires completed or failed work; stop running work first.');
146
+ if (typeof feedback.summary !== 'string' || !feedback.summary.trim()) throw new Error('Feedback needs a summary.');
147
+ feedback = { summary: feedback.summary, evidence: feedback.evidence, evidenceHashes: await evidenceHashes(root, feedback.evidence) };
148
+ }
87
149
  next.state = resetAffectedSubgraph(next.graph, next.state, [nodeId]);
88
- next.history.push({ event: 'reset', nodeId, affected, reason: argument, at: new Date().toISOString() });
150
+ next.history.push({ event: command, nodeId, affected, ...(feedback ?? { reason: argument }), at: new Date().toISOString() });
89
151
  await checkRunEvidence(root, next);
90
152
  }
91
153
  return next;
92
154
  });
93
- return { ...workflowStatus(run), ...(command === 'start' ? { started: taskInput(run, nodeId) } : {}) };
155
+ return { ...workflowStatus(run), ...(command === 'start' ? { started: taskInput(run, nodeId) } : {}),
156
+ ...(command === 'answer' ? { resumed: taskInput(run, nodeId) } : {}) };
94
157
  }
@@ -0,0 +1,62 @@
1
+ import { createTaskGraph, graphFingerprint } from './task-graph.mjs';
2
+ import { digest } from './storage.mjs';
3
+
4
+ const flows = {
5
+ pm: [
6
+ ['clarify', 'read', 'Read the request, related knowledge and open questions.', 'Identify missing decisions; ask only necessary questions.'],
7
+ ['propose', 'write', 'Propose the canonical Story within the assigned scope.', 'Check clarity and verifiability. Return the proposal without issuing G1.'],
8
+ ],
9
+ 'team-lead': [
10
+ ['investigate', 'read', 'Inspect the repository, dependencies and related lessons.', 'Ground the plan in source and approved requirements.'],
11
+ ['plan', 'write', 'Plan the assigned scope and propose ownership and dependencies.', 'Use caller-owned CE planning; return the plan without dispatching another full workflow.'],
12
+ ],
13
+ developer: [
14
+ ['implement', 'write', 'Implement the assigned scope using focused TDD and diagnosis.', 'Record applicable RED/GREEN evidence; simplify while green.'],
15
+ ['self-check', 'read', 'Verify the produced revision against assigned requirements.', 'Record fresh checks, producedRevision and limitations; independent review remains separate.'],
16
+ ],
17
+ reviewer: [
18
+ ['review', 'read', 'Review the assigned revision using CE review in agent mode.', 'Return pass or needs_changes, reviewedRevision and evidence; do not edit product code.'],
19
+ ],
20
+ };
21
+
22
+ export function assertAssignment(value, ids) {
23
+ if (value?.version !== 1 || !Object.hasOwn(flows, value.role)) throw new Error('Invalid role assignment version or role.');
24
+ for (const key of ['taskId', 'source', 'targetRevision']) {
25
+ if (typeof value[key] !== 'string' || !value[key].trim()) throw new Error(`Assignment needs ${key}.`);
26
+ }
27
+ if (!Array.isArray(value.scope) || value.scope.some(id => typeof id !== 'string')
28
+ || new Set(value.scope).size !== value.scope.length) throw new Error('Assignment needs unique scope references.');
29
+ if (value.role === 'pm') {
30
+ if (value.scope.length) throw new Error('PM request scope must be empty; propose Story references in its output.');
31
+ } else {
32
+ if (!value.scope.some(id => /^M-?\d+$/.test(id)) || !value.scope.some(id => /^V-?\d+$/.test(id))) throw new Error('Assignment scope needs Story M/V references.');
33
+ if (ids && value.scope.some(id => !ids.includes(id))) throw new Error('Assignment contains unknown Story references.');
34
+ }
35
+ }
36
+
37
+ export function createRoleGraph(assignment) {
38
+ assertAssignment(assignment);
39
+ const nodes = flows[assignment.role].map(([id, access, description, verify]) => ({ id, access, description, verify, covers: assignment.scope }));
40
+ return createTaskGraph({ id: `role-${assignment.role}`, nodes,
41
+ edges: nodes.slice(1).map((node, index) => ({ from: nodes[index].id, to: node.id })) });
42
+ }
43
+
44
+ export function assertRoleRun(run) {
45
+ const binding = run.assignment;
46
+ assertAssignment(binding?.value);
47
+ if (typeof binding.file !== 'string' || !binding.file.trim()
48
+ || digest(JSON.stringify(binding.value)) !== binding.fingerprint
49
+ || binding.value.source !== run.story.path
50
+ || graphFingerprint(createRoleGraph(binding.value)) !== graphFingerprint(run.graph)) throw new Error('Role assignment or graph changed.');
51
+ }
52
+
53
+ export function assertRoleOutput(run, nodeId, output) {
54
+ if (run.version !== 2 || nodeId !== run.graph.nodes.at(-1).id) return;
55
+ const assignment = run.assignment.value;
56
+ if (assignment.role === 'developer' && (typeof output.producedRevision !== 'string' || !output.producedRevision.trim())) {
57
+ throw new Error('Developer submission needs producedRevision covering actual changes.');
58
+ }
59
+ if (assignment.role === 'reviewer' && (!['pass', 'needs_changes'].includes(output.verdict) || output.reviewedRevision !== assignment.targetRevision)) {
60
+ throw new Error('Reviewer submission needs verdict and the assigned reviewedRevision.');
61
+ }
62
+ }
@@ -2,8 +2,10 @@ import { randomUUID } from 'node:crypto';
2
2
  import { createTaskGraph, dependencyIds, descendantIds, nodeById } from './task-graph.mjs';
3
3
  import { assertRunState, blockedNodeIds, createRunState, selectReadyNodes } from './scheduler.mjs';
4
4
  import { digest, readProjectFile } from './storage.mjs';
5
+ import { assertRoleOutput, assertRoleRun } from './roles.mjs';
5
6
 
6
7
  export const MAX_ATTEMPTS = 3;
8
+ export const MAX_QUESTIONS = 3;
7
9
  const REVIEW = 'workflow-review';
8
10
  const VERIFY = 'workflow-verify';
9
11
 
@@ -47,10 +49,18 @@ export function newWorkflowRun(graph, story, contract) {
47
49
  }
48
50
 
49
51
  export function assertWorkflowRun(run) {
50
- if (run?.version !== 1 || typeof run.runId !== 'string' || !run.runId.trim()
52
+ if (![1, 2].includes(run?.version) || typeof run.runId !== 'string' || !run.runId.trim()
51
53
  || !run.graph || !run.story?.path || !Array.isArray(run.history)) throw new Error('Invalid workflow run.');
52
54
  const graph = createTaskGraph(run.graph);
53
55
  assertRunState(graph, run.state);
56
+ if (run.question && (run.state.nodes[run.question.nodeId]?.status !== 'running'
57
+ || typeof run.question.id !== 'string' || !run.question.id
58
+ || typeof run.question.text !== 'string' || !run.question.text.trim()
59
+ || run.question.token !== taskToken(run, run.question.nodeId))) throw new Error('Invalid pending question.');
60
+ if (run.version === 2) {
61
+ assertRoleRun(run);
62
+ return graph;
63
+ }
54
64
  if (!graph.nodes.some(node => node.id === REVIEW) || !graph.nodes.some(node => node.id === VERIFY)) throw new Error('Workflow review/verification nodes are missing.');
55
65
  if (!dependencyIds(graph, VERIFY).includes(REVIEW)
56
66
  || graph.nodes.some(node => node.id !== VERIFY && !descendantIds(graph, [node.id]).has(VERIFY))) {
@@ -62,7 +72,12 @@ export function assertWorkflowRun(run) {
62
72
  export function taskToken(run, nodeId) {
63
73
  return digest(JSON.stringify([run.runId, run.state.fingerprint, run.story.fingerprint, nodeId,
64
74
  run.state.nodes[nodeId].attempts, run.state.nodes[nodeId].revision,
65
- dependencyIds(run.graph, nodeId).map(id => run.state.nodes[id]) ]));
75
+ dependencyIds(run.graph, nodeId).map(id => run.state.nodes[id]),
76
+ ...(run.version === 2 ? [run.assignment.fingerprint] : []) ]));
77
+ }
78
+
79
+ export function revisionToken(run) {
80
+ return digest(JSON.stringify([run.runId, run.story, run.assignment, run.state]));
66
81
  }
67
82
 
68
83
  export async function evidenceHashes(root, evidence) {
@@ -77,10 +92,15 @@ export async function evidenceHashes(root, evidence) {
77
92
  }
78
93
 
79
94
  export async function checkRunEvidence(root, run) {
95
+ for (const event of run.history.filter(entry => ['answer', 'feedback'].includes(entry.event))) {
96
+ const actual = await evidenceHashes(root, event.evidence);
97
+ if (JSON.stringify(actual) !== JSON.stringify(event.evidenceHashes)) throw new Error('Conversation evidence changed; preserve the original answer/feedback.');
98
+ }
80
99
  for (const node of run.graph.nodes) {
81
100
  const state = run.state.nodes[node.id];
82
101
  if (!['completed', 'failed'].includes(state.status)) continue;
83
102
  if (typeof state.output?.summary !== 'string' || !state.output.summary.trim()) throw new Error(`Missing output summary: ${node.id}`);
103
+ if (state.status === 'completed') assertRoleOutput(run, node.id, state.output);
84
104
  const actual = await evidenceHashes(root, state.output.evidence);
85
105
  if (JSON.stringify(actual) !== JSON.stringify(state.evidenceHashes)) throw new Error(`Node evidence changed: ${node.id}; reset affected work.`);
86
106
  }
@@ -96,19 +116,32 @@ export function workflowStatus(run) {
96
116
  if (exhausted) action = 'stop';
97
117
  else if (failed.some(node => node.action === 'human')) action = 'human';
98
118
  else if (failed.some(node => node.action === 'replan')) action = 'replan';
119
+ else if (run.question) action = 'question';
99
120
  else if (failed.length) action = 'fix';
100
- else if (nodes.every(([, state]) => state.status === 'completed')) action = 'g4';
121
+ else if (nodes.every(([, state]) => state.status === 'completed')) action = run.version === 2 ? 'role-complete' : 'g4';
101
122
  else action = 'execute';
102
123
  const ready = ['execute', 'fix'].includes(action) ? selectReadyNodes(graph, run.state, 4).map(node => taskInput(run, node.id)) : [];
103
124
  if (action === 'execute' && ready.length === 0 && running.length) action = 'wait';
104
- return { runId: run.runId, action, ready, running, failed, blocked: blockedNodeIds(graph, run.state),
125
+ return { runId: run.runId, revisionToken: revisionToken(run), action, ready, running, failed, blocked: blockedNodeIds(graph, run.state),
126
+ ...(run.version === 2 ? { assignment: run.assignment.value } : {}),
127
+ ...(run.question ? { question: run.question } : {}),
128
+ ...(action === 'role-complete' ? { submission: { nodeId: graph.nodes.at(-1).id, output: run.state.nodes[graph.nodes.at(-1).id].output } } : {}),
105
129
  completed: nodes.filter(([, state]) => state.status === 'completed').map(([id]) => id),
106
- gate: 'Graph evidence never approves G3/G4. G4 remains human-owned.', maxAttempts: MAX_ATTEMPTS };
130
+ gate: 'Graph evidence never approves G3/G4. G4 remains human-owned.', maxAttempts: MAX_ATTEMPTS, maxQuestionsPerNode: MAX_QUESTIONS };
107
131
  }
108
132
 
109
133
  export function taskInput(run, nodeId) {
134
+ const affected = descendantIds(run.graph, [nodeId]);
110
135
  return { ...nodeById(run.graph, nodeId), token: taskToken(run, nodeId), input: {
111
136
  story: run.story.path,
137
+ ...(run.version === 2 ? { assignment: run.assignment.value } : {}),
138
+ messages: run.history.flatMap(entry => {
139
+ if (entry.event === 'record' && affected.has(entry.nodeId) && entry.result.evaluation?.passed === false) {
140
+ return [{ event: 'failure', nodeId: entry.nodeId, feedback: entry.result.evaluation.feedback, output: entry.result.output }];
141
+ }
142
+ return (['question', 'answer'].includes(entry.event) && entry.nodeId === nodeId)
143
+ || (entry.event === 'feedback' && entry.affected.includes(nodeId)) ? [entry] : [];
144
+ }),
112
145
  dependencies: Object.fromEntries(dependencyIds(run.graph, nodeId).map(id => [id, run.state.nodes[id].output])),
113
146
  } };
114
147
  }