Skip to content

wildthink/code-monkey

Repository files navigation

Give your AGENT the Cliff NOTES

Before TL;DR there were Cliff Notes. How a small CLI made my GPT sessions faster, cheaper.


Remember Cliff Notes? My guess is that's a hard, "Huh? What's that old-dog talking about?" But remember, a smart dog thinks maybe, "a experienced old dog would know a new trick when he sees one."

Stay with me and I could save you xxx% on your token counts.

Sound principles are timeless.

War and Peace prints as 15 "books", each around 20 chapters each. All told, 587,287 words, or about 1,215 pages.

Hillegass and his wife, Catherine, started the business in their basement in 1958. They hired literature teachers to condense works of literature into concise summaries, commentaries, author biographies and character analyses.

The Cliff Note summary and analysis of Book I, Chapters 1-6 is 1,201 words, or about 35 lines.

Yeah you say, "But that was in 1958, GPT can do that for me". BUT, that't ain't free! And, Guess what. Cliff Notes are still around today.

The point is, Sound principles are timeless.

And code being code, means we can summarize it better, faster, cheaper, for GPT not with it!


The Elephant in the Room

When I first asked my AGENT to fix updateUser(). It loads the whole file. In my (simple) case, 600 lines. Most of it not relevant to the task at hand. I watched the token meter tick up.

I mean it's just more time and money? The thing is, research tells us that when a context window is more than 50% full, accuracy degrades — proportional to the distance the relevant is to the end. The "Lost in the Middle" effect.

Loading a full file doesn't just eat tokens. It pollutes the output, adding slop to the solution. Not only is there an elephant in the room, that elephant is running amok pooping all over your furniture. So, you're actually paying more for less quality and more technical debt.


What code-monkey actually does

Two commands, most of the value.

schema is the Cliff Notes. It reads a Swift file and returns only signatures — no bodies, no comments. A 600-line service collapses to this:

struct UserService {
    var users: [UUID: User]
    func createUser(email: String, role: UserRole = .user) -> User
    func updateUser(_ id: UUID, applying changes: (inout User) -> Void) throws
}

clip pulls exactly one declaration by name:

code-monkey clip "updateUser" Sources/UserService.swift

Twelve lines. The ones you need. Nothing else. The relevant chapter, not the whole novel.

The workflow clicks into place fast: schema to orient, clip to read, clip --paste-replacing to write. The AI never sees a line it doesn't need.


It's not just about the tokens

The interesting thing is precision pays off in multiple ways.

When an AI holds a full file, earlier declarations bleed into its reasoning about later ones. Noise takes up the position-sensitive real estate where accuracy is highest. Giving it exactly one declaration — clean, isolated — keeps the model focused on the thing you actually care about.

Writes are cleaner too. --paste-replacing swaps a named declaration atomically. --paste-after inserts after one. No reconstructing surrounding context. No managing line numbers.


I'm not making this up!

Google's Chrome DevTools team hit the same wall adapting AI to performance traces. Megabyte trace files, blown context windows, degraded answers. Their fix — published early 2026 — was architecturally the same: compact format, on-demand fetching, strict scoping. They called it a prerequisite for the feature to work at all.

Qodo took the same approach for code review: scope to the relevant declaration, not the file. They measured 70% fewer tokens, faster responses, better suggestions.

Nobody coordinated. Everyone arrived at the same conclusion.


There's more to it

code-monkey also has search (find declarations across a whole directory, not grep matches), deps (which files reference a symbol — useful for scoping AI prompts to a refactor), and context (bundle matching declarations from across the project into a single paste-ready block, with token estimates).

It's still very much a work in progress, but I'm liking it so far!

Check out the project on GitHub — the README and docs go deep on the full command set, the SwiftSyntax parsing, and how to wire it up with your AI tooling.

About

CLI for GPT to skim and edit Swift code

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors