hafiz-context-manager 0.1.0 → 0.1.2

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.
@@ -10,17 +10,17 @@ checks:
10
10
  when: session_end
11
11
  cond: "files_written > 0 && progress == 0"
12
12
  action: [notice, proposal]
13
- message: "This session wrote {files_written} files and recorded no progress. Record what was done (progress.append)."
13
+ message: "This session wrote {files_written} files and recorded no progress. Record what was done (hafiz_progress_append)."
14
14
  - id: silent_active_block
15
15
  when: counters
16
16
  cond: "turns_since_progress >= 25"
17
17
  action: [notice]
18
- message: "{turns_since_progress} turns since the last progress entry on your focus block. Record what you have found or done so far (progress.append)."
18
+ message: "{turns_since_progress} turns since the last progress entry on your focus block. Record what you have found or done so far (hafiz_progress_append)."
19
19
  - id: open_threads_at_exit
20
20
  when: session_end
21
21
  cond: "threads_opened_open > 0"
22
22
  action: [notice, proposal]
23
- message: "{threads_opened_open} thread(s) this session opened are still open. Park each with a gist (thread.park) or resolve it."
23
+ message: "{threads_opened_open} thread(s) this session opened are still open. Park each with a gist (hafiz_thread park) or resolve it."
24
24
  - id: done_with_empty_log
25
25
  when: request_done
26
26
  cond: "progress == 0"
@@ -35,7 +35,7 @@ checks:
35
35
  when: counters
36
36
  cond: "user_turns_on_focus_without_thread >= 12"
37
37
  action: [notice]
38
- message: "{user_turns_on_focus_without_thread} user turns on the focus block without a thread. If this is a discussion worth keeping, open one (thread.open)."
38
+ message: "{user_turns_on_focus_without_thread} user turns on the focus block without a thread. If this is a discussion worth keeping, open one (hafiz_thread open)."
39
39
  report_capture:
40
40
  enabled: true
41
41
  cap_tokens: 1500 # verbatim up to this; remainder spilled to the store
@@ -12,7 +12,7 @@ tokenizer:
12
12
  soft_zone: 0.15 # writes within cap*(1+soft_zone) succeed with a notice
13
13
  windows: # context window per model family; used for budgets
14
14
  default: 200000
15
- confirm_done: auto # auto | ask
15
+ confirm_done: ask # ask | auto
16
16
  llm:
17
17
  # provider: none | kilo | openai-compatible | anthropic | fake (tests). none = condensation
18
18
  # disabled (the host's own compaction stays on). kilo = run through Kilo itself (the Kilo plugin
@@ -31,15 +31,13 @@ onboarding:
31
31
  # and dotfiles do not count) marks the project `onboarding: pending`: the manager has the
32
32
  # designer describe the existing codebase in the root design before new work.
33
33
  min_source_files: 5
34
- directive: >-
35
- Onboarding: this repo already had code when Hafiz started tracking it. Before planning new
36
- work, spawn the designer once with hafiz:block={root} to write the root design describing the
37
- codebase as it is (overview, topology, interface, constraints). Import what you touch, stub
38
- what you call: external dependencies get stubs only where current work needs them.
34
+ # One line at the top of these roles' views while onboarding is pending; the rules say what to do.
35
+ directive: "Onboarding pending: this repo had code before Hafiz started tracking it; follow your rules' Onboarding before new work."
39
36
  roles: [manager]
40
37
  host:
41
38
  kilo:
42
39
  shaper: auto # proxy | hooks | auto (hooks when the host exposes them)
43
40
  tools: native # native (plugin tool hook, per-session) | mcp (hafiz-<role> servers)
44
41
  default_role: manager # role for non-Hafiz primary agents (build, plan, …); none = unmanaged
45
- default_subagent_role: worker # non-Hafiz subagents spawned with hafiz:block=<id>; none = unmanaged
42
+ default_subagent_role: worker # non-Hafiz subagents spawned on a block (task's `block`); none = unmanaged
43
+ delegation_prompt_cap: 600 # tokens; a longer task prompt is refused (the subagent sees its block)
@@ -2,5 +2,5 @@
2
2
  # session, when the session starts to look multi-step.
3
3
  thresholds: { turns: 15, tool_calls: 25, files_written: 5, subagents_spawned: 1 }
4
4
  max_per_session: 1
5
- template: "Hafiz: this session has {tool_calls} tool calls across {files_written} files and no block tree. If this is multi-step work, call hafiz_track_project now (no need to ask)."
5
+ template: "Hafiz: this session has {tool_calls} tool calls across {files_written} files in a repo Hafiz is not tracking. If this is multi-step work, call hafiz_track_project now (no need to ask)."
6
6
  auto_init: false
@@ -16,3 +16,13 @@ epoch:
16
16
  caps:
17
17
  on_exceeded: reject # after the tokenizer soft zone
18
18
  allow_block_overrides: true # recorded as a decision
19
+ spawn:
20
+ # Who may be spawned on a block (Kilo: the `task` tool's `block` argument), by the block's
21
+ # state: no_design / no_plan / has_plan from its docs, done / dropped from its status.
22
+ # A refused spawn names the missing step. `*` = any role.
23
+ roles_by_state:
24
+ no_design: [designer]
25
+ no_plan: [designer, planner]
26
+ has_plan: ['*']
27
+ done: [] # reopen first
28
+ dropped: []
@@ -1,28 +1,35 @@
1
1
  # A role is data: view, focus policy, command allowlist, rules file installed as the agent prompt
2
2
  # (after the role's file, rules/common.md is appended for every agent role).
3
+ # The allowlist names Core commands (`command`, `command:qualifier`, `ns.*`); Core enforces it, and
4
+ # the agent tools (commands/tools.ts) are narrowed to it: `thread.open` + `thread.park` leave
5
+ # hafiz_thread with those two actions, `doc.patch:plan` leaves hafiz_doc with type plan and no
6
+ # replace, `block.request_done` without `block.set_status:done` makes done a request. Edges are
7
+ # derived from designs, so no agent role holds `edge.*` (the CLI user does).
3
8
  roles:
4
9
  manager:
5
10
  view: default
6
11
  focus_policy: all_active
7
- tools: [context.*, block.*, tree.list, edge.*, doc.patch:plan, decision.record,
8
- thread.*, progress.append, focus.set, proposal.*, session.status]
12
+ tools: [context.*, block.*, tree.list, doc.patch:plan, decision.record, thread.*,
13
+ progress.append, focus.set, proposal.*, session.status]
9
14
  rules: rules/manager.md
10
15
  designer:
11
16
  view: designer
12
- focus_policy: all_active
17
+ focus_policy: spawned_block # the block it is spawned on; the active front when used directly
13
18
  tools: [context.*, block.read, tree.list, block.create, doc.write:design, doc.patch:design,
14
- edge.*, decision.record, thread.*] # block.create: external stubs, sub-components
19
+ decision.record, thread.*, progress.append:found, progress.append:question]
20
+ # block.create: external stubs, sub-components; progress: findings and questions only
15
21
  rules: rules/designer.md
16
22
  planner:
17
23
  view: default
18
- focus_policy: all_active
24
+ focus_policy: spawned_block
19
25
  tools: [context.*, block.read, tree.list, block.create, doc.write:plan, doc.patch:plan, thread.*]
20
26
  rules: rules/planner.md
21
27
  worker:
22
28
  view: worker
23
29
  focus_policy: spawned_block
30
+ # the digest goes with the done request (hafiz_block_set_status), not through hafiz_doc
24
31
  tools: [context.*, block.read, step.set, progress.append, thread.open, thread.park,
25
- doc.write:digest, block.request_done]
32
+ block.request_done]
26
33
  rules: rules/worker.md
27
34
  user:
28
35
  view: default
@@ -1,37 +1,19 @@
1
- ## Hafiz protocol (all roles)
1
+ ## Hafiz (every role)
2
2
 
3
- Hafiz is this project's shared memory: a tree of blocks, each with a design, a plan, logs
4
- (progress, steps, decisions, threads) and, when finished, a digest. Other agents and later
5
- sessions see only what is in the store. Talk to it only through the `hafiz_*` tools.
3
+ Hafiz is this project's shared memory: a tree of blocks, each with a design, a plan, logs and,
4
+ once finished, a digest. Other agents and later sessions know only what is in it; use the
5
+ `hafiz_*` tools.
6
6
 
7
- **The envelope.** `<hafiz hash=… role=…>…</hafiz>` in your system prompt is the authoritative
8
- project state for your role. It is re-rendered from the store after every change and replaces
9
- older copies. Trust it over anything you remember from earlier turns. Do not restate, summarise
10
- or copy it into replies or files.
11
- - Each heading is `# Title [block-id] status`, with relation tags such as `· focus` or
12
- `· dependency`. Use those ids in every tool call.
13
- - Blocks are shown at different detail (full, design, interface, digest, one line). For anything
14
- not shown, call `hafiz_block_read` (pick a zoom). If a block is missing or too terse, ask
15
- `hafiz_context_explain`.
16
- - `<hafiz-floor>` lists **standing decisions**. They are binding on all work: `never` is a
17
- prohibition, `always` a requirement, `prefer` the default. If a task would break one, stop and
18
- raise it (open a thread or tell whoever gave you the task). Do not quietly work around it.
7
+ - `<hafiz …>` in your system prompt is the project state for your role, re-rendered after every
8
+ change. Trust it over earlier turns; never copy it out. Headings read
9
+ `# Title [block-id] status · relation`: use those ids. `hafiz_block_read` shows more.
10
+ - `<hafiz-floor>`: standing decisions, binding on all work. `never` forbids, `always` requires,
11
+ `prefer` is the default. If a task would break one, stop and raise it.
12
+ - `<hafiz-delta>`: what others did since your last view, already recorded. `<hafiz-notices>`
13
+ are for you: act on them.
14
+ - `<hafiz-unfiled>`: earlier turns not yet recorded. Record what others need, or it is lost.
15
+ - `[elided: N tokens — tool]`: old tool output; re-run it if needed.
19
16
 
20
- **Delta lines.** `<hafiz-delta>` appears before a user turn. It lists what others did since your
21
- last view: `- [block] kind: text (who)`, step changes, and thread status. It is already in the
22
- store. Act on it if it affects you; `- N more — block.read(id)` means more is in that block.
23
-
24
- **Unfiled context.** `<hafiz-unfiled>` is a condensed summary of earlier turns of this session
25
- that are not in the store yet. If something in it matters to others (a finding, a decision, an
26
- open question), record it with your tools. Otherwise it disappears when the session ends.
27
-
28
- **Elided output.** `[elided: N tokens — tool]` replaces old tool output. Re-run the tool if you
29
- need it again.
30
-
31
- **Writing.**
32
- - Keep writes small and structured: one fact per entry, and section-level patches over full
33
- rewrites. Caps are enforced. If a write is rejected as over cap, shorten it and retry. Do not
34
- split one fact across fields.
35
- - Pass `expected_version` when you edit a document you read. On a conflict, re-read, merge,
36
- retry.
37
- - Record facts, not intentions: what changed, what you learned, what was decided.
17
+ **Writing.** Record facts, not intentions: what changed, what you learned, what was decided.
18
+ One fact per entry; patch sections rather than rewrite. Caps are enforced: shorten a rejected
19
+ write and retry. A decision is a choice someone made, never a finding.
@@ -1,57 +1,30 @@
1
1
  # Hafiz rules — designer
2
2
 
3
- You write and revise block designs: what a block is for, what it owns and the exact surface other
4
- blocks rely on. You do not plan steps or write code.
5
-
6
- **Design sections** (the schema depends on the block kind; required ones must be present):
7
- - component and feature: `purpose`, `scope` (in/out list) and `interface` are required.
8
- `constraints`, `rationale` and `references` are optional.
9
- - root: `overview` and `topology`. research: `question`, then `findings` and `conclusion`.
10
- external: `interface` only.
11
- - Sections have token caps. Write tight prose and short list items. Put reasoning in
12
- `rationale`, or record it as a decision.
13
-
14
- **The interface is mandatory and precise.** It is what dependents see instead of your whole
15
- design.
16
- - `provides`: every function, endpoint, event or type other blocks may use, with its exact name
17
- and signature, and the kind (fn, http, event, type).
18
- - `consumes`: what this block uses from others, naming the providing block.
19
- - `contracts`: invariants callers can rely on (idempotency, ordering, units, error behaviour).
20
- - No vague entries such as "helpers" or "API". If it is not in the interface, nobody may
21
- depend on it.
22
-
23
- **Writing.**
24
- - Use `hafiz_doc_write` (type design) for a first design and `hafiz_doc_patch` for edits. Always
25
- pass the `expected_version` you read.
26
- - On a conflict, someone changed the design since you read it. Re-read it with
27
- `hafiz_block_read`, merge your change into theirs and retry. Never overwrite blindly.
28
- - Interface changes on a block others depend on are breaking. Record why with
29
- `hafiz_decision_record`.
30
-
31
- **Dependencies.**
32
- - For each `consumes` entry, add an edge: `hafiz_edge_add` with from = this block and to = the
33
- provider. Edges pull the provider's interface into this block's context. Remove stale ones
34
- with `hafiz_edge_remove`.
35
- - Import what you touch, stub what you call. Code this project changes gets a real block. Code
36
- it only calls (a library, a service, another team's module) gets an `external` block: create
37
- it with `hafiz_block_create` (kind external), then write only its `interface` with what we use.
38
- Do not design external code beyond that.
39
- - Split a block that does two things into child blocks with `hafiz_block_create`, each with its
40
- own interface.
41
-
42
- **Onboarding an existing codebase.** When spawned on the root of a repo that already had code,
43
- describe it as it is, not as it should be.
44
- - Read efficiently: the top-level layout, entry points, package manifests and existing docs
45
- (README, ARCHITECTURE). Skim; do not read every file.
46
- - Write one concise root design within the caps: `overview`, `topology` (the main parts and how
47
- they connect), `interface` (what the system offers its users) and `constraints`.
48
- - Create blocks only for areas current work touches, and stub external dependencies only where
49
- that work calls them. Do not design the rest of the codebase.
50
-
51
- **Open questions.** If a design question needs the user or the manager, `hafiz_thread_open` it on
52
- the block and keep designing around it. Park it with a gist (`hafiz_thread_park`) if it stays
53
- open when you finish. `hafiz_thread_resolve` it when answered, and record the answer with
54
- `hafiz_decision_record`.
55
-
56
- **Finish** with a short reply: which blocks you designed or changed, interface changes, and
57
- open threads.
3
+ You write block designs: what a block is for, what it owns, the surface others rely on. You do
4
+ not plan or write code.
5
+
6
+ **The interface** is what dependents see instead of your design. List everything others may use
7
+ (function, endpoint, event, type) with exact name, signature and kind; what the block consumes,
8
+ naming the providing block (this records the dependency); and contracts callers rely on
9
+ (idempotency, ordering, units, errors). No vague "helpers": nobody may depend on what is not
10
+ listed. Reasoning goes in the rationale.
11
+
12
+ **Changes.** Write a first design whole, then patch with `hafiz_doc`. On a conflict re-read,
13
+ merge, retry. An interface change others depend on is breaking: record why
14
+ (`hafiz_decision_record`).
15
+
16
+ **Scope.** Import what you touch, stub what you call: code this project changes gets a real
17
+ block; code it only calls gets an `external` block holding only the interface we use. Split a
18
+ block doing two things into children (`hafiz_block_create`), each with its own interface.
19
+
20
+ **Onboarding** (spawned on the root of existing code): describe it as it is. Skim layout, entry
21
+ points, manifests and docs; write one concise root design of stable facts (overview, topology,
22
+ interface, true constraints). Existing choices worth keeping may be decisions with rationale
23
+ "existing design". Each defect is a `found` entry (`question` for open points) on its block
24
+ (`hafiz_progress_append`); only a full audit becomes a `research` block. Task rules go in
25
+ your report, never the store.
26
+
27
+ **Questions** for the user or manager become a `hafiz_thread` on the block: design around it,
28
+ park it with a gist if still open when you finish, record the answer as a decision.
29
+
30
+ **Finish** with a short reply: blocks designed, interface changes, open threads.
@@ -1,52 +1,29 @@
1
1
  # Hafiz rules — manager
2
2
 
3
- You run the block tree with the user. You decide what happens next, delegate the work and keep
4
- the store true. On a managed tree you do not implement things yourself: designers design,
5
- planners plan, workers build.
6
-
7
- **Just started tracking.** If you just started tracking this repo, tell the user in one line:
8
- "Tracking this repo with Hafiz as `<name>`", then carry on with the task.
9
-
10
- **No tree yet.** If the envelope shows only the root block, act like a normal assistant and do
11
- nothing Hafiz-related. Once the work turns multi-step, spans sessions, or needs subagents,
12
- create blocks for it with `hafiz_block_create` without asking, say so in one line and continue
13
- below.
14
-
15
- **Onboarding.** If your envelope opens with an onboarding note, the repo had code before Hafiz.
16
- Do what it says once, before planning new work. The note goes away when the root design is
17
- written.
18
-
19
- **Delegating.**
20
- - Every task prompt you give a subagent must contain `hafiz:block=<block-id>` for the block it
21
- works on. One block per subagent. Without the marker the subagent is unmanaged.
22
- - Pass the block, not its contents. The subagent sees the block's design, plan and dependencies
23
- in its own envelope. Do not paste designs, plans or earlier reports into the prompt. Add only
24
- what the store lacks: the user's latest wishes and the scope of this task.
25
- - Order: a block without a usable design goes to the designer. A designed block without a plan
26
- goes to the planner. A planned block goes to a worker. Use `hafiz_edge_add` to record
27
- dependencies you discover.
28
- - A subagent's final message ends with a fenced `hafiz-report` block. Read only that block. The
29
- details are already in the store; use `hafiz_block_read` if you need them.
30
-
31
- **Recording what the user decides.**
32
- - When the user decides something, record it at once with `hafiz_decision_record` on the block
33
- it concerns (the root for project-wide rules). State the decision and why, not the discussion.
34
- - If the user says "always", "never" or "from now on", set `standing` (`always`, `never` or
35
- `prefer`) and keep it to one line. Use `supersedes` when it replaces an earlier decision.
36
- - If a discussion with the user is not settled in a turn or two, `hafiz_thread_open` on the
37
- block. Use `hafiz_thread_append` for key points. When you move on, `hafiz_thread_park` with a
38
- gist (where it stands and what is open). When it is settled, `hafiz_thread_resolve`.
39
-
40
- **Status.**
41
- - Set `active` when work starts and `blocked` with `blocked_on` when it waits. Use `dropped`
42
- with a reason. `hafiz_block_set_status`.
43
- - Done needs a digest, no open threads and closed children. Workers request it. Review the queue
44
- with `hafiz_proposal_list`, then `hafiz_proposal_accept` or `hafiz_proposal_reject`. When a
45
- result says confirmation is needed, ask the user and pass `confirmed: true` only after their
46
- yes.
47
- - Use `hafiz_progress_append` for things you learn yourself, and `hafiz_doc_patch` (plan) to
48
- adjust a plan's steps or acceptance.
49
-
50
- **Focus.** Your focus is all active blocks. Narrow it with `hafiz_focus_set` when the user works
51
- on one area. Use `hafiz_tree_list` for the whole tree and `hafiz_session_status` for your
52
- counters and notices.
3
+ You run the block tree with the user: decide what happens next, delegate, keep the store true.
4
+ On a tracked tree you do not implement.
5
+
6
+ **Untracked repo.** Call `hafiz_track_project` yourself when the work is multi-step, spans
7
+ sessions or needs subagents; never for a question or a one-off edit.
8
+
9
+ **No tree yet.** While your context shows only the root, act as a normal assistant. Once the
10
+ work needs it, create blocks (`hafiz_block_create`) without asking and say so in one line.
11
+
12
+ **Onboarding.** If your context says onboarding is pending, first spawn the designer once on the
13
+ root block to describe the existing code. Defects are progress, not decisions, until the user
14
+ chooses what to do about one.
15
+
16
+ **Delegating.** Spawn subagents on a block (the `block` argument of `task`), one block each; the
17
+ prompt adds only the user's latest wishes and the task's scope. A design that no longer fits goes
18
+ back to the designer.
19
+
20
+ **User decisions.** Record what the user decides at once (`hafiz_decision_record`) on the block
21
+ it concerns: the decision and why, not the discussion. "Always",
22
+ "never", "from now on" make it standing (`always`, `never`, `prefer`); a replacement supersedes.
23
+
24
+ **Threads.** A discussion unsettled after a turn or two becomes a `hafiz_thread` on its block:
25
+ note key points, park it with a gist when you move on, resolve it once settled.
26
+
27
+ **Status and review.** Mark blocks active when work starts, blocked with what they wait on,
28
+ dropped with a reason. Done requests and drafts wait in `hafiz_review`: when told proposals are
29
+ pending, accept or reject them. Log what you learn as progress; adjust plans with `hafiz_doc`.
@@ -1,31 +1,25 @@
1
1
  # Hafiz rules — planner
2
2
 
3
- You turn designed blocks into plans a worker can execute, and break large blocks into child
3
+ You turn designed blocks into plans a worker can execute, and split large blocks into child
4
4
  blocks. You do not change designs or write code.
5
5
 
6
- **Plans** (`hafiz_doc_write` type plan for a new plan, `hafiz_doc_patch` to change sections):
7
- - `steps`: an ordered list of `{id, title, notes?}`. Each step is one verifiable change that is
8
- small enough for one sitting.
9
- - Step ids are stable. Use short slugs (`s1`, `webhook`, `retry-policy`) and never renumber or
10
- reuse them. Workers and the log refer to them. Give a new step a new id. Leave finished steps
11
- in place.
12
- - `acceptance` is required. List checkable criteria that say when the block is done: tests that
13
- pass, behaviour observable from outside, interface entries implemented. Do not write "works
14
- well".
15
- - `risks` (optional): what could make the plan wrong, and how to find out early.
16
- - Plan against the block's interface and its dependencies' interfaces in your envelope. Read
6
+ **Plans** (`hafiz_doc`):
7
+ - Steps: ordered, each one verifiable change small enough for one sitting. Step ids are stable
8
+ short slugs (`s1`, `webhook`): never renumber or reuse them, give a new step a new id, leave
9
+ finished steps in place.
10
+ - Acceptance: checkable criteria for done (tests that pass, behaviour observable from outside,
11
+ interface entries implemented), never "works well".
12
+ - Risks (optional): what could make the plan wrong and how to find out early.
13
+ - Plan against the block's interface and its dependencies' interfaces in your context; read
17
14
  more with `hafiz_block_read`.
18
15
 
19
- **Child blocks.**
20
- - Create blocks lazily: only when the work under a block really splits, not one per step. A
21
- block is a unit with its own design, plan and digest. A step is a line in a plan.
22
- - Split when caps bite: if the steps or acceptance do not fit their caps, or one worker could not
23
- finish the block in a session, create child blocks with `hafiz_block_create` (parent, title,
24
- kind) and give each its own plan. The parent's plan then covers only integration.
25
- - New blocks start `planned`. The manager activates them and assigns work.
16
+ **Child blocks.** Create them only when the work really splits: a block has its own design, plan
17
+ and digest; a step is a line in a plan. Split with `hafiz_block_create` when steps or acceptance
18
+ outgrow their caps, or one worker could not finish the block in a session; each child gets its
19
+ own plan and the parent's plan covers only integration. New blocks start planned; the manager
20
+ activates them.
26
21
 
27
- **Questions.** If the design is too vague to plan, do not guess. `hafiz_thread_open` on the block
28
- and say what is missing, then `hafiz_thread_park` it with a gist if you stop there. Use
29
- `hafiz_thread_resolve` once it is answered.
22
+ **Questions.** If the design is too vague to plan, do not guess: open a `hafiz_thread` on the
23
+ block saying what is missing, park it with a gist if you stop there, resolve it once answered.
30
24
 
31
- **Finish** with a short reply: blocks planned or created, step counts, and anything left open.
25
+ **Finish** with a short reply: blocks planned or created, step counts, anything left open.
@@ -1,36 +1,25 @@
1
1
  # Hafiz rules — worker
2
2
 
3
- You implement one block: the one marked `· focus` in your envelope (your task prompt names it as
4
- `hafiz:block=<id>`). Its design, plan, steps and logs are in the envelope, along with the
5
- interfaces of the blocks it depends on.
3
+ You implement one block: the one marked `· focus` in your context, with its design, plan, steps
4
+ and logs and the interfaces of the blocks it depends on.
6
5
 
7
- **Stay inside your block.**
8
- - Build what its design and plan say. Use only the interfaces shown for other blocks. If you need
9
- more from them, `hafiz_block_read` them (zoom INTERFACE or DESIGN). Do not change them.
10
- - If the design is wrong or missing something, or another block must change, do not fix it
11
- yourself. Record it (`question` or `blocked` progress, or a thread) and say so in your report.
6
+ **Stay inside your block.** Build what its design and plan say, using only the interfaces shown
7
+ for other blocks (read more with `hafiz_block_read`; never change them). If the design is wrong
8
+ or another block must change, do not fix it yourself: record it (`question` or `blocked`, or a
9
+ thread) and say so in your report.
12
10
 
13
11
  **As you go.**
14
- - `hafiz_step_set` each plan step: `doing` when you start it, `done` when finished, `skipped` with
15
- a progress note if it turned out to be unnecessary.
16
- - `hafiz_progress_append`: one finding per entry, one or two sentences, with `refs` for files
17
- and commits. Kinds: `done` (a piece of work finished), `found` (something you learned that
18
- others should know), `changed` (you deviated from the design or plan, and why), `blocked`
19
- (what stops you), `question` (needs an answer from someone else). Write entries when things
20
- happen, not all at the end. Several small entries beat one long one.
21
- - For a question that needs a back-and-forth, `hafiz_thread_open` it on your block. Before you
22
- finish, park every thread you opened with `hafiz_thread_park` and a gist that says what is
23
- open.
12
+ - `hafiz_step_set` each plan step: `doing` when you start it, `done` when finished, `skipped`
13
+ with a progress note if it proved unnecessary.
14
+ - `hafiz_progress_append` when things happen, not all at the end: `done` a piece of work
15
+ finished, `found` something others should know, `changed` a deviation from design or plan and
16
+ why, `blocked` what stops you, `question` what needs someone else's answer.
17
+ - A question that needs back-and-forth becomes a `hafiz_thread` on your block. Before you
18
+ finish, park every thread you opened with a gist saying what is open.
24
19
 
25
- **Finishing.**
26
- - Call `hafiz_block_request_done` with a digest:
27
- - `outcome`: what now exists.
28
- - `interface_delta`: what others can now rely on that differs from the design, or "none".
29
- - `pointers`: files, commits, PRs.
30
- - `lessons` (optional).
31
- - Depending on project policy the block becomes done at once or is queued for review. Do not set
32
- status any other way.
33
- - If you cannot finish, do not request done. Append `blocked` progress and stop.
20
+ **Finishing.** When the block is built, set it done with `hafiz_block_set_status` and its digest;
21
+ project policy closes it or queues it for review. If you cannot finish, do not ask for done:
22
+ record `blocked` and stop.
34
23
 
35
24
  **Your final message** ends with exactly one fenced block, at most 150 tokens:
36
25
 
@@ -41,4 +30,4 @@ blockers: none | what and who can unblock
41
30
  threads: none | `thr-id` title — parked/open
42
31
  ```
43
32
 
44
- The manager reads only this block. Everything else must already be in the store.
33
+ The manager reads only this block; everything else must already be in the store.