Skip to content

simplify: kill agency-mode gate, fold doctrine into CLAUDE.md, drop old Mini App#210

Open
MagMueller wants to merge 1 commit into
goal-flow-v1from
simplify-v2
Open

simplify: kill agency-mode gate, fold doctrine into CLAUDE.md, drop old Mini App#210
MagMueller wants to merge 1 commit into
goal-flow-v1from
simplify-v2

Conversation

@MagMueller
Copy link
Copy Markdown
Contributor

@MagMueller MagMueller commented May 15, 2026

Summary

Stacked on #209 (goal-flow-v1). Net −2865 / +242 LOC.

After v1 made agency the default, the separate doctrine file, the skill activation gate, and the legacy Mini App UI were all carrying their weight.

  • agency-skill.md deleted. Agency is the default after v1, no trigger phrase to register. Bootstrap removes the legacy ~/.claude/skills/agency symlink from existing boxes.
  • AGENCY.md deleted. The essential card-shape doctrine (~25 lines) folded directly into CLAUDE.md (## Composing a card). One operating manual, not two.
  • CLAUDE.md trimmed 259 → 161 lines. Tighter "How you talk", merged Conventions+Don't, new "Composing a card" section is ~25 lines.
  • Old Mini App deletedindex.html/app.js/app.css (~2230 LOC). The legacy "feed" UI wasn't reachable from the bot's /miniapp button anyway (that one goes to /tinder). /feed route also dropped from mini_app.py.
  • Mini App services lazy-start. bux-miniapp.service + bux-miniapp-tunnel.service no longer enabled at boot. The bot already lazy-starts them on /miniapp invocation; cloudflared no longer burns free-tier quota 24/7. Both install.sh and bootstrap.sh updated.

Silent-failure fixes (from the dead-air scan)

  • _handle_agency_callback: missing chat_id → toast "card is gone (chat or message was deleted)".
  • _handle_agency_callback: malformed callback_data → toast "data is malformed", not empty.
  • _handle_agency_callback: DB record_decision failure → posts a one-line warning to the chat.
  • _handle_agency_callback: createForumTopic fall-through → tells the user "running in this thread instead" with the error reason.

Tests

8 new test cases for /autopilot, /copilot, default mode, invalid-mode fallback, mode flip, prompt mode-awareness. 29 tests pass total.

Deferred to v3 (intentionally)

  • Full install.shbootstrap.sh consolidation. Needs a fresh-box test pass; touching every entrypoint in one PR is risky.
  • telegram_bot.py module split (7741 LOC, 115 top-level fns).
  • Remaining silent path (refine context-injection swallow — likely drops with the whole refine kind in v3).

Test plan

  • pytest agent/test_telegram_bot.py agent/test_mini_app.py — 29 pass
  • python3 -c "ast.parse(...)" all touched .py files
  • bash -n install.sh agent/bootstrap.sh
  • Run bootstrap.sh on a box that has ~/.claude/skills/agency/ from a prior version — verify the legacy symlink is cleaned up
  • /miniapp from TG — verify lazy-start of bux-miniapp.service still works after the boot-time enable was removed
  • /goal <X> → tap a card with malformed callback_data (mock) — verify the new "data is malformed" toast appears

🤖 Generated with Claude Code


Summary by cubic

Make agency the default and simplify the stack: folded doctrine into CLAUDE.md, removed the agency skill/gate, deleted the legacy Mini App, and switched Mini App services to lazy‑start. This cuts code and boot-time load, and fixes several silent failure paths.

  • Refactors

    • Folded card-shape doctrine into CLAUDE.md (new “Composing a card”); deleted AGENCY.md and trimmed CLAUDE.md.
    • Removed agency-skill.md and cleaned up the legacy ~/.claude/skills/agency symlink in bootstrap.sh.
    • Dropped the old Mini App UI and /feed route; prompts now reference CLAUDE.md; /miniapp flow unchanged.
    • Stopped enabling bux-miniapp.service and bux-miniapp-tunnel.service at boot; lazy-start on /miniapp; updated install.sh and bootstrap.sh.
    • Added 8 tests for /autopilot//copilot and prompt mode-awareness; 29 total pass.
  • Bug Fixes

    • _handle_agency_callback: toast on missing chat_id or malformed callback_data; warn on DB record_decision failure.
    • On createForumTopic fall-through, inform the user and run in the current thread with the error reason.

Written for commit c4f30b7. Summary will update on new commits. Review in cubic

…ld Mini App

Cuts and consolidations driven by the principle Magnus laid out: agency is the default, not a separate mode; one source of truth; user-visible Telegram-first surface; less doctrine to read every cycle.

Removed
- agency-skill.md (12 LOC) — Claude Code skill registry stub. Agency is the default after v1, no trigger phrase to register. bootstrap.sh removes the legacy symlink from existing boxes.
- AGENCY.md (470 LOC) — folded the essential ~25 lines of card-shape doctrine directly into CLAUDE.md (## Composing a card). One operating manual, not two.
- mini_app_static/{index.html, app.js, app.css} (~2230 LOC) — the legacy "feed" Mini App UI that wasn't reachable from the bot's /miniapp button (that one goes to /tinder). Dropped /feed route in mini_app.py too.

Doctrine
- CLAUDE.md trimmed 259 -> 161 lines. Tighter "How you talk", merged Conventions+Don't, the new "Composing a card" section is ~25 lines instead of the original 470.

Service stack
- bux-miniapp.service and bux-miniapp-tunnel.service no longer enabled at boot. The bot already lazy-starts them on /miniapp invocation; running cloudflared 24/7 was wasted free-tier quota and one more thing to debug. install.sh and bootstrap.sh both updated to match.

Silent-failure fixes (from the dead-air scan)
- _handle_agency_callback: missing chat_id now toasts "card is gone" instead of returning silently.
- _handle_agency_callback: malformed callback_data now toasts "data is malformed" instead of an empty toast.
- _handle_agency_callback: DB record_decision failure now posts a one-line warning to the chat so the tap doesn't feel like a no-op.
- _handle_agency_callback: createForumTopic fall-through now tells the user "running in this thread instead" with the error reason.

Tests
- 8 new GoalModeTest + AgencyGoalPromptTest cases covering /autopilot, /copilot, default mode, invalid-mode fallback, mode flip, prompt mode awareness. 29 tests pass.

Deferred to v3
- Full install.sh -> bootstrap.sh consolidation (cleanest if installed wraps bootstrap; needs a fresh-box test pass).
- Telegram_bot.py module split (7741 LOC, 115 top-level fns).
- Remaining silent paths (refine context-injection swallow — likely dropped along with refine entirely in v3).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 12 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="agent/bootstrap.sh">

<violation number="1" location="agent/bootstrap.sh:322">
P2: The new lazy-start change is undermined because bootstrap still starts `bux-miniapp-tunnel.service` whenever `/etc/bux/tg.env` exists, so the tunnel can run at boot/update without `/miniapp` usage.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Re-trigger cubic

Comment thread agent/bootstrap.sh
# boot — they only run if the user opens the Mini App, and the cloudflared
# tunnel stops when not in use. Disable any prior enables to make this
# rollout self-healing.
systemctl disable bux-miniapp.service bux-miniapp-tunnel.service 2>/dev/null || true
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new lazy-start change is undermined because bootstrap still starts bux-miniapp-tunnel.service whenever /etc/bux/tg.env exists, so the tunnel can run at boot/update without /miniapp usage.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agent/bootstrap.sh, line 322:

<comment>The new lazy-start change is undermined because bootstrap still starts `bux-miniapp-tunnel.service` whenever `/etc/bux/tg.env` exists, so the tunnel can run at boot/update without `/miniapp` usage.</comment>

<file context>
@@ -317,11 +311,15 @@ systemctl enable box-agent.service
+# boot — they only run if the user opens the Mini App, and the cloudflared
+# tunnel stops when not in use. Disable any prior enables to make this
+# rollout self-healing.
+systemctl disable bux-miniapp.service bux-miniapp-tunnel.service 2>/dev/null || true
 
 # Boot-time pull runs ahead of the others on every reboot.
</file context>
Fix with Cubic

MagMueller added a commit that referenced this pull request May 15, 2026
…omposio for codex

Lands 16 stacked PRs reviewed by multiple sub-agents:

- v1 (#209)  /goal as primitive, per-topic autopilot vs copilot
- v2 (#210)  drop agency-mode gate, fold doctrine into CLAUDE.md, delete old Mini App UI
- v3 (#211)  CLAUDE.md → system-prompt.md (source of truth), agent identity = "agency"
- v4 (#212)  trim system prompt to 87 lines, mode emoji in topic title, extract bot/markdown.py
- v5 (#213)  heartbeat-by-default plumbing (later removed), copilot voice fix, autopilot security note
- v6 (#214)  steering semantics, new-topic spawning, 2-option cards, source-aware images
- v7 (#215)  /goal IS autopilot framing, drop topic emoji prefix, silence allowed, codex goals=true, `schedule` alias
- v8 (#216)  drop --spawn-topic, --importance, trim agency-report docstring
- v9 (#217)  new-topic helper — spawn fresh lane synchronously, queue heartbeat
- v10 (#218) self-schedule only when waiting on something concrete; drop auto-heartbeats
- v11 (#219) /goal is a verbatim CLI passthrough; bot is a dumb pipe
- v12 (#220) drop 30-min timeout, kill lingering heartbeat, prompt-injection defenses, seed goals.md
- v13 (#221) /goal stays copilot by default; autopilot only on explicit user opt-in
- v14 (#222) doctrine fixes from final multi-agent review
- v15 (#223) tighten autopilot triggers — drop the loose phrases
- v16 (#224) register composio MCP for codex too; simplify autopilot trigger paragraph

Tests: 22 pass.

Follow-ups (tracked, not in this merge):
- P0: install bootstrap.sh as /usr/local/sbin root:root (closes the trivial bux→root)
- P1: stuck-lane watchdog (no-stdout-for-30-min SIGTERM)
- P1: /invite is a dead command (remove from BotFather menu)
- P1: composio tool names wrong-case in system prompt
- P1: help text + COMMANDS still reference dropped autopilot trigger phrases
- P1: BUX_BOX_TOKEN provenance for OSS self-host installs
- P2: button-tap dispatches bypass _enqueue (lane race on rapid taps)
- P2: persisted per-topic autopilot flag in state (instead of LLM phrase detection)
- P2: agency_db ghost columns (importance, spawn_topic)
- P2: mini app teardown decision (1700 LOC for an unreferenced surface)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant