generated from coulomb/repo-seed
Implement State Hub v0.2: dependency graph, next-steps suggestions, design boundary
S0 — Design boundary formalised across all integration surfaces:
- TOOLS.md restructured with Design Boundary section, Sanctioned Write Tools,
and Bootstrap-Only Tools (create_workstream, create_task) with explicit note
- project_claude_md.template and railiance CLAUDE.md updated with boundary note
and get_next_steps() in session start protocol
- Global ~/.claude/CLAUDE.md updated accordingly
S1 — Workstream dependency graph:
- WorkstreamDependency model (directed edge, CASCADE on delete, unique pair constraint)
- Alembic migration 0b547c153153; script.py.mako added (was missing)
- REST API: POST/GET /workstreams/{id}/dependencies/, DELETE …/{dep_id} (hard delete)
- StateSummary open_workstreams enriched with depends_on/blocks lists
- MCP tools: create_dependency(), list_dependencies()
- Dashboard workstreams page: Dependencies section with relationship cards
- Seeded: custodian-agent-runtime → llm-shared-library + phase-0-operational-baseline
S2 — Suggesting Next Steps (sanctioned write use case #2):
- GET /state/next_steps derives suggestions from recently resolved decisions
(→ first open task in same workstream) and cleared dependencies
(→ first todo task in now-unblocked workstream)
- StateSummary.next_steps included on every summary call
- MCP tool: get_next_steps()
- Dashboard: "What's next?" card grid above Registered Projects
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,12 @@ def _patch(path: str, body: dict) -> Any:
|
||||
return r.json()
|
||||
|
||||
|
||||
def _delete(path: str) -> None:
|
||||
with _client() as c:
|
||||
r = c.delete(path)
|
||||
r.raise_for_status()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Resources
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -398,6 +404,70 @@ def update_workstream_status(workstream_id: str, status: str) -> str:
|
||||
return json.dumps(ws, indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Next-steps suggestion tool (S2.3) — sanctioned write use case #2
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@mcp.tool()
|
||||
def get_next_steps() -> str:
|
||||
"""Surface contextual next-action suggestions derived from hub state.
|
||||
|
||||
Returns suggestions based on:
|
||||
- Recently resolved decisions → first open task in the same workstream
|
||||
- Workstreams whose every dependency is now completed → first todo task
|
||||
|
||||
Each suggestion includes domain, workstream, task, and a plain-language
|
||||
message. The hub surfaces *what* and *where* — the domain owns *how*.
|
||||
|
||||
This is one of the two sanctioned write-side use cases of the State Hub
|
||||
(the other is resolve_decision). Suggestions are derived, not persisted.
|
||||
"""
|
||||
return json.dumps(_get("/state/next_steps"), indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dependency graph tools (S1.4)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@mcp.tool()
|
||||
def create_dependency(
|
||||
from_workstream_id: str,
|
||||
to_workstream_id: str,
|
||||
description: str | None = None,
|
||||
) -> str:
|
||||
"""Record that one workstream depends on another.
|
||||
|
||||
Semantics: from_workstream cannot fully proceed until to_workstream reaches
|
||||
a satisfactory state.
|
||||
|
||||
Args:
|
||||
from_workstream_id: UUID of the workstream that has the dependency
|
||||
to_workstream_id: UUID of the workstream it depends on
|
||||
description: optional human-readable explanation of the dependency
|
||||
"""
|
||||
dep = _post(f"/workstreams/{from_workstream_id}/dependencies", {
|
||||
"to_workstream_id": to_workstream_id,
|
||||
"description": description,
|
||||
})
|
||||
return json.dumps(dep, indent=2)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def list_dependencies(workstream_id: str) -> str:
|
||||
"""Return all dependency edges touching a workstream (both directions).
|
||||
|
||||
The response distinguishes edges where this workstream is the dependent
|
||||
(depends_on) from edges where it is the blocker (blocks).
|
||||
|
||||
Args:
|
||||
workstream_id: UUID of the workstream to inspect
|
||||
"""
|
||||
edges = _get(f"/workstreams/{workstream_id}/dependencies")
|
||||
depends_on = [e for e in edges if e["from_workstream_id"] == workstream_id]
|
||||
blocks = [e for e in edges if e["to_workstream_id"] == workstream_id]
|
||||
return json.dumps({"depends_on": depends_on, "blocks": blocks}, indent=2)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Entry point
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user