Agency: agency-report helper + SQLite suggestion DB + dedupe#89
Open
MagMueller wants to merge 1 commit intomainfrom
Open
Agency: agency-report helper + SQLite suggestion DB + dedupe#89MagMueller wants to merge 1 commit intomainfrom
MagMueller wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
2 issues found across 4 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_db.py">
<violation number="1" location="agent/agency_db.py:154">
P1: Decision classification order is wrong: labels like “Just do it differently” are saved as `accepted` because `"do it"` is checked before `"different"`.</violation>
</file>
<file name="agent/agency-report">
<violation number="1" location="agent/agency-report:78">
P2: Handle missing `/etc/bux/tg-allowed.txt` in `chat_id()` to avoid an uncaught traceback on first-run/unbound setups.</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 on lines
+154
to
+162
| if any(w in low for w in ("yes", "do it", "ship", "send", "merge", "approve")): | ||
| status = "accepted" | ||
| elif any(w in low for w in ("regen", "redo", "rethink")): | ||
| status = "regenerated" | ||
| elif any(w in low for w in ("different", "differently")): | ||
| status = "differently" | ||
| elif "no" in low or "skip" in low or "don't" in low or "ignore" in low: | ||
| status = "dismissed" | ||
| else: |
Contributor
There was a problem hiding this comment.
P1: Decision classification order is wrong: labels like “Just do it differently” are saved as accepted because "do it" is checked before "different".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agent/agency_db.py, line 154:
<comment>Decision classification order is wrong: labels like “Just do it differently” are saved as `accepted` because `"do it"` is checked before `"different"`.</comment>
<file context>
@@ -0,0 +1,245 @@
+ if row is None:
+ return None
+ low = decision.lower()
+ if any(w in low for w in ("yes", "do it", "ship", "send", "merge", "approve")):
+ status = "accepted"
+ elif any(w in low for w in ("regen", "redo", "rethink")):
</file context>
Suggested change
| if any(w in low for w in ("yes", "do it", "ship", "send", "merge", "approve")): | |
| status = "accepted" | |
| elif any(w in low for w in ("regen", "redo", "rethink")): | |
| status = "regenerated" | |
| elif any(w in low for w in ("different", "differently")): | |
| status = "differently" | |
| elif "no" in low or "skip" in low or "don't" in low or "ignore" in low: | |
| status = "dismissed" | |
| else: | |
| if any(w in low for w in ("regen", "redo", "rethink")): | |
| status = "regenerated" | |
| elif any(w in low for w in ("different", "differently")): | |
| status = "differently" | |
| elif "no" in low or "skip" in low or "don't" in low or "ignore" in low: | |
| status = "dismissed" | |
| elif any(w in low for w in ("yes", "do it", "ship", "send", "merge", "approve")): | |
| status = "accepted" | |
| else: | |
| status = "accepted" # custom labels like "Send draft A" → treat as accept |
|
|
||
|
|
||
| def chat_id() -> int: | ||
| raw = Path("/etc/bux/tg-allowed.txt").read_text().splitlines() |
Contributor
There was a problem hiding this comment.
P2: Handle missing /etc/bux/tg-allowed.txt in chat_id() to avoid an uncaught traceback on first-run/unbound setups.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agent/agency-report, line 78:
<comment>Handle missing `/etc/bux/tg-allowed.txt` in `chat_id()` to avoid an uncaught traceback on first-run/unbound setups.</comment>
<file context>
@@ -0,0 +1,195 @@
+
+
+def chat_id() -> int:
+ raw = Path("/etc/bux/tg-allowed.txt").read_text().splitlines()
+ for line in raw:
+ line = line.strip()
</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
Persistent suggestion store: every Agency post is recorded in
/var/lib/bux/agency.dbso future runs can dedupe, and a button tap records the decision against the source row.agent/agency_db.py(new) — SQLite store. One row per suggestion: title, description, importance, source slug, prompt that runs on accept, buttons_json, TG identifiers, status, decision label, worker_topic_id, timestamps.agent/agency-report(new) — Python CLI. Inserts row, posts TG with inline buttons.--skip-if-existsdedupes by--sourceslug.--buttonrepeatable for custom label sets.agent/telegram_bot.py—_handle_agency_callbackrecords each tap viaagency_db.record_decision(...). Out-of-band buttons no-op.agent/bootstrap.sh— symlink +/var/lib/buxinstall dir.Default buttons
✅ Yes, do it · ❌ No · ✏️ Just do it differently · 🔄 Regenerate
Magnus's principle
"If I didn't respond to something, you can ignore it." A pending row > 48h is implicit dismissal.
🤖 Generated with Claude Code
Summary by cubic
Adds a persistent SQLite-backed suggestion store and a new
agency-reportCLI that posts Agency suggestions to Telegram with inline buttons. Button taps are recorded for dedupe and status tracking across runs.New Features
agent/agency_db.py: SQLite DB at/var/lib/bux/agency.dbwith helpers to insert suggestions, update message IDs, record decisions, set status/worker topic, and search.agent/agency-report: records a suggestion, posts to Telegram with default or custom buttons, links back themessage_id, and supports--skip-if-existsdedupe by--source.telegram_bot.py: on callback, writes the tapped label to the DB; ignores out-of-band buttons.bootstrap.sh: adds/usr/local/bin/agency-reportand ensures/var/lib/buxexists and is writable.Migration
TG_BOT_TOKEN(env or/etc/bux/tg.env) and ensure/etc/bux/tg-allowed.txthas the chat ID; optionally setTG_THREAD_ID.Written for commit 025e497. Summary will update on new commits.