Repository navigation
feat(plugin): /context-guru:cache-campaign builds, shows and switches keep-alive campaigns - #522
Merged
Merged
Conversation
OsherElhadad
commented
Oct 13, 2026
OsherElhadad
left a comment
Collaborator
Author
There was a problem hiding this comment.
Review: APPROVE at 86638fd. (Posted as a comment: GitHub does not let the author account approve.)
- This is a port of private #3, reviewed and merged there. The plugin and codex copies of
cg.pyare byte-identical.go vetis clean and the pluginCampaigntests pass. - The PR targets main without #521's routes. Until #521 merges, the command hits a 404 and shows the labelled example, so merging in either order is safe. Merging #521 first gives users the working command straight away.
- The commit is by Osher-Elhadad, signed off, with no AI attribution. The PR text has no identifiers or figures.
Approved.
OsherElhadad
commented
Oct 13, 2026
OsherElhadad
left a comment
Collaborator
Author
There was a problem hiding this comment.
Re-review: APPROVE at 1ea4e2c. (Posted as a comment: GitHub does not let the author account approve.)
allowed-toolsnow pre-approves only the reads:cache-campaignwith no argument, andcache-campaign show:*.buildandmodeget Claude Code's permission prompt. With the oldcg.py:*restored, TestCacheCampaignSkillPreApprovesOnlyReads fails.- 7cf6f4b's docs anchor fix and the pointer to
/context-guru:adapt cacheare fine. The plugin Campaign and Skill tests pass andgo vetis clean. Both commits are signed off with no AI attribution.
Nits, non-blocking:
cache-campaign details(latest campaign with details) is a read but is not pre-approved.- The skill runs
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/cg.py"in quotes, but the patterns have no quotes, so a pre-approval may never match. This is pre-existing and the same in every plugin skill; it is worth one live check.
OsherElhadad
commented
Oct 13, 2026
OsherElhadad
commented
Oct 14, 2026
OsherElhadad
left a comment
Collaborator
Author
There was a problem hiding this comment.
Re-review: APPROVE at 11a4aed (0abf0f7 quoted patterns, 11a4aed test). (Posted as a comment: GitHub does not let the author account approve.)
- Patterns. The patterns are now quoted the way the skill's command line quotes the path:
cg.py" cache-campaign(exact),cg.py" cache-campaign details(exact) andcg.py" cache-campaign show:*(prefix).buildandmodematch none of them, so they still get the permission prompt. TestCacheCampaignSkillPreApprovesOnlyReads banscg.py:*,cache-campaign:*,buildandmode:*, and TestCacheCampaignPatternsCoverTheReadsAndNoWrite checks every read line is covered and no write line is. - The open question, no-argument read and a trailing space. In Claude Code 2.1.299 the permission check trims the command first (
e.command.trim()) and then compares an exact rule with===. With an empty$ARGUMENTS, the trailing space fromcache-campaign $ARGUMENTSis removed before matching, so the exactcg.py" cache-campaignrule matches. If a client ever left the space in, the only cost would be a permission prompt, never a wider grant. - CI is green (build-test, purego, trivy, DCO). Both commits are signed off with no AI attribution.
Approved.
… keep-alive campaigns A manager command over the proxy's campaign routes (#536): - build [--builder auto] [--session-end]: start a build for a tenant and wait up to 80 s. - show [ID] [details]: the verdict against the best fixed rule; details lists every strategy. - mode ID off|shadow|active [--force]: shadow spends nothing; active needs a ship recommendation unless forced. The routes are manager only: Api.send now sends CG_DASH_COOKIE when set. The command uses the shared Api.send (a timeout reads "did not answer in time") and the shared --force flag. The skill pre-approves only its reads (no argument, details, show), quoted the way the skill runs them; build and mode get the permission prompt. A proxy without the routes gets a sample screen labelled as an example. Same script in the Codex plugin. Users pick their own keep-alive strategy with save-more cache; docs/plugin/cache-campaign.md says so. Signed-off-by: Osher-Elhadad <[email protected]>
OsherElhadad
force-pushed
the
port/cache-campaign-command
branch
from
October 15, 2026 11:14
11a4aed to
daa62af
Compare
amiddavid
reviewed
Oct 15, 2026
amiddavid
left a comment
Collaborator
There was a problem hiding this comment.
Review of the rebase (daa62af)
Verdict: approve.
What I checked
- Range-diff against the approved
11a4aedb. Every change is a conflict resolution or follows from #526:Api.reqis gone. The command uses #526'sApi.send.CG_DASH_COOKIEis now sent insidesend.- A timeout (
code == -1) now reads "did not answer in time". --forceis the shared flag. Theforceoption moved fromcampaign{}to the top level.cache-campaignis added toCMDS, not toREADSorWRITES.- The usage text lists #526's
save-moreandremove-mcp-and-skills, pluscache-campaign. --mockfalls back to a loopback base, merged into #526'sbaseline.- The skill and test are new since the approval. They are covered below.
- Pre-approval. The skill allows three patterns: no argument,
details(both exact) andshow:*.buildandmodematch none. I traced the odd inputs (show apply,show revert,show build). None reaches a write. #526 refusesapplyandrevertunder a read command. - Nothing lost from #526.
KINDS,READS,WRITES,adapt_wordsand the main-side dispatch are as on main. Docs index andmkdocs.ymlhold #526's pages plus Cache campaign. I could not runmkdocshere (not installed). - Both
cg.pycopies are byte-identical. No test enforces this. The Codex skill has noallowed-tools, which is right.
Tests (eval box 1)
go test ./context-guru-plugin: ok, 371 s.- Mutation: I added a
build:*pattern to the skill.TestCacheCampaignSkillPreApprovesOnlyReadsandTestCacheCampaignPatternsCoverTheReadsAndNoWriteboth failed. I removed the box copy.
No blocking findings.
This was referenced Oct 15, 2026
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.
What
A plugin command over the proxy's campaign routes from #521:
buildstarts a build and waits up to 80 s, then prints the id to check later.showgives one line: does the plan beat the best fixed rule on this tenant's history, with an interval;detailslists every strategy compared and, for the auto builder, the plan that runs next to the fleet's.mode:shadowdecides and spends nothing;activeis refused unless the build recommended it (--forceoverrides).How to turn it on
Manager only: set
CG_DASH_COOKIEto the dashboard login cookie. Without it the routes answer 401 and the command says so. A proxy without the campaign routes (anything before #521) gets a sample screen labelledEXAMPLE, not your data.How it fails safe
showis read-only.buildandmodeonly call the manager routes, which enforce the ship gate and audit every call. Unreachable proxy, 401/403 and server errors each produce one plain line.Docs
New
docs/plugin/cache-campaign.md, a row indocs/plugin/index.md, mkdocs nav.Tests
go test ./context-guru-pluginpass (cg_campaign_test.go: stub proxy for build/poll, show, details, mode, 409 and 401 paths, older-proxy fallback, Codex copy identical).