Skip to content

Commit 3fccb60

Browse files
committed
Apply Humanize2 platform onto h2-dev alongside dev features
Bring the entire Humanize 2.0 codebase (MCP server hub, HTML workflow runtime, agent backends, dashboard, and first-party flow cartridges) into h2-dev so this branch carries both the Humanize 1.0 RLCR plugin surface from dev and the Humanize 2.0 platform surface. - Register a humanize2 MCP server at the plugin root via .mcp.json, pointing at the built dist/index.js, following the Claude Code plugin MCP server convention (location at plugin root, command invoked under CLAUDE_PLUGIN_ROOT). - Add the TypeScript MCP server sources under src/, hub HTTP server, agent backends, workflow coordinator, schema registry, storage, recovery, and projection. - Add manual smoke scripts under scripts/ and the vitest suite under tests/, including workflow grammar, RPC, storage, and recovery coverage. - Add the workflow cartridges under flow/ (rlcr, gen-idea, gen-plan, refine-plan, experimental/team-intervention-smoke). - Extend .gitignore for the Humanize2 build artifacts (node_modules, dist, coverage, logs, local .h2 state). - Update README to document the Humanize 2.0 platform side of this transitional branch.
1 parent 4d54140 commit 3fccb60

72 files changed

Lines changed: 22681 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ temp
1616
# Python cache
1717
__pycache__/
1818
*.pyc
19+
20+
# Humanize2 build artifacts and dependencies
21+
node_modules/
22+
dist/
23+
coverage/
24+
*.log
25+
26+
# Local superpowers cache
27+
.superpowers/
28+
29+
# Humanize2 runtime state (per-user, written under ~/.h2 by default)
30+
.h2/

.mcp.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mcpServers": {
3+
"humanize2": {
4+
"command": "node",
5+
"args": ["${CLAUDE_PLUGIN_ROOT}/dist/index.js"],
6+
"cwd": "${CLAUDE_PLUGIN_ROOT}"
7+
}
8+
}
9+
}

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
77
A Claude Code plugin that provides iterative development with independent AI review. Build with confidence through continuous feedback loops.
88

9+
> **Note**: The `h2-dev` branch is a transitional branch that ships Humanize 1.0 features (RLCR loop, Codex review, planning commands) **and** the Humanize 2.0 platform (MCP server hub with HTML workflow cartridges) side by side. See the [Humanize 2.0 Platform](#humanize-20-platform-mcp-server-hub) section below for the new generic workflow runtime.
10+
911
## What is RLCR?
1012

1113
**RLCR** stands for **Ralph-Loop with Codex Review**, inspired by the official ralph-loop plugin and enhanced with independent Codex review. The name also reads as **Reinforcement Learning with Code Review** -- reflecting the iterative cycle where AI-generated code is continuously refined through external review feedback.
@@ -98,6 +100,66 @@ Requires [codex CLI](https://github.com/openai/codex) for review. See the full [
98100
- [Configuration](docs/usage.md#configuration) -- Shared config hierarchy and override rules
99101
- [Bitter Lesson Workflow](docs/bitlesson.md) -- Project memory, selector routing, and delta validation
100102

103+
## Humanize 2.0 Platform (MCP Server Hub)
104+
105+
Humanize 2.0 ships alongside the 1.0 plugin on this branch. It is a local MCP server hub and HTML workflow runtime that turns Humanize from a fixed RLCR plugin into a general-purpose flow execution platform. The same human programmer keeps using familiar agent CLIs (Codex, Claude Code, Gemini CLI, Zed, etc.); the hub provides the shared workflow layer underneath.
106+
107+
### Build
108+
109+
The MCP server is shipped as TypeScript source and must be built once before use:
110+
111+
```bash
112+
cd <plugin-root>
113+
npm install
114+
npm run build
115+
```
116+
117+
### Plugin MCP Registration
118+
119+
The plugin auto-registers a `humanize2` MCP server via `.mcp.json` at the plugin root. After building, the server starts automatically with the plugin under any MCP-capable Claude Code client.
120+
121+
### Start the Local Hub
122+
123+
```bash
124+
HUMANIZE2_PORT=4772 npm run hub
125+
# Open the dashboard
126+
xdg-open http://127.0.0.1:4772
127+
```
128+
129+
The dashboard lists Agent Sessions, shows the logical session graph and Gantt timeline, and lets you select a session to inspect input history, log, and output. The hub uses `~/.h2/config.yaml` and stores run history under `~/.h2/cache` by default. Set `HUMANIZE2_CACHE_DIR` or `HUMANIZE2_DEFAULT_TIMEOUT_MS` to override those values.
130+
131+
### MCP Tools
132+
133+
The `humanize2` server exposes these MCP tools:
134+
135+
- `agent_status` reports availability for configured agent backends.
136+
- `agent_run` accepts an explicit `agent` field and dispatches to that backend.
137+
- `agent_spawn_child` starts a hub-managed child run; the current run is used as the parent automatically when called from a Humanize2-managed agent.
138+
- `codex_run` dispatches directly to Codex CLI.
139+
- `claude_run` dispatches directly to Claude Code CLI.
140+
- `agent_send_message` sends a message to a hub-managed run. If the run is still active, the hub interrupts it and starts a linked continuation run.
141+
- `agent_wait` waits for a hub-managed run to finish.
142+
143+
The hub also exposes a workflow surface (`workflow_*`, `view_*`, `board_*`, `artifact_*`, `event_*`, `human_*`) for HTML workflow cartridges under `flow/`.
144+
145+
### Workflow Cartridges
146+
147+
First-party flow cartridges ship under `flow/`:
148+
149+
- `flow/rlcr` -- the legacy RLCR loop expressed as a workflow cartridge
150+
- `flow/gen-idea`, `flow/gen-plan`, `flow/refine-plan` -- planning workflows
151+
- `flow/experimental/team-intervention-smoke` -- intervention smoke test
152+
153+
See the source under `src/` and tests under `tests/` for the full workflow grammar, MCP/RPC surface, and runtime behavior.
154+
155+
### Development Checks
156+
157+
```bash
158+
npm test
159+
npm run typecheck
160+
npm run build
161+
```
162+
101163
## License
102164

103165
MIT
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<h2-workflow id="team-intervention-smoke" name="Team Intervention Smoke" version="0.1.0" schema="humanize2.workflow.html.v1">
2+
<h2-manifest>
3+
<h2-capability name="agent" tools="codex,claude"></h2-capability>
4+
<h2-capability name="artifact" schemas="team.workerResult.v1,team.captainResult.v1"></h2-capability>
5+
<h2-capability name="script" allow="test.pass"></h2-capability>
6+
<h2-capability name="view"></h2-capability>
7+
</h2-manifest>
8+
9+
<h2-state>
10+
<h2-board id="team-board" schema="team.board.v1"></h2-board>
11+
<h2-artifact name="worker-1-final" schema="team.workerResult.v1"></h2-artifact>
12+
<h2-artifact name="worker-2-final" schema="team.workerResult.v1"></h2-artifact>
13+
<h2-artifact name="worker-3-final" schema="team.workerResult.v1"></h2-artifact>
14+
<h2-artifact name="team-summary" schema="team.captainResult.v1"></h2-artifact>
15+
</h2-state>
16+
17+
<h2-template id="captain-prompt" type="prompt">
18+
You are the captain for a Humanize2 team-intervention smoke run. This workflow expects you, the captain, to coordinate the whole team through Humanize2 and then deliver the final artifact named team-summary.
19+
20+
Use Humanize2 MCP tools directly when available. The workflow context also includes a JSON-RPC URL as a fallback for the same operations. Do not create workers by writing handoff files.
21+
22+
Do this exact workflow:
23+
1. Create three managed worker agent sessions for yourself with agent_spawn_child. Omit parentRunId so Humanize2 uses your current run as the logical parent.
24+
Worker 1: agent codex, shortName team-worker-1, cwd inherited from this run, timeoutMs 900000.
25+
Worker 2: agent claude, shortName team-worker-2, cwd inherited from this run, timeoutMs 900000.
26+
Worker 3: agent codex, shortName team-worker-3, cwd inherited from this run, timeoutMs 900000.
27+
2. Give each worker an initial prompt that tells it to write a local note under temp/team-worker-N.md, record initial task A/B/C with local timestamp and cwd, wait 90 seconds before finalizing unless a Humanize2 message changes the task, then deliver worker-N-final through Humanize2 with schema team.workerResult.v1 and producer worker-N.
28+
3. Wait 25 seconds after all three workers are created.
29+
4. Use agent_send_message to change worker 1 from task A to final task D, worker 2 from task B to final task E, and worker 3 from task C to final task F. Keep the same output files.
30+
5. Wait for the worker runs or their continuation runs to stop with agent_wait.
31+
6. Patch board team-board with status ok and a short summary of worker final tasks.
32+
7. Deliver artifact team-summary through Humanize2 with schema team.captainResult.v1, producer captain, and content containing status ok plus the worker run ids, worker artifact names, and final tasks D/E/F.
33+
34+
Do not finish until team-summary has been delivered.
35+
</h2-template>
36+
37+
<h2-flow>
38+
<h2-script id="preflight" uses="test.pass"></h2-script>
39+
<h2-agent id="captain" role="captain" tool="codex" prompt="#captain-prompt" short-name="team-captain" timeout="20m">
40+
<h2-expect artifact="team-summary" schema="team.captainResult.v1"></h2-expect>
41+
</h2-agent>
42+
<h2-transform id="team-board-result" from="artifact.team-summary" to="board.team-board"></h2-transform>
43+
<h2-script id="complete" uses="test.pass"></h2-script>
44+
</h2-flow>
45+
46+
<h2-view slot="properties">
47+
<section data-h2-view="team-board">
48+
<h3>Team Intervention Smoke</h3>
49+
<p>Status: <span data-h2-bind="board.team-board.status">Waiting for captain summary.</span></p>
50+
<p>Primary final tasks: <span data-h2-bind="board.team-board.finalTasks">-</span></p>
51+
</section>
52+
</h2-view>
53+
</h2-workflow>

flow/gen-idea/workflow.html

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<h2-workflow id="gen-idea" name="Generate Idea Draft" version="0.1.0" schema="humanize2.workflow.html.v1">
2+
<h2-manifest>
3+
<h2-capability name="agent" tools="claude,codex"></h2-capability>
4+
<h2-capability name="artifact" schemas="idea.input.v1,idea.directions.v1,idea.proposal.v1,idea.draft.v1"></h2-capability>
5+
<h2-capability name="script" allow="humanize.validateIdeaInput,idea.collectProposalStatus"></h2-capability>
6+
<h2-capability name="view"></h2-capability>
7+
</h2-manifest>
8+
9+
<h2-state>
10+
<h2-board id="idea-scoreboard" schema="idea.scoreboard.v1"></h2-board>
11+
</h2-state>
12+
13+
<h2-template id="direction-prompt" type="prompt">
14+
Read the delivered idea-input artifact and repository context. Do not modify project files.
15+
Gather repo context from README.md, local instruction files when present, and the top-level directory listing.
16+
Produce exactly 6 orthogonal directions. Each direction must include a 2-5 word name and a single-sentence rationale explaining why it is distinct.
17+
If fewer than 6 directions are possible after one retry, deliver at least 2 directions and include a warning field. Deliver idea-directions through Humanize2.
18+
</h2-template>
19+
<h2-template id="exploration-prompt" type="prompt">
20+
Explore the direction assigned by your vertex id and expected artifact. Read idea-directions and select the matching ordered direction.
21+
Include a verbatim copy of the original idea from idea-input in your reasoning context.
22+
Explore this direction within the current repo. Gather OBJECTIVE_EVIDENCE:
23+
- Specific repo paths with existing patterns worth extending.
24+
- Prior art or precedent in the codebase or adjacent tooling.
25+
- Measurable considerations where discoverable from reading the code.
26+
27+
Read-only. Do not write any files.
28+
29+
If no concrete evidence exists for this direction, report the literal string "exploratory, no concrete precedent" once in OBJECTIVE_EVIDENCE and stop exploring further. Fabrication of references is forbidden.
30+
31+
Deliver your expected idea-proposal-* artifact through Humanize2 with APPROACH_SUMMARY, OBJECTIVE_EVIDENCE, KNOWN_RISKS, and CONFIDENCE.
32+
</h2-template>
33+
<h2-template id="synthesis-prompt" type="prompt">
34+
Synthesize the delivered exploration proposals into one Primary direction and alternatives.
35+
Choose the Primary direction by evidence density, fit with existing repo patterns, implementation surface area, and confidence.
36+
Preserve the original idea content from idea-input byte-for-byte in the draft content.
37+
Deliver idea-draft through Humanize2 with title, original idea, primary direction, objective evidence, known risks, alternatives, synthesis notes, requested direction count, and actual proposal count.
38+
</h2-template>
39+
40+
<h2-flow>
41+
<h2-check id="validate-input" uses="humanize.validateIdeaInput"></h2-check>
42+
<h2-await id="idea-input-await" on="exists(artifact.idea-input)"></h2-await>
43+
<h2-agent id="direction-lead" role="lead" tool="claude" prompt="#direction-prompt" short-name="gen-idea-directions" timeout="30m">
44+
<h2-expect artifact="idea-directions" schema="idea.directions.v1"></h2-expect>
45+
</h2-agent>
46+
<h2-parallel id="exploration-swarm">
47+
<h2-agent id="explore-direction-1" role="explorer" parent="direction-lead" tool="claude" prompt="#exploration-prompt" short-name="idea-direction-1" timeout="30m">
48+
<h2-expect artifact="idea-proposal-1" schema="idea.proposal.v1"></h2-expect>
49+
</h2-agent>
50+
<h2-agent id="explore-direction-2" role="explorer" parent="direction-lead" tool="codex" prompt="#exploration-prompt" short-name="idea-direction-2" timeout="30m">
51+
<h2-expect artifact="idea-proposal-2" schema="idea.proposal.v1"></h2-expect>
52+
</h2-agent>
53+
<h2-agent id="explore-direction-3" role="explorer" parent="direction-lead" tool="claude" prompt="#exploration-prompt" short-name="idea-direction-3" timeout="30m">
54+
<h2-expect artifact="idea-proposal-3" schema="idea.proposal.v1"></h2-expect>
55+
</h2-agent>
56+
<h2-agent id="explore-direction-4" role="explorer" parent="direction-lead" tool="codex" prompt="#exploration-prompt" short-name="idea-direction-4" timeout="30m">
57+
<h2-expect artifact="idea-proposal-4" schema="idea.proposal.v1"></h2-expect>
58+
</h2-agent>
59+
<h2-agent id="explore-direction-5" role="explorer" parent="direction-lead" tool="claude" prompt="#exploration-prompt" short-name="idea-direction-5" timeout="30m">
60+
<h2-expect artifact="idea-proposal-5" schema="idea.proposal.v1"></h2-expect>
61+
</h2-agent>
62+
<h2-agent id="explore-direction-6" role="explorer" parent="direction-lead" tool="codex" prompt="#exploration-prompt" short-name="idea-direction-6" timeout="30m">
63+
<h2-expect artifact="idea-proposal-6" schema="idea.proposal.v1"></h2-expect>
64+
</h2-agent>
65+
</h2-parallel>
66+
<h2-transform id="proposal-summary" from="artifact.idea-proposal-1" to="board.idea-scoreboard" uses="idea.collectProposalStatus"></h2-transform>
67+
<h2-agent id="synthesis-lead" role="synthesizer" tool="claude" prompt="#synthesis-prompt" short-name="idea-synthesis" timeout="30m">
68+
<h2-expect artifact="idea-draft" schema="idea.draft.v1"></h2-expect>
69+
</h2-agent>
70+
</h2-flow>
71+
72+
<h2-view slot="properties">
73+
<section data-h2-view="idea-scoreboard">
74+
<h3>Idea Exploration Scoreboard</h3>
75+
<p>Architecture proposal: <span data-h2-bind="board.idea-scoreboard.architecture">-</span></p>
76+
<p>Product proposal: <span data-h2-bind="board.idea-scoreboard.product">-</span></p>
77+
<p>Risk proposal: <span data-h2-bind="board.idea-scoreboard.risk">-</span></p>
78+
</section>
79+
</h2-view>
80+
</h2-workflow>

flow/gen-plan/workflow.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<h2-workflow id="gen-plan" name="Generate Plan" version="0.1.0" schema="humanize2.workflow.html.v1">
2+
<h2-manifest>
3+
<h2-capability name="agent" tools="claude,codex"></h2-capability>
4+
<h2-capability name="artifact" schemas="plan.draft.v1,plan.relevance.v1,plan.analysis.v1,plan.candidate.v1,plan.verdict.v1,plan.final.v1,plan.humanDecision.v1"></h2-capability>
5+
<h2-capability name="script" allow="humanize.validatePlanInput,humanize.resolveProjectConfig"></h2-capability>
6+
<h2-capability name="human-input"></h2-capability>
7+
<h2-capability name="view"></h2-capability>
8+
</h2-manifest>
9+
10+
<h2-state>
11+
<h2-board id="plan-convergence" schema="plan.convergence.v1"></h2-board>
12+
</h2-state>
13+
14+
<h2-template id="relevance-prompt" type="prompt">
15+
Inspect the delivered idea draft and repository context. Deliver plan-relevance with relevant or not-relevant status and a concise reason.
16+
</h2-template>
17+
<h2-template id="analysis-prompt" type="prompt">
18+
Review the delivered draft before planning. Deliver plan-first-pass-analysis with risks, missing requirements, technical gaps, alternatives, questions, and candidate criteria.
19+
</h2-template>
20+
<h2-template id="candidate-prompt" type="prompt">
21+
Use the draft, relevance result, first-pass analysis, and any prior convergence verdict to produce a candidate implementation plan.
22+
The plan must preserve all original draft content, identify risks, and include task routing tags. Deliver plan-candidate through Humanize2.
23+
</h2-template>
24+
<h2-template id="review-prompt" type="prompt">
25+
Challenge the candidate plan for feasibility and unresolved decisions. Deliver plan-convergence-verdict through Humanize2.
26+
Use status converged when no required changes remain, revise when another candidate pass is needed, or needs-human-decision when an explicit user decision is required.
27+
Include agreements, disagreements, required changes, optional improvements, unresolved decisions, and convergence notes.
28+
</h2-template>
29+
<h2-template id="final-plan-prompt" type="prompt">
30+
Generate the final plan artifact using the agreed schema. Do not implement project code.
31+
The final plan must include Goal Description, Acceptance Criteria, Path Boundaries, Feasibility Hints and Suggestions, Dependencies and Sequence, Task Breakdown, Claude-Codex Deliberation, Pending User Decisions, and Implementation Notes.
32+
Every Task Breakdown row must use a tag of coding or analyze.
33+
Preserve the draft appendix and summarize resolved disagreements. Deliver plan-final through Humanize2.
34+
</h2-template>
35+
36+
<h2-flow>
37+
<h2-check id="validate-io" uses="humanize.validatePlanInput"></h2-check>
38+
<h2-check id="load-config" uses="humanize.resolveProjectConfig"></h2-check>
39+
<h2-await id="plan-draft-await" on="exists(artifact.plan-draft)"></h2-await>
40+
<h2-agent id="relevance-checker" role="checker" tool="claude" prompt="#relevance-prompt" short-name="plan-relevance" timeout="20m">
41+
<h2-expect artifact="plan-relevance" schema="plan.relevance.v1"></h2-expect>
42+
</h2-agent>
43+
<h2-agent id="first-pass-reviewer" role="reviewer" tool="codex" prompt="#analysis-prompt" short-name="plan-first-pass" timeout="30m">
44+
<h2-expect artifact="plan-first-pass-analysis" schema="plan.analysis.v1"></h2-expect>
45+
</h2-agent>
46+
<h2-loop id="plan-convergence-loop" max="3">
47+
<h2-agent id="candidate-writer" role="planner" tool="claude" prompt="#candidate-prompt" short-name="plan-candidate" timeout="45m">
48+
<h2-expect artifact="plan-candidate" schema="plan.candidate.v1"></h2-expect>
49+
</h2-agent>
50+
<h2-agent id="convergence-reviewer" role="reviewer" tool="codex" prompt="#review-prompt" short-name="plan-convergence" timeout="30m">
51+
<h2-expect artifact="plan-convergence-verdict" schema="plan.verdict.v1"></h2-expect>
52+
</h2-agent>
53+
<h2-branch id="convergence-route" on="artifact.plan-convergence-verdict.status">
54+
<h2-case value="revise" continue="plan-convergence-loop"></h2-case>
55+
<h2-case value="converged" goto="final-plan-writer"></h2-case>
56+
<h2-case value="needs-human-decision" goto="decision-request"></h2-case>
57+
<h2-default goto="decision-request"></h2-default>
58+
</h2-branch>
59+
</h2-loop>
60+
<h2-human id="decision-request" prompt="Resolve pending planning decisions" artifact="plan-human-decision" schema="plan.humanDecision.v1"></h2-human>
61+
<h2-agent id="final-plan-writer" role="planner" tool="claude" prompt="#final-plan-prompt" short-name="plan-final" timeout="45m">
62+
<h2-expect artifact="plan-final" schema="plan.final.v1"></h2-expect>
63+
</h2-agent>
64+
</h2-flow>
65+
66+
<h2-view slot="properties">
67+
<section data-h2-view="plan-convergence">
68+
<h3>Plan Convergence</h3>
69+
<p>Status: <span data-h2-bind="board.plan-convergence.status">-</span></p>
70+
</section>
71+
</h2-view>
72+
</h2-workflow>

0 commit comments

Comments
 (0)