feat(org): add the kvb-org-rasci RASCI/OKR register and kvb-org-artefacts
rasci.py keeps the organisation's tasks in <council root>/rasci.json: RASCI roles, objective with key results, priority, worker, start, end, workdir, branch, tools and artifacts; done is refused while a key result is open. council.py writes every claim, takeover and release through, and show lists the live claims as one row per task with R, A, S, C and I columns. kvb-org-artefacts manages the artifacts in the same table for kvb-cleanup. The org, plan, triage, tune, cleanup, branch-gc and dream skills now record into and read from the register; five descriptions were tightened to keep the listing budget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
624baccfc4
commit
35dc37641d
23 files changed
+866
-44
No files matched your search
@@ -53,8 +53,10 @@ directory with `--session <id>`.
|
||||
worktree>"`. Exit 0: elected, or already yours. Exit 3: a live agent holds
|
||||
it, and its claim is printed. Exit 4: the holder's session is dead (see
|
||||
Succession).
|
||||
4. **Elected**: continue with the Peer protocol; its message is the
|
||||
announcement.
|
||||
4. **Elected**: the claim entered the task in the `kvb-org-rasci` register,
|
||||
the organisation's single point of truth; complete it there (objective,
|
||||
description, priority, roles), then continue with the Peer protocol; its
|
||||
message is the announcement.
|
||||
5. **Not elected**: send the holder your findings and stop on that work.
|
||||
|
||||
A Claude Code session cannot edit a file in a git worktree before it holds a
|
||||
@@ -74,8 +76,9 @@ records the result.
|
||||
- Before starting anything that consumes shared capacity (gates, deploys,
|
||||
iteration loops, swarm or cloud resources, cleanup of shared data), an agent
|
||||
sends the chair what, where, for how long and its expected disk need, waits
|
||||
for the grant, and reports the release. The chair keeps one queue, answers
|
||||
every request with its position, enforces the limits the operator set,
|
||||
for the grant, and reports the release. The chair keeps one queue as the
|
||||
priorities in the `kvb-org-rasci` register, answers every request with its
|
||||
position, enforces the limits the operator set,
|
||||
checks every grant with `watch.py admit --need-gb <N>` (or `--kind <slot>`;
|
||||
test kinds also need CPU and RAM below the configured limits).
|
||||
- A running job (deploy, gate, test, swarm run, build) is never cut short to
|
||||
@@ -154,14 +157,18 @@ The one protocol for every exchange between agents; `kvb-org-coordinate`, `kvb-c
|
||||
evidence (failing line quoted literally, run id, measurement), the
|
||||
suspected cause marked as a thesis, and the question "Already known or
|
||||
fixed on your side? Reply with a SHA or branch, or 'none'." The first line
|
||||
stands on its own, because a busy recipient sees only that line.
|
||||
stands on its own, because a busy recipient sees only that line. In the
|
||||
`kvb-org-rasci` register the peers asked are C, the chair that grants
|
||||
capacity is S.
|
||||
4. **Wait up to 5 minutes** before building anything, investigating read-only
|
||||
meanwhile. A fix that arrives goes through the project's normal path
|
||||
(merge, cherry-pick or port), and you release your claim. Silence is
|
||||
neither a "no" nor a competing claim: after 5 minutes, proceed.
|
||||
5. **Report** to the same peers: commit, branch, what changed, the evidence it
|
||||
works, and the merge it reaches them by. Report an abandoned or failed
|
||||
attempt too. Then release the claim.
|
||||
attempt too. In the register, enter the peers told as I and mark every key
|
||||
result the evidence proves as met. Then release the claim: the task ends
|
||||
`done`, or `stopped` while a key result is open.
|
||||
|
||||
- Never invent a peer's answer.
|
||||
- A peer's report is not evidence: read the SHA, log or artifact it names
|
||||
@@ -199,3 +206,6 @@ On /kvb-org-organize, one table of the current offices from `council.py list`, s
|
||||
claims marked:
|
||||
|
||||
| Office | Holder | Since | Work | Grants or queue |
|
||||
|
||||
Who carries which task, with priority and status, is the `kvb-org-rasci`
|
||||
register's `show`.
|
||||
@@ -16,10 +16,12 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
@@ -28,6 +30,7 @@ ROOT = Path(os.environ.get("AGENTS_COUNCIL_ROOT", "/tmp/agents-council"))
|
||||
HEARTBEAT_LIMIT = 3600
|
||||
OFFICE = re.compile(r"^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*$")
|
||||
CLAIM = "claim.json"
|
||||
RASCI = Path(__file__).resolve().parents[2] / "kvb-org-rasci" / "scripts" / "rasci.py"
|
||||
|
||||
|
||||
def live_sessions() -> dict[str, str | None]:
|
||||
@@ -83,7 +86,7 @@ def claims() -> list[tuple[str, dict]]:
|
||||
return found
|
||||
|
||||
|
||||
def write_claim(path: Path, office: str, sid: str, runtime: str, work: str) -> None:
|
||||
def write_claim(path: Path, office: str, sid: str, runtime: str, work: str) -> dict:
|
||||
claim = {
|
||||
"office": office,
|
||||
"session": sid,
|
||||
@@ -94,6 +97,30 @@ def write_claim(path: Path, office: str, sid: str, runtime: str, work: str) -> N
|
||||
"work": work,
|
||||
}
|
||||
(path / CLAIM).write_text(json.dumps(claim), encoding="utf-8")
|
||||
return claim
|
||||
|
||||
|
||||
def here() -> dict[str, str | None]:
|
||||
try:
|
||||
head = subprocess.run(
|
||||
["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True, check=False
|
||||
)
|
||||
except OSError:
|
||||
head = None
|
||||
branch = head.stdout.strip() if head and head.returncode == 0 else ""
|
||||
return {"workdir": os.getcwd(), "branch": branch if branch not in ("", "HEAD") else None}
|
||||
|
||||
|
||||
def register(office: str, holder: str, status: str, **extra: str | None) -> None:
|
||||
if not office.startswith(("work/", "cluster/")):
|
||||
return
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("rasci", RASCI)
|
||||
rasci = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(rasci)
|
||||
rasci.track(office, holder, status, **extra)
|
||||
except (OSError, SystemExit) as exc:
|
||||
print(f"council: {office} is missing from the rasci register ({exc})", file=sys.stderr)
|
||||
|
||||
|
||||
def cmd_claim(args: argparse.Namespace) -> int:
|
||||
@@ -105,12 +132,21 @@ def cmd_claim(args: argparse.Namespace) -> int:
|
||||
except FileExistsError:
|
||||
claim = read_claim(path)
|
||||
if claim is not None and claim["session"] == sid:
|
||||
write_claim(path, args.office, sid, runtime, args.work)
|
||||
claim = write_claim(path, args.office, sid, runtime, args.work)
|
||||
register(args.office, claim["name"] or sid, "running", description=args.work, **here())
|
||||
print(f"held {args.office}")
|
||||
return 0
|
||||
print(json.dumps(claim) if claim else f"{args.office}: claim in progress")
|
||||
return 4 if is_stale(claim, live_sessions()) else 3
|
||||
write_claim(path, args.office, sid, runtime, args.work)
|
||||
claim = write_claim(path, args.office, sid, runtime, args.work)
|
||||
register(
|
||||
args.office,
|
||||
claim["name"] or sid,
|
||||
"running",
|
||||
description=args.work,
|
||||
previous=getattr(args, "previous", None),
|
||||
**here(),
|
||||
)
|
||||
print(f"elected {args.office}")
|
||||
return 0
|
||||
|
||||
@@ -121,6 +157,8 @@ def cmd_takeover(args: argparse.Namespace) -> int:
|
||||
if path.exists() and not is_stale(claim, live_sessions()):
|
||||
print(json.dumps(claim) if claim else f"{args.office}: claim in progress")
|
||||
return 3
|
||||
if claim is not None:
|
||||
args.previous = claim["name"] or claim["session"]
|
||||
# Two successors racing between this check and the rename can both win;
|
||||
# kvb-org-organize names exactly one successor per office to keep that window closed.
|
||||
if path.exists():
|
||||
@@ -145,6 +183,7 @@ def cmd_release(args: argparse.Namespace) -> int:
|
||||
print(json.dumps(claim))
|
||||
return 3
|
||||
shutil.rmtree(path)
|
||||
register(args.office, claim["name"] or claim["session"], "done")
|
||||
print(f"released {args.office}")
|
||||
return 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user