Commit graph

57 commits

Author SHA1 Message Date
openhands
e535ed776f fix: feat: active-state files — per-cron guard with self-off semantics (#622)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:46:59 +00:00
openhands
d9427ebe78 chore: gardener housekeeping 2026-03-23 2026-03-23 18:05:26 +00:00
openhands
a66bd91721 fix: Replace Codeberg dependency with local Forgejo instance (#611)
- Add setup_forge() to bin/disinto: provisions Forgejo via Docker,
  creates admin + bot users (dev-bot, review-bot), generates API
  tokens, creates repo, and pushes code — all automated
- Rename env vars: CODEBERG_TOKEN→FORGE_TOKEN, REVIEW_BOT_TOKEN→
  FORGE_REVIEW_TOKEN, CODEBERG_REPO→FORGE_REPO, CODEBERG_API→
  FORGE_API, CODEBERG_WEB→FORGE_WEB, CODEBERG_BOT_USERNAMES→
  FORGE_BOT_USERNAMES (with backwards-compat fallbacks)
- Rename API helpers: codeberg_api()→forge_api(), codeberg_api_all()
  →forge_api_all() (with compat aliases)
- Add forge_url field to project TOML; load-project.sh derives
  FORGE_API/FORGE_WEB from forge_url + repo
- Update parse_repo_slug() to accept any host URL, not just codeberg
- Forgejo data stored under ~/.disinto/forgejo/ (not in factory repo)
- Update all 58 files: agent scripts, formulas, docs, site HTML

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:57:12 +00:00
openhands
0775514bf8 chore: gardener housekeeping 2026-03-23 2026-03-23 12:47:32 +00:00
openhands
38f4b385cc chore: gardener housekeeping 2026-03-23
- Update all AGENTS.md watermarks to f6fb79d (current HEAD)
- lib/AGENTS.md: document nudge behavior in agent-session.sh stop hook
- pending-actions.json: enrich #598 body + promote to backlog
2026-03-23 12:08:26 +00:00
openhands
ff0a04bd64 chore: planner run 2026-03-23 2026-03-23 07:06:47 +00:00
openhands
d8cf0a39bc fix: restore closing --> on AGENTS.md watermark HTML comments
The sed watermark-update pattern stripped the closing --> from 9 of 10
AGENTS.md files, making entire file bodies invisible in rendered markdown.
Fix by appending --> to the affected lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 06:09:19 +00:00
openhands
30cc5688bd chore: gardener housekeeping 2026-03-23
- Update AGENTS.md watermarks to current HEAD (9ec0c02)
- lib/AGENTS.md: document parse-deps.sh inline scan now skips fenced
  code blocks to prevent false positives from code examples in issue bodies
- No blocked issues to review
- Pending actions: none

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 06:03:14 +00:00
openhands
d2db178d30 chore: gardener housekeeping 2026-03-23
- Update AGENTS.md watermarks to current HEAD (e8df73e)
- No code changes since last gardener run — watermark-only refresh
- No blocked issues to review
- Pending actions: none

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 00:47:57 +00:00
openhands
149211c78d chore: gardener housekeeping 2026-03-23
- dev/AGENTS.md: document two-tier priority queue (priority+backlog first,
  then plain backlog); note do_merge() HTTP 405 already-merged detection
- gardener/AGENTS.md: document merge-through protocol (stay alive through
  CI/review/merge); note session kill on PHASE:escalate
- lib/AGENTS.md: add ensure_priority_label() to ci-helpers.sh entry;
  document optional CALLBACK param in run_formula_and_monitor()
- predictor/AGENTS.md: update watermark (content already current from v2 PR)
- Update watermarks for action, planner, review, supervisor, vault, root

Grooming actions:
- #574: added ## Affected files section (lib/parse-deps.sh) to meet quality gate
- #568: escalated — needs human decision on guard/merge architecture
- #466: escalated — dep #393 closed; needs decision on external vs in-repo example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 00:23:02 +00:00
openhands
b8e5e1ab65 fix: fix: revert dispatch-idle-formulas step and implement strategic dispatch instead (reverts #546/PR#549) (#550)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:36:19 +00:00
openhands
f37546c6fc chore: gardener housekeeping 2026-03-22
- Update all AGENTS.md watermarks to current HEAD (251d160)
- dev/AGENTS.md: document dev-poll's early direct-merge scan (before lock
  check) — approved PRs now merge without waiting for active dev sessions;
  chore/gardener PRs merge without issue numbers in branch name
- planner/AGENTS.md: document dispatch-idle-formulas phase (step 4); note
  that planner reads both factory and project-specific formulas; clarify
  that all planner artifacts use $PROJECT_REPO_ROOT, not $FACTORY_ROOT

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 12:07:31 +00:00
openhands
db69a79b2e fix: planner formula uses $FACTORY_ROOT for per-project artifacts — causes cross-repo contamination (#541)
Replace $FACTORY_ROOT/planner/ and $FACTORY_ROOT/vault/ references with
$PROJECT_REPO_ROOT/planner/ and $PROJECT_REPO_ROOT/vault/ in the planner
formula and planner-run.sh. Planner artifacts (journal, memory, prerequisite
tree) and vault state are per-project, not factory-owned. The old paths
caused cross-repo contamination when the planner ran for non-disinto projects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:00:36 +00:00
openhands
ea4c55dbbf chore: gardener housekeeping 2026-03-22 2026-03-22 10:43:58 +01:00
openhands
a35318284a chore: planner run 2026-03-22 2026-03-22 07:07:20 +00:00
openhands
5822dc89d9 fix: feat: unified escalation — single PHASE:escalate path for all agents (#510)
Replace PHASE:needs_human with PHASE:escalate across all agent types.
Consolidates 6 overlapping escalation mechanisms into one unified path:
detect → notify via Matrix → session stays alive → human reply injected → resume.

Key changes:
- PHASE:escalate replaces PHASE:needs_human everywhere (16 files)
- CI exhausted now escalates instead of immediately marking blocked
- Matrix listener routes free-text replies to vault tmux sessions
- Vault agent writes PHASE:escalate files for procurement requests
- Supervisor monitors PHASE:escalate sessions in health checks
- 24h timeout on escalation → blocked label + session killed
- All 38 phase protocol tests updated and passing

Supersedes #462, #458, #465.
2026-03-21 19:39:04 +00:00
openhands
07551fab48 fix: feat: planner v2 — prerequisite tree + resource-aware executive (#502)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:28:38 +00:00
openhands
b4f1666a80 chore: gardener housekeeping 2026-03-21 2026-03-21 18:07:37 +00:00
openhands
a9b8144401 fix: bundled dust cleanup — AGENTS.md (#420)
- Add phase-handler.sh to dev Key files (#332)
- Document ci_required_for_pr() in ci-helpers.sh (#347)
- Update planner trigger: weekly → daily, note optional project arg (#416)
- Add dev-agent.sh, action-agent.sh to formula-session.sh sourced-by (#418)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:02:29 +00:00
openhands
446e6ef0a8 fix: Remove legacy predictor (prediction-poll.sh + prediction-agent.sh + cron entry) (#419)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:40:07 +00:00
openhands
24cf01028a chore: gardener housekeeping 2026-03-21
- Update AGENTS.md watermarks (all 10 files) to HEAD 038581e5
- Content already current from recent gardener migration and setup PRs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 14:33:26 +00:00
openhands
f480cbe5d0 chore: gardener housekeeping 2026-03-21
Progressive disclosure split of AGENTS.md (487→152 lines):
- Extracted per-directory AGENTS.md files for all 8 agents + lib/
- Root AGENTS.md now serves as a table of contents with summary table
- All watermarks updated to 16e430e

Grooming results:
- Promoted #469 (WATCH flow missing curl) and #436 (idle_pane_count bug) to backlog
- 12 dust items classified, no groups ripe for bundling yet
- No blocked issues, no AD violations
2026-03-21 12:44:23 +00:00
johba
d7ca59dd2f Merge pull request 'chore: planner run journal 2026-03-21' (#471) from chore/planner-20260321-0906 into main 2026-03-21 11:54:33 +01:00
openhands
16c41a0b03 chore: planner run 2026-03-21 2026-03-21 09:06:49 +00:00
openhands
83ec300c0e fix: feat: planner journal pattern — daily raw files + periodic summarization (#361)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 08:57:06 +00:00
openhands
d0e40ead22 chore: planner run 2026-03-21 2026-03-21 09:42:06 +01:00
openhands
26d20af48c fix: address review — scratch file survives crash, cap read size, fix instruction (#262)
- Remove SCRATCH_FILE from action-agent cleanup() trap so it survives crashes
- Change instruction to note contents already injected (avoid wasted tool call)
- Cap scratch file read at 8KB via head -c 8192
- Move predictor scratch instruction after formula (consistent placement)
- Remove redundant FINAL_PHASE re-reads in planner/predictor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 20:58:32 +00:00
openhands
7199bbf9b5 fix: feat: agents flush context to scratch file before compaction (#262)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 20:12:45 +00:00
johba
4377c0812f Merge pull request 'feat: disinto predictor — daily cron-driven formula (#406)' (#417) from action/issue-406 into main 2026-03-20 19:09:02 +01:00
openhands
3ea8c183a4 refactor: extract shared prompt footer and monitor loop into formula-session.sh
Eliminates 7 duplicate code blocks between planner-run.sh and predictor-run.sh
flagged by CI duplicate-detection. Adds build_prompt_footer() and
run_formula_and_monitor() helpers to lib/formula-session.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:41:52 +00:00
openhands
911101479b fix: disinto planner schedule — daily at 07:00 UTC
- Cron: 0 7 * * * (daily 07:00, 1h after predictor at 06:00)
- Accept project TOML as argument (default: disinto)
- Remove stale "ALL projects" comment

Closes #407

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:21:33 +00:00
openhands
5bac4a8409 fix: extract lib/formula-session.sh to eliminate duplicate code blocks
Shared helpers for formula-driven cron agents: lock, memory guard,
formula loading, context building, session startup, crash recovery.

- planner-run.sh uses shared helpers instead of inline code
- gardener-agent.sh delegates crash recovery to formula_phase_callback
- agent-smoke.sh updated for renamed planner script + new lib file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 13:53:33 +00:00
openhands
6d9d027d5e fix: planner runs directly from cron — no action issues (#359)
- Rename planner-poll.sh → planner-run.sh: direct cron executor that
  creates a tmux session with Claude (opus), injects the formula as
  context, monitors phase file, handles crash recovery and cleanup.
  No action issues, no action-poll dependency.

- Source disinto project config explicitly (projects/disinto.toml)
  instead of defaulting to harb via env.sh.

- Update formulas/run-planner.toml (v2): remove agents-update step
  (now handled by gardener per #246), add journal-and-memory step
  (daily journal entries committed to git + local MEMORY.md update),
  add commit-and-pr step (one commit, one PR per run).

- Create planner/journal/ directory for daily raw logs.

- Update crontab: weekly Sunday 6AM call to planner-run.sh.

- Update AGENTS.md to reflect new architecture.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 13:40:09 +00:00
openhands
59b6d76afa fix: extract file_action_issue helper to eliminate duplicate code blocks
CI duplicate-detection flagged shared action-issue filing pattern between
gardener-run.sh and planner-poll.sh. Extract into lib/file-action-issue.sh
and refactor both scripts to use it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 12:49:08 +00:00
openhands
898f958196 fix: add model=opus to run-planner formula and wire through action-agent
TOML declares model = "opus". planner-poll.sh includes model: opus in
the issue YAML front matter. action-agent.sh extracts it and exports
CLAUDE_MODEL. create_agent_session passes --model to claude if set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 09:08:17 +00:00
openhands
6c7557e87b fix: feat: planner as cron-driven formula (no issue tracking) (#232)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 09:00:56 +00:00
openhands
48dbab215d fix: feat: planner triages prediction/unreviewed issues before gap analysis (#304)
Add Phase 1.5 to planner-agent.sh between AGENTS.md update (Phase 1) and
gap analysis (Phase 2). The new phase fetches all prediction/unreviewed
issues, asks Claude (Sonnet, one-shot) to triage each as ACCEPT_ACTION,
ACCEPT_BACKLOG, or DISMISS, then:
- Creates action issues (with formula YAML front matter) or backlog issues
- Relabels accepted predictions: prediction/unreviewed → prediction/backlog
- Closes dismissed predictions with a reason comment
- Passes accepted predictions as context into Phase 2 gap analysis

Creates prediction/backlog label on first run if missing. Validates emitted
formula names against on-disk formulas/*.toml catalog.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:44:39 +00:00
openhands
d2f788239a fix: address review feedback on prediction agent (#140)
- Remove CLAUDE_TIMEOUT no-op override — inherit factory default (7200s) from env.sh
- Use anchored grep -qxF "NO_PREDICTIONS" to avoid false early exits
- Fetch closed PRs (state=closed, merged_at filter) instead of open — captures merged activity signals
- Parse staleness age from filename date (YYYY-MM-DD.json) instead of file mtime
- Log a warning when date -d falls back due to non-GNU date
- Add comment explaining global lock serialisation trade-off

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 10:13:22 +00:00
openhands
c06cf81031 fix: feat: prediction-poll.sh — per-project LLM prediction agent (#140)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 10:03:45 +00:00
openhands
d498334dcc fix: address review feedback — restore -d flag, drop formula label, validate names, quote YAML
- Restore `-d` flag on codeberg_api POST /issues call (regression fix)
- Do NOT apply `formula` label — dev-agent rejects it, blocking the pipeline
- Keep YAML front matter in body only (structural, harmless to freeform processing)
- Quote YAML var values with @json to handle special characters
- Validate formula name against on-disk formulas/*.toml catalog
- Fall back to freeform if Claude hallucinates a formula name

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 04:37:17 +00:00
openhands
b5ec6f6cf3 fix: feat: planner emits formula instances instead of freeform issues (#21)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 04:29:21 +00:00
johba
740bddb2db Merge pull request 'fix: feat: RESOURCES.md — infrastructure manifest for planner resource awareness (#23)' (#33) from fix/issue-23 into main 2026-03-17 10:56:52 +01:00
openhands
567dc4bde0 fix: address review findings for supervisor metrics (#24)
- planner: filter CI and dev metrics by project name to prevent cross-project pollution
- planner: replace fragile awk JSONL filter with jq select()
- supervisor: add codeberg_count_paginated() helper; replace hardcoded limit=50 dev-metric API calls with paginated counts so projects with >50 issues report accurate blocked-ratio data
- supervisor: add 24h age filter to CI metric SQL query so stale pipelines are not re-emitted with a fresh timestamp
- supervisor: replace fragile awk key-order-dependent JSON filter in rotate_metrics() with jq select(); add safety guard to prevent overwriting file with empty result on parse failure
- supervisor: move mkdir -p for metrics dir to startup (once) instead of every emit_metric() call
- supervisor: guard _RAM_TOTAL_MB against empty value in bash arithmetic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 10:56:37 +01:00
openhands
53c1fea6ea fix: feat: supervisor metrics logging for planner trend analysis (#24)
- supervisor-poll.sh: append structured JSONL metrics on every poll
  - infra metric (ram_used_pct, disk_used_pct, swap_mb) after Layer 1 checks
  - ci metric (pipeline id, duration_min, status) per project via wpdb query
  - dev metric (issues_in_backlog, issues_blocked, pr_open) per project via Codeberg API
  - rotate_metrics() trims metrics/supervisor-metrics.jsonl to last 30 days on startup
- planner-agent.sh: reads last 7 days of metrics before Phase 2 gap analysis
  - computes avg CI duration, success rate, RAM/disk utilization, blocked ratio
  - injects summary into gap analysis prompt as "Operational metrics" section
  - instructs planner to create optimization issues when metrics conflict with VISION.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 10:56:37 +01:00
openhands
26d6e1ae52 fix: feat: RESOURCES.md — infrastructure manifest for planner resource awareness (#23)
- Add RESOURCES.example.md: committed template showing Compute/Domains/Accounts/Budget structure
- Gitignore RESOURCES.md so local infrastructure data is never committed
- Planner phase 2 reads RESOURCES.md from factory root when present
- Planner prompt instructs Claude to reference specific resource aliases in operational issues

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 08:48:47 +00:00
johba
7f41048aea fix: remove dead STATE.md code, restore matrix notify, targeted git add (Closes #13, Closes #14)
- Remove STATE_FILE variable and all STATE.md references from phase 2
- Restore matrix_send for gap analysis issue creation
- Replace broad `git add -A "*.md"` with targeted `find -name AGENTS.md`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 16:53:33 +01:00
johba
3bb75f18be feat: planner uses Claude tool access to navigate AGENTS.md tree (Closes #12)
Phase 1 rewritten:
- Claude gets --dangerously-skip-permissions to navigate code, read
  diffs, and update AGENTS.md files directly
- Per-file <!-- last-reviewed: SHA --> watermarks replace global marker
- Sub-directory AGENTS.md files discovered and updated independently
- ~200 line convention enforced via prompt
- Changes committed on branch and PR'd

Phase 2 now reads AGENTS.md tree + STATE.md for gap analysis.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 16:33:47 +01:00
openhands
679c62e7cb refactor: planner maintains AGENTS.md instead of STATE.md
STATE.md was a machine-generated system description that was always
worse than the human-curated AGENTS.md. Killed STATE.md entirely.

Phase 1: Reviews recent git history against AGENTS.md, suggests
updates via PR to keep the file tree, conventions, and architecture
descriptions current.

Phase 2: Gap analysis — compares AGENTS.md + VISION.md + open issues,
creates backlog issues for missing capabilities.
2026-03-15 15:13:41 +00:00
openhands
5c6293fdab fix: strip non-bullet preamble from planner output
Sonnet prepends narration before the actual bullets. Strip everything
before the first '- ' line instead of rejecting the whole output.
2026-03-15 15:02:53 +00:00
openhands
af75c0eccf fix: even stronger output-only instruction for Sonnet
Sonnet keeps narrating. Made the constraint explicitly say 'starts
with - on the very first character' and 'will be rejected'.
2026-03-15 14:59:42 +00:00