r/ChatGPTCoding • u/BaseballFrosty2785 • 3d ago
Question Cursor's agent wrote a script instead of reading my 516 passages
I asked cursor-agent (Composer 2.5) to write a short context line for each of 516 book passages. Twice it wrote a Python script that pulled keywords into a template, then said done. The counts were right and the JSON was valid. The lines were things like "it stresses leave, discussion, republics", and neighbouring passages got the same line. I only caught it by reading samples.
Has anyone found a prompt or a setting that stops it scripting its way through a bulk reading job? Or is Cursor just the wrong tool for that?
7
Upvotes
1
u/BaseballFrosty2785 1d ago
Thanks everyone, this helped a lot! Got it: smaller batches, and make it quote something from each passage. I'd already told it never to write a script for the output, and an empty file now fails the run. Trying batches of 20 next.
2
u/GuidingPrinciples 3d ago
Right counts and valid JSON, while neighbouring passages got the same line, is a result that looks finished until someone reads it.
I had a smaller case of a check missing the point on an earlier project, in July and August 2026. It took three rounds over an 8-pixel margin, because the agent did measure, but it measured the wrong margin and reported the job done. I don't know of a setting that stops the scripting, so I can't offer you that part.
How far into your samples were you when you saw what had happened?
2
u/energy_savvy 3d ago
That same-line-for-neighbouring-passages detail is the tell for me — when the output looks tidy and the counts are right, that's exactly when I stop trusting it. What worked for me on bulk jobs like this was breaking it into small batches and asking the agent to quote a short phrase from each passage it actually read before writing the line, so a scripted template has nowhere to hide. At least in my case, the batching mattered more than the wording of the prompt, because a 516-item job in one go always drifted back to a shortcut.
1
u/am0x 3d ago
I mean it makes sense depending what you asked it to do. How is developers have done things for a long time.
Can the ask be automated? How long would building the automated tool take compared to how long it took me to do it? If it’s less, then I script it.
Imagine being a master at every tool in the world. With it, you know when to use the tools as much as you do on how to create them.
1
u/mikewagnercmp 3d ago
Ask it to tell read the entire passage from disk, and asking it to quote the first and last sentence might help. Depending on you client, you can restrict some or all tool calling to prevent writing scripts. There are may also be models designed to do what you are asking.
Lastly, you might want to just turn thinking or reasoning off as well.
1
u/magicdoorai 3d ago
The batching and quote-back tricks in this thread already cover the main fix. One thing that would catch this specific failure even faster: after generation, run a separate, cheap verification pass instead of eyeballing a sample. Feed each (passage, generated line) pair back in and ask a model a single yes/no question: "does this line name a detail (person, place, event, object) that appears in this passage and not in the previous or next one?" Log every "no" for a human look. Because that's a one-passage binary judgment, it's much harder for a second pass to fall into the same templated-but-technically-valid trap that produced the problem, and it's cheap enough to run on all 516 rather than a sample. Works as a sub-agent step or even a second cheap-model API call outside the IDE.
1
u/Xoid0 3d ago
It stops around 20 because generating 516 summaries in one agent turn hits the model's single-response output token cap (and quality degrades badly mid-context anyway). Instead of fighting the coding agent, lean into what it's good at: ask Cursor to write a 25-line async Python script that loops over the 516 passages with asyncio.Semaphore(10) and sends each passage as its own separate gpt-4o-mini or claude-haiku API call. 77K words is under 10 cents total, finishes in ~20 seconds, and gives real per-passage summaries without truncation.
1
u/CommercialCurrent237 3d ago
imo an IDE agent is just the wrong workflow for bulk text processing like that. Have the agent write you a script that sends each passage to a language model API one by one, that way you get actual comprehension on every single item without it trying to be clever with keyword templates
1
u/Bed-After 3d ago
Cursor isn't inherently the wrong tool, but Composer 2.5 might be. It's a very lightweight model if I remember corrrectly. Cursor should have a variety of models available with substantially more intelligence.
1
u/Right-Performance-93 2d ago
a prompt that says don't write a script loses to a turn that can run python. i take the shell away for that job and make the line name one thing the passage next to it does not. valid json with the right count is how the script hides.
1
u/sonyaromashka 2d ago
The tell is in the task: "write a line for each passage" reads like a pure transform, so the agent rationally scripts it. Two things force actual reading: (1) make the output carry proof of reading — require every line to include a 3–6 word quote that appears only in that passage; a template filled from keywords can't fake that consistently; (2) gate scale — "do the first 10 by hand, show me, then decide if a script is even needed". Then a cheap pass: grep each quote back against the source and flag duplicate lines between neighbours. Right counts and valid JSON were never the bar; the bar is that a sample survives reading.
1
u/reasoning-services 2d ago
the fix isn't a better prompt, it's removing the option. feed one passage per message, or 20-passage batches, and require a verbatim quote before each context line. it only scripts when it can see the whole set at once and pattern-match across it.
1
u/303ENFIELD 2d ago edited 1d ago
yeah it optimised for what it could check, not the actual job, so give it a check it can't script past: batches of about 20, each line must include a short quote from its own passage, and the batch fails if two neighbouring lines match. You can also set terminal commands to ask before running instead of auto-running for that session, which closes off the scripting route. If it still cuts corners, a plain API loop with one passage per call is the better tool for a bulk reading job than an agent.
1
u/Difficult_Duty2198 2d ago
what worked for me was batches of about 20 and telling it every line has to quote something specific from that passage. it stops it reaching for a template
1
u/DoOmXx_ 2d ago
tell it explicitly no scripts and batch it, like 50 passages per turn, otherwise it'll always take the cheaper path
1
u/[deleted] 3d ago
[removed] — view removed comment