Skip to content

Refine Agency generator goal doctrine#170

Merged
MagMueller merged 1 commit into
mainfrom
codex/agency-goal-generator-doctrine
May 13, 2026
Merged

Refine Agency generator goal doctrine#170
MagMueller merged 1 commit into
mainfrom
codex/agency-goal-generator-doctrine

Conversation

@MagMueller
Copy link
Copy Markdown
Contributor

@MagMueller MagMueller commented May 13, 2026

Summary

  • Make Agency doctrine explicit about one generator lane, private goals memory, goal-discovery cards, and fresh worker sessions per accepted Mini App card.
  • Add Mini App support for a private goals file via BUX_GOALS_FILE / /opt/bux/repo/private/goals.md, including appending newly created goals and injecting goals into generation prompts.
  • Route accepted Mini App cards into a fresh worker topic by default and update tests accordingly.

Tests

  • /opt/bux/venv/bin/python -m unittest agent/test_mini_app.py
  • /opt/bux/venv/bin/python -m py_compile agent/mini_app.py agent/test_mini_app.py && git diff --check

Summary by cubic

Defines the Agency generator as a single lane with private goals memory and makes accepted Mini App cards start fresh worker sessions by default. Adds a private goals file that feeds generation prompts and updates tests to the new behavior.

  • New Features

    • Private goals file via BUX_GOALS_FILE (default /opt/bux/repo/private/goals.md): appends new goals on creation and injects content into generator prompts; safe read/append with size cap.
    • Accepted Mini App cards now launch a fresh worker session/topic by default; _start_agent_work creates a forum topic when needed and uses worker_topic_id.
    • Generator prompts treat the Mini App topic as a feed: read goals and agency.db first, avoid repeats, prefer goal-discovery cards when goals are unclear, and do reversible work before asking.
    • agent/AGENCY.md updated for one generator lane, follow-up/versioned cards, and worker-session routing; tests cover goals file writes and new-topic dispatch.
  • Migration

    • Ensure write access to /opt/bux/repo/private; set BUX_GOALS_FILE if using a custom path.
    • Expect new worker topics for accepted Mini App cards; update any tooling that assumed in-topic execution.

Written for commit 02dfb0c. Summary will update on new commits.

@MagMueller MagMueller merged commit 9152697 into main May 13, 2026
7 checks passed
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.

2 issues found across 3 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/AGENCY.md">

<violation number="1" location="agent/AGENCY.md:444">
P2: The new Mini App routing rule conflicts with nearby guidance, leaving ambiguous whether accepted cards always get a fresh worker session or can stay in the goal session.</violation>
</file>

<file name="agent/mini_app.py">

<violation number="1" location="agent/mini_app.py:869">
P2: The new 12,000-character goals-file cap can make Mini App context dispatch exceed Telegram’s message length limit, because this path sends one raw `sendMessage` without chunking.</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.

Comment thread agent/AGENCY.md
`/miniapp` opens the per-box Telegram Mini App. "Agency start <goal>" or a new Mini App goal creates/uses one Telegram topic as the goal lane, records context there, and asks the agent to generate initial cards. "Generate more" means: continue from that topic's current context and produce more high-signal action cards, not a new goal. Cards should use short, phone-readable copy, clickable sources, real images/videos when available, and no internal IDs.

When a Mini App card is accepted, run it in the same goal topic/session by default. If the user accepts 10 cards from one goal, push all 10 into that goal's agent session. The agent can create sub-agents or new Telegram topics later only when it is clearly useful: recurring monitor, larger project, or >10-tool-call investigation.
When a Mini App card is accepted, start a fresh worker session for that card. The goal topic remains the generator lane. If the user accepts 10 cards from one goal, that creates 10 worker sessions tied back to the same goal and card history. The generator should still learn from their outcomes before creating the next batch.
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

P2: The new Mini App routing rule conflicts with nearby guidance, leaving ambiguous whether accepted cards always get a fresh worker session or can stay in the goal session.

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

<comment>The new Mini App routing rule conflicts with nearby guidance, leaving ambiguous whether accepted cards always get a fresh worker session or can stay in the goal session.</comment>

<file context>
@@ -422,10 +441,12 @@ Check each topic's brief before drafting.
 `/miniapp` opens the per-box Telegram Mini App. "Agency start <goal>" or a new Mini App goal creates/uses one Telegram topic as the goal lane, records context there, and asks the agent to generate initial cards. "Generate more" means: continue from that topic's current context and produce more high-signal action cards, not a new goal. Cards should use short, phone-readable copy, clickable sources, real images/videos when available, and no internal IDs.
 
-When a Mini App card is accepted, run it in the same goal topic/session by default. If the user accepts 10 cards from one goal, push all 10 into that goal's agent session. The agent can create sub-agents or new Telegram topics later only when it is clearly useful: recurring monitor, larger project, or >10-tool-call investigation.
+When a Mini App card is accepted, start a fresh worker session for that card. The goal topic remains the generator lane. If the user accepts 10 cards from one goal, that creates 10 worker sessions tied back to the same goal and card history. The generator should still learn from their outcomes before creating the next batch.
 
 When you receive an accepted Mini App card, treat the card as a full ticket. Read the title, why-it-matters sentence, source, expandable sections, and picked button before acting. If the ticket is a bigger project or recurring monitor, create a dedicated Telegram topic and send the agent there; otherwise keep working in the current goal session.
</file context>
Fix with Cubic

Comment thread agent/mini_app.py
except Exception as exc:
print(f"bux-miniapp: goals file read failed: {exc}", file=sys.stderr)
return ""
return text[:12000]
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

P2: The new 12,000-character goals-file cap can make Mini App context dispatch exceed Telegram’s message length limit, because this path sends one raw sendMessage without chunking.

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

<comment>The new 12,000-character goals-file cap can make Mini App context dispatch exceed Telegram’s message length limit, because this path sends one raw `sendMessage` without chunking.</comment>

<file context>
@@ -857,6 +858,43 @@ def _settings() -> dict[str, str]:
+    except Exception as exc:
+        print(f"bux-miniapp: goals file read failed: {exc}", file=sys.stderr)
+        return ""
+    return text[:12000]
+
+
</file context>
Fix with Cubic

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