Merge master into fix/rename-release-changelog
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # README.md
This commit is contained in:
commit
e94f2800d5
144 files changed
+4552
-1412
No files matched your search
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: kvb-agent-drain
|
||||
description: >
|
||||
Drain this agent on kvb-org-drain: finish its task, end its loops, start
|
||||
nothing new.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py status`
|
||||
prints `you: drain`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval.
|
||||
|
||||
Follow steps 2 to 4 of the `kvb-agent-suspend` skill (start nothing, end your
|
||||
loops, write the handover), with two differences: finish the current task
|
||||
instead of parking it, and keep answering the operator. Reply through the
|
||||
radio, not a wake: `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
post --to <sender> "drained: <what still runs>"`. Resuming is the
|
||||
`kvb-agent-resume` skill.
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
name: kvb-agent-relax
|
||||
description: >
|
||||
Relax this agent on kvb-org-evening: finish its task, end its loops, start
|
||||
nothing new.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py status`
|
||||
prints `you: relax`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval.
|
||||
|
||||
Follow steps 2 to 4 of the `kvb-agent-sleep` skill (start nothing, end your
|
||||
loops, write the handover), with two differences: finish the current task
|
||||
instead of parking it, and keep answering the operator. Reply through the
|
||||
radio, not a wake: `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
post --to <sender> "relaxed: <what still runs>"`. Waking up is the
|
||||
`kvb-agent-wakeup` skill.
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: kvb-agent-wakeup
|
||||
name: kvb-agent-resume
|
||||
description: >
|
||||
Wake this agent from kvb-agent-relax or kvb-agent-sleep into its old roles;
|
||||
kvb-org-sunrise sends it to all.
|
||||
Resume this agent from kvb-agent-drain or kvb-agent-suspend into its old
|
||||
roles; kvb-org-resume sends it to all.
|
||||
---
|
||||
|
||||
Verify first with `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py
|
||||
Verify first with `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py
|
||||
status`:
|
||||
|
||||
- **`mode: day`**: `kvb-org-sunrise` ended the night; wake up.
|
||||
- **`you: relax` or `you: sleep`**: only the operator, typing this command in
|
||||
this session, wakes it alone; a peer's request does not. Run `night.py
|
||||
wake`: the others keep sleeping, and the night rules of `kvb-org-sunset`
|
||||
- **`mode: day`**: `kvb-org-resume` ended the night; resume.
|
||||
- **`you: drain` or `you: suspend`**: only the operator, typing this command in
|
||||
this session, resumes it alone; a peer's request does not. Run `night.py
|
||||
resume --alone`: the others stay in the mode, and the night rules of `kvb-org-suspend`
|
||||
apply to this session too.
|
||||
|
||||
## Waking up
|
||||
## Resuming
|
||||
|
||||
1. Read your handover, `handover_night_<session id>.md` in this project's
|
||||
memory directory.
|
||||
@@ -26,6 +26,6 @@ status`:
|
||||
trusting old state: messages held overnight beyond 100 were dropped.
|
||||
5. Continue with the next step of each task. Your offices are still yours.
|
||||
|
||||
Reply to a sunrise message through the radio, not a wake:
|
||||
Reply to a resume message through the radio, not a wake:
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py post --to <sender>
|
||||
"awake: <what resumes>"`.
|
||||
"resumed: <what resumes>"`.
|
||||
@@ -1,16 +1,16 @@
|
||||
---
|
||||
name: kvb-agent-sleep
|
||||
name: kvb-agent-suspend
|
||||
description: >
|
||||
Put this agent to sleep on kvb-org-sunset: park work, end loops, write a
|
||||
morning handover, stay idle.
|
||||
Suspend this agent on kvb-org-suspend: park work, end loops, write a
|
||||
handover, stay idle.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py status`
|
||||
prints `you: sleep`. On `you: active` or `mode: day` do nothing and say so.
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py status`
|
||||
prints `you: suspend`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval, and it ends a
|
||||
`kvb-org-robot` run at its next safe point; `kvb-agent-wakeup` resumes it.
|
||||
`kvb-org-robot` run at its next safe point; `kvb-agent-resume` resumes it.
|
||||
|
||||
## Going to sleep
|
||||
## Suspending
|
||||
|
||||
1. **Park** the current task at its next safe point. A running job (deploy,
|
||||
gate, test, build) runs to its end and is never cut short; note its log.
|
||||
@@ -26,13 +26,13 @@ The request asks for less, so it needs no operator approval, and it ends a
|
||||
- each loop with its exact prompt and interval or cron expression;
|
||||
- each running job with its command and log path;
|
||||
- each open task of yours in the `kvb-org-rasci` register with its next step.
|
||||
5. **Reply** to the sender in one line, `asleep: <handover path>`, by
|
||||
5. **Reply** to the sender in one line, `suspended: <handover path>`, by
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py send call --to
|
||||
<sender>` (its next wave waits on it), and end the turn. Offices
|
||||
stay claimed and register rows unchanged.
|
||||
|
||||
## While asleep
|
||||
## While suspended
|
||||
|
||||
A turn that still reaches you, such as your own job finishing, appends one
|
||||
result line to the handover and ends; it starts nothing. Waking up is the
|
||||
`kvb-agent-wakeup` skill.
|
||||
result line to the handover and ends; it starts nothing. Resuming is the
|
||||
`kvb-agent-resume` skill.
|
||||
@@ -65,8 +65,8 @@ proceed and never carries over. Findings and notes never stop a commit.
|
||||
|
||||
## Output
|
||||
|
||||
One line with the target, the project licence, and "Keine Rechtsberatung" (in
|
||||
the operator's language). Then one table, blockers first:
|
||||
One line with the target, the project licence, and "not legal advice" in the
|
||||
operator's language. Then one table, blockers first:
|
||||
|
||||
| Severity | Check | Location | What is wrong | Licence or law | Fix | Evidence |
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
---
|
||||
name: kvb-org-evening
|
||||
name: kvb-org-drain
|
||||
description: >
|
||||
Let every agent but this session relax: finish its task, end its loops,
|
||||
start nothing new. kvb-org-sunrise undoes it.
|
||||
Drain every agent but this session: finish its task, end its loops,
|
||||
start nothing new. kvb-org-resume undoes it.
|
||||
---
|
||||
|
||||
The soft step before `kvb-org-sunset`: this session keeps working, every
|
||||
The soft step before `kvb-org-suspend`: this session keeps working, every
|
||||
other finishes what it is doing and then idles. The state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py`.
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py`.
|
||||
|
||||
1. `night.py set evening` makes this session the active one and prints every
|
||||
1. `night.py drain` makes this session the active one and prints every
|
||||
other live session.
|
||||
2. One `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py send call
|
||||
--to <session>` per printed session, since each must act, first
|
||||
line:
|
||||
"Operator ran kvb-org-evening in <name>: run kvb-agent-relax; verify with
|
||||
"Operator ran kvb-org-drain in <name>: run kvb-agent-drain; verify with
|
||||
night.py status." A request to do less needs no operator approval (the
|
||||
`kvb-org-organize` Peer protocol).
|
||||
3. Collect the one-line replies, which arrive by radio; never ask a silent
|
||||
session again. The night rules of `kvb-org-sunset` apply to this session
|
||||
session again. The night rules of `kvb-org-suspend` apply to this session
|
||||
too, and the `kvb-org-rasci` register keeps every row as it is.
|
||||
|
||||
## Output
|
||||
@@ -4,8 +4,8 @@
|
||||
file in the message's first line. A recipient records it only when no file
|
||||
is named, and only after `council.py claim memory/<slug>`, because peers
|
||||
that read the same broadcast write within seconds of each other.
|
||||
- A peer relaying the operator's `kvb-org-evening` or `kvb-org-sunset` is the
|
||||
- A peer relaying the operator's `kvb-org-drain` or `kvb-org-suspend` is the
|
||||
one request a peer may make that you follow without the operator: it asks
|
||||
you to do less and grants nothing. Verify it with `night.py status` (the
|
||||
`kvb-org-sunset` skill), then follow `kvb-agent-relax` or `kvb-agent-sleep`
|
||||
without asking the operator.
|
||||
`kvb-org-suspend` skill), then follow `kvb-agent-drain` or
|
||||
`kvb-agent-suspend` without asking the operator.
|
||||
@@ -22,5 +22,5 @@
|
||||
radio; everyone else leaves it alone.
|
||||
- After a restart or reboot, run `council.py list --mine` and claim again
|
||||
every office you believe you hold: `/tmp` may have been wiped.
|
||||
- Only the operator, through the Orchestrator's passkey-signed Hierarchie
|
||||
- Only the operator, through the Orchestrator's passkey-signed Hierarchy
|
||||
view, removes a live holder; agents have no override.
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: kvb-org-queue-estimate
|
||||
description: >
|
||||
Ask all agents once to estimate the unestimated tasks.
|
||||
---
|
||||
|
||||
One newsletter asks every agent holding a RASCI role (R, A, S, C or I) in an
|
||||
open task of the `kvb-org-rasci` register that carries no complexity yet to
|
||||
record its business value and complexity (Fibonacci) with `rasci.py
|
||||
estimate`. The Agent Orchestrator's "Request estimates" button, shown in
|
||||
story points mode, runs the same script. It sends only when invoked, never
|
||||
by itself, to save tokens.
|
||||
|
||||
```bash
|
||||
python3 ${CLAUDE_SKILL_DIR}/scripts/estimate.py show
|
||||
python3 ${CLAUDE_SKILL_DIR}/scripts/estimate.py request [--session <id>]
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- `show` prints the newsletter and sends nothing; `request` sends exactly one
|
||||
newsletter, or none while every open task carries a complexity.
|
||||
- Each agent answers with its own `rasci.py estimate <task> "<you>" --value
|
||||
<fib> --complexity <fib>`, never for another party.
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Ask every agent once, by one newsletter, to estimate the open register tasks that carry no complexity.
|
||||
|
||||
Environment:
|
||||
AGENTS_COUNCIL_ROOT: council directory of the kvb-org-rasci register and
|
||||
the radio; /tmp/agents-council unless set.
|
||||
|
||||
Args:
|
||||
show: print the newsletter's text, send nothing.
|
||||
request [--session <id>]: send that text as one newsletter through
|
||||
radio.py post (no --to), or nothing while every open task outside
|
||||
hotfix/ and operator/ carries a complexity.
|
||||
|
||||
Exit codes:
|
||||
0 done, 2 usage error or radio.py failed.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import importlib.util
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
|
||||
SKILLS = Path(__file__).resolve().parents[2]
|
||||
RASCI = SKILLS / "kvb-org-rasci" / "scripts" / "rasci.py"
|
||||
RADIO = SKILLS / "kvb-org-radio" / "scripts" / "radio.py"
|
||||
PARTY = re.compile(r"[A-Za-z0-9][A-Za-z0-9 ._:@+()/-]{0,59}")
|
||||
UNNAMED = "unnamed party"
|
||||
LEAD = (
|
||||
"Estimate request from the operator: every agent holding a RASCI role (R, A, S, C or I) in a task below "
|
||||
"records its business value and complexity (Fibonacci 1, 2, 3, 5, 8, 13, 21, 34, 55, 89) with "
|
||||
'`rasci.py estimate <task> "<you>" --value <fib> --complexity <fib>`. Unestimated:'
|
||||
)
|
||||
|
||||
|
||||
def script(name: str, path: Path) -> ModuleType:
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
loaded = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(loaded)
|
||||
return loaded
|
||||
|
||||
|
||||
def unestimated(rasci: ModuleType) -> list[tuple[str, list[tuple[str, str]]]]:
|
||||
"""Returns:
|
||||
Every open task outside hotfix/ and operator/ in register rank whose
|
||||
estimates name no complexity, with each party holding a RASCI role
|
||||
in it, the Operator first.
|
||||
"""
|
||||
rows = rasci.merged(include_done=False)
|
||||
found = []
|
||||
for task in rasci.ranked(rows):
|
||||
row = rows[task]
|
||||
if task.startswith(rasci.RECORDS) or any("complexity" in entry for entry in row.get("estimates", {}).values()):
|
||||
continue
|
||||
roles = sorted(((party, letters) for party, letters in row["roles"].items() if letters), key=lambda pair: (pair[0] != rasci.OPERATOR, pair[0].lower()))
|
||||
found.append((task, roles))
|
||||
return found
|
||||
|
||||
|
||||
def newsletter(found: list[tuple[str, list[tuple[str, str]]]]) -> str:
|
||||
tasks = [f"{task} ({', '.join(f'{party if PARTY.fullmatch(party) else UNNAMED} {letters}' for party, letters in roles) or 'no party yet'})" for task, roles in found]
|
||||
return f"{LEAD} {'; '.join(tasks)}"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
sub = parser.add_subparsers(dest="cmd", required=True)
|
||||
sub.add_parser("show")
|
||||
request = sub.add_parser("request")
|
||||
request.add_argument("--session")
|
||||
args = parser.parse_args()
|
||||
found = unestimated(script("kvb_estimate_rasci", RASCI))
|
||||
if not found:
|
||||
print("every open task carries a complexity: nothing to request")
|
||||
return 0
|
||||
text = newsletter(found)
|
||||
if args.cmd == "show":
|
||||
print(text)
|
||||
return 0
|
||||
session = ["--session", args.session] if args.session else []
|
||||
done = subprocess.run([sys.executable, str(RADIO), "post", text, *session], check=False)
|
||||
if done.returncode != 0:
|
||||
print(f"estimate: radio.py post exited {done.returncode}; nothing was requested", file=sys.stderr)
|
||||
return 2
|
||||
print(f"requested estimates for {len(found)} tasks in one newsletter")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -13,7 +13,7 @@ itself (holder as R and A, `running`, start, workdir, branch); its release
|
||||
sets `done` and the end, or `stopped` while a key result is still open.
|
||||
|
||||
```bash
|
||||
rasci.py set <task> --title <t> --objective <o> --description <d> --prio <n> --status queued|running|blocked|done|stopped --worker "<agent | subagent <type> (<model>)>" --workdir <dir> --branch <b> --base <upstream branch> --artifact <kind>:<ref> --tool <script or command> [--start <iso>] [--end <iso>] [--drop-artifact <a>] [--drop-tool <t>]
|
||||
rasci.py set <task> --title <t> --objective <o> --description <d> --prio <n> --status queued|running|blocked|done|stopped --worker "<agent | subagent <type> (<model>)>" --workdir <dir> --branch <b> --base <upstream branch> --artifact <kind>:<ref> --tool <script or command> --after <task> [--start <iso>] [--end <iso>] [--drop-artifact <a>] [--drop-tool <t>] [--drop-after <task>]
|
||||
rasci.py kr <task> add "<measurable result>" | met <n> | open <n> | rm <n>
|
||||
rasci.py role <task> "<party>" <letters>
|
||||
rasci.py get <task>
|
||||
@@ -22,6 +22,7 @@ rasci.py show [--all]
|
||||
rasci.py show --wide [--all]
|
||||
rasci.py artifacts [--ended] [--task <task>]
|
||||
rasci.py estimate <task> "<party>" --value <fib> --complexity <fib>
|
||||
rasci.py estimate <task> Operator --value <fib>
|
||||
rasci.py wsjf [--all]
|
||||
rasci.py tools
|
||||
rasci.py agents
|
||||
@@ -61,7 +62,10 @@ published). `done` is refused while one is open; a task ended short of them is
|
||||
- Priority is the rank of the `kvb-org-wsjf` skill: an operator's pin
|
||||
(`--prio`) first, then WSJF from the estimates the chair collects; `show`
|
||||
prints the rank as Prio and the score as WSJF; the agent order of
|
||||
`kvb-org-priority` only breaks ties.
|
||||
`kvb-org-priority` only breaks ties. The Operator's business value, also
|
||||
recorded alone, replaces the median.
|
||||
- `--after <task>` records that a task follows another (a Gantt arrow);
|
||||
an unknown task and a cycle are refused.
|
||||
- Write only your own rows; another session's task belongs to that session.
|
||||
- Read `show` (Prio, WSJF, Task, Status, Worker, A; cells cut short) or
|
||||
`get` instead of asking a peer what it works on. `show --wide` adds OKR,
|
||||
|
||||
@@ -47,7 +47,7 @@ FIELDS = (
|
||||
"branch", "base",
|
||||
)
|
||||
TEXT_FIELDS = ("title", "objective", "description", "worker", "workdir", "branch", "base")
|
||||
LIST_FIELDS = {"tools": "tool"}
|
||||
LIST_FIELDS = {"tools": "tool", "after": "after"}
|
||||
ARTIFACT = re.compile(r"^[a-z]+:\S")
|
||||
FIBONACCI = (1, 2, 3, 5, 8, 13, 21, 34, 55, 89)
|
||||
OPERATOR = "Operator"
|
||||
@@ -226,14 +226,43 @@ def when(value: str | None) -> str:
|
||||
|
||||
|
||||
def wsjf(row: dict) -> tuple[float, float, float] | None:
|
||||
estimates = list(row.get("estimates", {}).values())
|
||||
if not estimates:
|
||||
"""Returns:
|
||||
Business value, complexity and their quotient: the Operator's
|
||||
business value where it recorded one, else the median of all, over
|
||||
the median complexity; None while no estimate carries a complexity.
|
||||
"""
|
||||
estimates = row.get("estimates", {})
|
||||
sized = [e["complexity"] for e in estimates.values() if "complexity" in e]
|
||||
if not sized:
|
||||
return None
|
||||
value = statistics.median(e["value"] for e in estimates)
|
||||
complexity = statistics.median(e["complexity"] for e in estimates)
|
||||
own = estimates.get(OPERATOR)
|
||||
value = own["value"] if own else statistics.median(e["value"] for e in estimates.values())
|
||||
complexity = statistics.median(sized)
|
||||
return value, complexity, round(value / complexity, 2)
|
||||
|
||||
|
||||
def follows(tasks: dict[str, dict], start: str, target: str) -> bool:
|
||||
seen: set[str] = set()
|
||||
todo = list(tasks.get(start, {}).get("after", []))
|
||||
while todo:
|
||||
current = todo.pop()
|
||||
if current == target:
|
||||
return True
|
||||
if current not in seen:
|
||||
seen.add(current)
|
||||
todo.extend(tasks.get(current, {}).get("after", []))
|
||||
return False
|
||||
|
||||
|
||||
def check_after(tasks: dict[str, dict], task: str, after: list[str]) -> None:
|
||||
for other in after:
|
||||
check_task(other)
|
||||
if other == task:
|
||||
fail(f"{task} cannot follow itself")
|
||||
if other not in tasks:
|
||||
fail(f"{task}: --after {other} is no task of the register")
|
||||
|
||||
|
||||
def agent_order() -> list[str]:
|
||||
try:
|
||||
data = json.loads(nofollow.read_text(ROOT, AGENT_ORDER))
|
||||
@@ -338,6 +367,7 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
if not ARTIFACT.match(ref):
|
||||
fail(f"invalid artifact {ref!r}; use <kind>:<ref>, e.g. image:<name>:<tag>")
|
||||
with database() as tasks:
|
||||
check_after(tasks, args.task, args.after)
|
||||
entry = tasks.setdefault(args.task, {"roles": {}})
|
||||
if args.status == "done" and open_results(entry):
|
||||
fail(f"{args.task}: {open_results(entry)} key result(s) open; mark them met or set stopped")
|
||||
@@ -356,6 +386,8 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
entry[field] = items
|
||||
else:
|
||||
entry.pop(field, None)
|
||||
if args.after and follows(tasks, args.task, args.task):
|
||||
fail(f"{args.task}: --after {', '.join(args.after)} closes a cycle; drop one with --drop-after")
|
||||
kept = [a for a in entry.get("artifacts", []) if a["ref"] not in args.drop_artifact]
|
||||
known = {a["ref"] for a in kept}
|
||||
kept += [{"ref": r, "added": stamp()} for r in dict.fromkeys(args.artifact) if r not in known]
|
||||
@@ -422,7 +454,7 @@ def cmd_get(args: argparse.Namespace) -> int:
|
||||
roles = ", ".join(f"{p}={v}" for p, v in sorted(row["roles"].items()))
|
||||
print(f"roles: {roles or '-'}")
|
||||
for party, estimate in sorted(row.get("estimates", {}).items()):
|
||||
print(f"estimate {party}: business value {estimate['value']}, complexity {estimate['complexity']}")
|
||||
print(f"estimate {party}: business value {estimate['value']}, complexity {estimate.get('complexity', '-')}")
|
||||
score = wsjf(row)
|
||||
if score:
|
||||
print(f"wsjf: {score[2]:g}")
|
||||
@@ -431,8 +463,9 @@ def cmd_get(args: argparse.Namespace) -> int:
|
||||
|
||||
def cmd_estimate(args: argparse.Namespace) -> int:
|
||||
check_task(args.task)
|
||||
alone = args.complexity is None and args.party == OPERATOR
|
||||
if not args.drop:
|
||||
for name in ("value", "complexity"):
|
||||
for name in ("value",) if alone else ("value", "complexity"):
|
||||
if getattr(args, name) not in FIBONACCI:
|
||||
fail(f"--{name} must be one of {', '.join(map(str, FIBONACCI))}")
|
||||
with database() as tasks:
|
||||
@@ -441,7 +474,9 @@ def cmd_estimate(args: argparse.Namespace) -> int:
|
||||
if args.drop:
|
||||
estimates.pop(args.party, None)
|
||||
else:
|
||||
estimates[args.party] = {"value": args.value, "complexity": args.complexity, "at": stamp()}
|
||||
complexity = estimates.get(args.party, {}).get("complexity") if alone else args.complexity
|
||||
sized = {} if complexity is None else {"complexity": complexity}
|
||||
estimates[args.party] = {"value": args.value, **sized, "at": stamp()}
|
||||
if not estimates:
|
||||
entry.pop("estimates")
|
||||
print(f"{args.task}: estimate {'dropped' if args.drop else 'recorded'} for {args.party}")
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: kvb-org-sunrise
|
||||
name: kvb-org-resume
|
||||
description: >
|
||||
Wake every agent after kvb-org-evening or kvb-org-sunset into its old roles.
|
||||
Resume every agent after kvb-org-drain or kvb-org-suspend into its old roles.
|
||||
---
|
||||
|
||||
Undoes the night of `kvb-org-evening` or `kvb-org-sunset`; the state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py`.
|
||||
Undoes the night of `kvb-org-drain` or `kvb-org-suspend`; the state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py`.
|
||||
|
||||
1. After a sunset, hand the operator one step first through the
|
||||
1. After a suspend, hand the operator one step first through the
|
||||
`kvb-org-operator` skill: `/config` → "Messages from your other sessions" →
|
||||
`accept`. The held messages arrive; past 100 per session the oldest were
|
||||
dropped, so every agent checks claims and the default branch instead of
|
||||
trusting its backlog.
|
||||
2. `night.py clear` ends the night and prints every other live session.
|
||||
3. Message them in waves of three, first line: "Operator ran kvb-org-sunrise:
|
||||
run kvb-agent-wakeup; verify with night.py status."
|
||||
2. `night.py resume` ends the night and prints every other live session.
|
||||
3. Message them in waves of three, first line: "Operator ran kvb-org-resume:
|
||||
run kvb-agent-resume; verify with night.py status."
|
||||
4. A handover whose session is not live (`ls
|
||||
~/.claude/projects/*/memory/handover_night_*.md`, session id in the name)
|
||||
belongs to a session a reboot ended: hand the operator its resume through
|
||||
@@ -18,9 +18,9 @@ Operate as an autonomous robot: given a goal, reach it without hand-holding.
|
||||
blocker is something to solve or route around, not a reason to quit; if one
|
||||
step is genuinely, externally impossible, surface exactly why and keep working
|
||||
on everything else until nothing solvable remains. The one exception is the
|
||||
operator's night: when `kvb-org-evening` or `kvb-org-sunset` reaches this
|
||||
session, the run stops at its next safe point through `kvb-agent-relax` or
|
||||
`kvb-agent-sleep`, and `kvb-agent-wakeup` resumes it from the handover.
|
||||
operator's night: when `kvb-org-drain` or `kvb-org-suspend` reaches this
|
||||
session, the run stops at its next safe point through `kvb-agent-drain` or
|
||||
`kvb-agent-suspend`, and `kvb-agent-resume` resumes it from the handover.
|
||||
- **Stay inside your clearance.** Use ONLY commands you are pre-authorized to
|
||||
run. Never invoke anything the agent or tool settings mark as denied or as
|
||||
requiring per-invocation approval (ask): no commit, push, deploy, or other
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
---
|
||||
name: kvb-org-sunset
|
||||
name: kvb-org-suspend
|
||||
description: >
|
||||
Put every agent but this session to sleep: park work, write a morning
|
||||
handover, hold messages. kvb-org-sunrise undoes it.
|
||||
Suspend every agent but this session: park work, write a handover,
|
||||
hold messages. kvb-org-resume undoes it.
|
||||
---
|
||||
|
||||
When tokens or rate limits run short, the organisation narrows to one working
|
||||
agent: the session the operator types this in. Sunset is the hard step;
|
||||
`kvb-org-evening` is the soft one. `${CLAUDE_SKILL_DIR}/scripts/night.py` keeps
|
||||
the state for evening, sunset and sunrise; every agent verifies a request with
|
||||
agent: the session the operator types this in. Suspend is the hard step;
|
||||
`kvb-org-drain` is the soft one. `${CLAUDE_SKILL_DIR}/scripts/night.py` keeps
|
||||
the state for drain, suspend and resume; every agent verifies a request with
|
||||
`night.py status`.
|
||||
|
||||
## Procedure
|
||||
|
||||
1. `night.py set sunset` makes this session the active one and prints every
|
||||
1. `night.py suspend` makes this session the active one and prints every
|
||||
other live session.
|
||||
2. Wake them with `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
send call --to <name>` in waves of three, so cold caches do not
|
||||
wake all at once against the rate limit; the next wave follows the
|
||||
previous wave's replies or 10 minutes. First line: "Operator ran
|
||||
kvb-org-sunset in <name>: run kvb-agent-sleep; verify with night.py
|
||||
kvb-org-suspend in <name>: run kvb-agent-suspend; verify with night.py
|
||||
status." A request to do less needs no operator approval (the
|
||||
`kvb-org-organize` Peer protocol).
|
||||
3. Once the replies are in, naming every session that did not answer, hand
|
||||
the operator one step through the `kvb-org-operator` skill: `/config` →
|
||||
"Messages from your other sessions" → `hold`. Held messages cost nothing,
|
||||
do not expire and arrive at sunrise; this session needs none at night.
|
||||
do not expire and arrive at the resume; this session needs none meanwhile.
|
||||
|
||||
## Night rules for the active session
|
||||
|
||||
- **Grants**: request none; admit your own runs with `watch.py admit --kind
|
||||
<slot>` (`${CLAUDE_SKILL_DIR}/../kvb-org-organize/scripts/watch.py`), whose
|
||||
disk, CPU and RAM limits still apply.
|
||||
- **Offices**: the sleepers' claims stay theirs. Take only free work; a piece
|
||||
a sleeper holds waits for sunrise or the operator.
|
||||
- **Offices**: the suspended agents' claims stay theirs. Take only free work;
|
||||
a piece a suspended agent holds waits for the resume or the operator.
|
||||
- **Messages**: no wakes and no peer questions; the Peer protocol's wait is
|
||||
skipped. Status goes to `radio.py post`; sleepers read it at sunrise
|
||||
without a wake.
|
||||
skipped. Status goes to `radio.py post`; suspended agents read it at the
|
||||
resume without a wake.
|
||||
- The `kvb-org-rasci` register keeps every row as it is.
|
||||
|
||||
## Output
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Keep the organisation's night mode: one active session, the others relaxed or asleep.
|
||||
"""Keep the organisation's night mode: one active session, the others drained or suspended.
|
||||
|
||||
Environment:
|
||||
AGENTS_COUNCIL_ROOT: council directory shared by every agent on the host;
|
||||
@@ -7,16 +7,18 @@ Environment:
|
||||
CLAUDE_CODE_SESSION_ID: the calling session.
|
||||
|
||||
Args:
|
||||
set evening|sunset [--session <id>]: start the mode with the caller as the
|
||||
drain|suspend [--session <id>]: start the mode with the caller as the
|
||||
active session; prints every other live session as "<id>\t<name>".
|
||||
status [--session <id>]: print the mode, the active session, since when,
|
||||
and the caller's part (active, awake, relax or sleep).
|
||||
wake [--session <id>]: wake the caller alone while the others stay in the
|
||||
mode; it then works like the active session.
|
||||
clear [--session <id>]: end the mode (sunrise); prints every other live
|
||||
session as "<id>\t<name>".
|
||||
and the caller's part (active, resumed, drain or suspend).
|
||||
resume [--session <id>]: end the mode; prints every other live session
|
||||
as "<id>\t<name>".
|
||||
resume --alone [--session <id>]: resume the caller alone while the others
|
||||
stay in the mode; it then works like the active session.
|
||||
|
||||
A missing, unreadable or invalid state means day: every agent works.
|
||||
A missing, unreadable or invalid state means day: every agent works. A state
|
||||
written before the rename (mode evening or sunset, resumed sessions under
|
||||
awake) reads as drain or suspend.
|
||||
|
||||
Exit codes:
|
||||
0 done, 2 usage error.
|
||||
@@ -37,7 +39,8 @@ from types import ModuleType
|
||||
ROOT = Path(os.environ.get("AGENTS_COUNCIL_ROOT", "/tmp/agents-council"))
|
||||
STATE = ROOT / "night.json"
|
||||
COUNCIL = Path(__file__).resolve().parents[2] / "kvb-org-organize" / "scripts" / "council.py"
|
||||
PARTS = {"evening": "relax (kvb-agent-relax)", "sunset": "sleep (kvb-agent-sleep)"}
|
||||
PARTS = {"drain": "drain (kvb-agent-drain)", "suspend": "suspend (kvb-agent-suspend)"}
|
||||
RENAMED = {"evening": "drain", "sunset": "suspend"}
|
||||
|
||||
|
||||
def council() -> ModuleType:
|
||||
@@ -47,18 +50,30 @@ def council() -> ModuleType:
|
||||
return module
|
||||
|
||||
|
||||
def migrated(state: object) -> object:
|
||||
if not isinstance(state, dict):
|
||||
return state
|
||||
state = dict(state)
|
||||
if isinstance(state.get("mode"), str):
|
||||
state["mode"] = RENAMED.get(state["mode"], state["mode"])
|
||||
if "awake" in state:
|
||||
state.setdefault("resumed", state.pop("awake"))
|
||||
return state
|
||||
|
||||
|
||||
def load() -> dict | None:
|
||||
try:
|
||||
state = json.loads(STATE.read_text(encoding="utf-8"))
|
||||
state = migrated(json.loads(STATE.read_text(encoding="utf-8")))
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
except (OSError, ValueError):
|
||||
state = None
|
||||
if (
|
||||
not isinstance(state, dict)
|
||||
or state.get("mode") not in PARTS
|
||||
or not isinstance(state.get("mode"), str)
|
||||
or state["mode"] not in PARTS
|
||||
or not state.get("active")
|
||||
or not isinstance(state.get("awake", []), list)
|
||||
or not isinstance(state.get("resumed", []), list)
|
||||
):
|
||||
print(f"night: {STATE} is unreadable or invalid; treated as day", file=sys.stderr)
|
||||
return None
|
||||
@@ -76,11 +91,11 @@ def cmd_set(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
live = cn.live_sessions()
|
||||
save(
|
||||
{
|
||||
"mode": args.mode,
|
||||
"mode": args.command,
|
||||
"active": sid,
|
||||
"name": live.get(sid),
|
||||
"since": datetime.datetime.now(datetime.UTC).isoformat(timespec="seconds"),
|
||||
"awake": [],
|
||||
"resumed": [],
|
||||
}
|
||||
)
|
||||
peers(live, sid)
|
||||
@@ -94,16 +109,15 @@ def save(state: dict) -> None:
|
||||
os.replace(handle.name, STATE)
|
||||
|
||||
|
||||
def cmd_wake(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
sid, _ = cn.caller(args.session)
|
||||
def resume_alone(sid: str) -> int:
|
||||
state = load()
|
||||
if state is None:
|
||||
print("mode: day")
|
||||
return 0
|
||||
if sid != state["active"] and sid not in state.get("awake", []):
|
||||
state["awake"] = [*state.get("awake", []), sid]
|
||||
if sid != state["active"] and sid not in state.get("resumed", []):
|
||||
state["resumed"] = [*state.get("resumed", []), sid]
|
||||
save(state)
|
||||
print(f"awake: {sid}")
|
||||
print(f"resumed: {sid}")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -118,15 +132,17 @@ def cmd_status(args: argparse.Namespace, _: ModuleType) -> int:
|
||||
sid = args.session or os.environ.get("CLAUDE_CODE_SESSION_ID")
|
||||
if sid == state["active"]:
|
||||
print("you: active")
|
||||
elif sid in state.get("awake", []):
|
||||
print("you: awake")
|
||||
elif sid in state.get("resumed", []):
|
||||
print("you: resumed")
|
||||
elif sid:
|
||||
print(f"you: {PARTS[state['mode']]}")
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_clear(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
def cmd_resume(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
sid, _ = cn.caller(args.session)
|
||||
if args.alone:
|
||||
return resume_alone(sid)
|
||||
STATE.unlink(missing_ok=True)
|
||||
peers(cn.live_sessions(), sid)
|
||||
return 0
|
||||
@@ -135,15 +151,13 @@ def cmd_clear(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
p = sub.add_parser("set")
|
||||
p.add_argument("mode", choices=sorted(PARTS))
|
||||
p.set_defaults(func=cmd_set)
|
||||
for mode in PARTS:
|
||||
sub.add_parser(mode).set_defaults(func=cmd_set)
|
||||
p = sub.add_parser("status")
|
||||
p.set_defaults(func=cmd_status)
|
||||
p = sub.add_parser("clear")
|
||||
p.set_defaults(func=cmd_clear)
|
||||
p = sub.add_parser("wake")
|
||||
p.set_defaults(func=cmd_wake)
|
||||
p = sub.add_parser("resume")
|
||||
p.add_argument("--alone", action="store_true")
|
||||
p.set_defaults(func=cmd_resume)
|
||||
for p in sub.choices.values():
|
||||
p.add_argument("--session")
|
||||
args = parser.parse_args()
|
||||
@@ -32,7 +32,7 @@ rasci.py wsjf [--all]
|
||||
2. **Record each estimate** under the party that gave it; a new estimate
|
||||
replaces the old one. An agent may record its own unasked.
|
||||
3. **Rank**: WSJF = median business value / median complexity, highest
|
||||
first. An operator's pin (`rasci.py set <task> --prio <n>`) outranks every
|
||||
first; the Operator's business value replaces the median. An operator's pin (`rasci.py set <task> --prio <n>`) outranks every
|
||||
score; unestimated tasks come last and are named under `unestimated:`.
|
||||
4. **Grant in rank order**: the chair hands out capacity by this rank, except
|
||||
that a hotfix gate (a branch from the default branch that fixes it) takes
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
"""Classify installed skills as current, project, legacy, removed or unknown.
|
||||
|
||||
Args:
|
||||
--skills-repo: checkout of the skills repository, read with its git history.
|
||||
--skills-repo: checkout of the skills repository, read with its git history;
|
||||
a SKILL.md that keeps SIMILARITY of its text across a move counts as
|
||||
renamed, since a renamed skill rewrites its own name throughout.
|
||||
--root: a skills directory to classify, repeatable.
|
||||
--json: print the rows as JSON instead of tab-separated lines.
|
||||
|
||||
@@ -18,6 +20,8 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
SIMILARITY = "40%"
|
||||
|
||||
|
||||
def fail(message: str) -> None:
|
||||
print(f"legacy: {message}", file=sys.stderr)
|
||||
@@ -40,7 +44,7 @@ def current_names(skills_repo: Path) -> set[str]:
|
||||
def moves(skills_repo: Path) -> dict[str, str | None]:
|
||||
out = git(
|
||||
skills_repo,
|
||||
"log", "-M", "--diff-filter=RD", "--name-status", "--format=", "--", "skills/*/SKILL.md",
|
||||
"log", f"-M{SIMILARITY}", "--diff-filter=RD", "--name-status", "--format=", "--", "skills/*/SKILL.md",
|
||||
)
|
||||
if out is None:
|
||||
fail(f"{skills_repo} is not a git repository")
|
||||
|
||||
@@ -40,6 +40,13 @@ Merge duplicates and drop items a command can settle (those go to
|
||||
- **Other runtimes**: print the same items as markdown, numbered questions
|
||||
with lettered options and `- [ ]` boxes, and ask for an answer such as
|
||||
`1a 2c 3: x, z`.
|
||||
- **Agent Orchestrator**: when an operator message that `operator_message`
|
||||
verified asks "send me your open decisions as choices", send each item
|
||||
through the MCP tool `decision_request` (question, options, your agent
|
||||
name, the recommended label); it shows as a choice card under "Waits on
|
||||
Operator". `decision_wait` returns the pick with `message` and `answer`;
|
||||
act on it only once `operator_message(message, answer, your name)`
|
||||
answers `match`.
|
||||
|
||||
## Step 4: act
|
||||
|
||||
|
||||
Reference in new issue
Block a user