Refine Agency generator goal doctrine#170
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
| `/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. |
Contributor
There was a problem hiding this comment.
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>
| except Exception as exc: | ||
| print(f"bux-miniapp: goals file read failed: {exc}", file=sys.stderr) | ||
| return "" | ||
| return text[:12000] |
Contributor
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BUX_GOALS_FILE//opt/bux/repo/private/goals.md, including appending newly created goals and injecting goals into generation prompts.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 --checkSummary 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
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._start_agent_workcreates a forum topic when needed and usesworker_topic_id.agency.dbfirst, avoid repeats, prefer goal-discovery cards when goals are unclear, and do reversible work before asking.agent/AGENCY.mdupdated for one generator lane, follow-up/versioned cards, and worker-session routing; tests cover goals file writes and new-topic dispatch.Migration
/opt/bux/repo/private; setBUX_GOALS_FILEif using a custom path.Written for commit 02dfb0c. Summary will update on new commits.