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.
- package/dist/config/default/compliance.yaml +4 -4
- package/dist/config/default/hafiz.yaml +5 -7
- package/dist/config/default/nudge.yaml +1 -1
- package/dist/config/default/policies.yaml +10 -0
- package/dist/config/default/roles.yaml +13 -6
- package/dist/config/default/rules/common.md +16 -34
- package/dist/config/default/rules/designer.md +28 -55
- package/dist/config/default/rules/manager.md +27 -50
- package/dist/config/default/rules/planner.md +17 -23
- package/dist/config/default/rules/worker.md +17 -28
- package/dist/hafiz.js +3274 -2821
- package/package.json +1 -1
|
@@ -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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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:
|
|
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
|
-
|
|
35
|
-
|
|
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
|
|
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
|
|
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,
|
|
8
|
-
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
32
|
+
block.request_done]
|
|
26
33
|
rules: rules/worker.md
|
|
27
34
|
user:
|
|
28
35
|
view: default
|
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
## Hafiz
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
**
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
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** (`
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
28
|
-
|
|
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,
|
|
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
|
|
4
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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`
|
|
15
|
-
a progress note if it
|
|
16
|
-
- `hafiz_progress_append
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
27
|
-
|
|
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
|
|
33
|
+
The manager reads only this block; everything else must already be in the store.
|