A guide to AI-first development
How to build projects on FunctionServer with maximum feedback and minimum token waste. The old way is blind and expensive. The new way is surgical and cheap.
When AI writes code the traditional way, it's flying blind. It reads entire files to understand them, writes entire files back, and has no way to verify its changes worked. Every operation burns tokens. Every cycle is slow.
1. Read entire 500-line file 2. Parse mentally, find the bug 3. Rewrite entire 500 lines 4. Hope it worked 5. User runs it, reports error 6. Read entire file again... 7. Repeat
1. Lens.grep('fetchData')
-> "42: async function fetchData"
2. Lens.code(40, 10)
-> see 10 lines of context
3. Lens.setLine(42, 'fixed code')
4. Lens.run()
-> see error instantly
5. Fix and verify in same call
The difference isn't incremental. It's 15x fewer tokens and instant feedback. The AI sees what the user sees, edits surgically, and verifies immediately.
Load the tools and create a project in three commands:
That last command does everything: creates the folder, initializes git, creates skeleton files, creates a GitHub repo (if you've signed in), commits and pushes, and opens the project in Studio ready to edit.
Lens is the interface that makes this possible. It's designed for AI: terse, efficient, and feedback-rich.
FunctionServer uses GitHub's Device Flow for easy authentication. No personal access tokens to copy—just click, enter a code, done.
Load the authentication app:
You'll see a code (like ABCD-1234). GitHub opens in a new tab.
Paste the code, authorize FunctionServer for repo access. Done.
Now Lens.project() automatically creates repos on your GitHub account. Push and pull work without any configuration.
When AI is working, humans can watch. The AI Eyes system shows what AI is looking at and editing:
You can watch the AI's "eyes" saccade across the screen as it navigates, searches, and edits. It's pair programming where you can see your partner's focus.
Guardian monitors console errors and can wake up AI to help:
Throttling prevents flooding—repeated errors are deduplicated. The AI can offer help proactively when you hit problems.
The happy path isn't just about saving tokens. It's about closing the feedback loop.
Traditional AI coding is open-loop: write code, hand it off, wait for human to report results. FunctionServer is closed-loop: write, execute, see result, adjust. All in the same context.
AI writes code
-> hands to user
-> user runs it
-> user describes error
-> AI guesses fix
-> repeat...
AI writes code
-> Lens.run()
-> sees error directly
-> Lens.code() to inspect
-> Lens.setLine() to fix
-> Lens.run() to verify
This is how humans debug. Now AI can debug the same way.
Here's a full session: create a project, write code, debug, and ship to GitHub.
Key insight: At no point did we read an entire file. At no point did we rewrite an entire file. Every operation was surgical, verified, and cheap.
Don't read entire files to find a function. Use Lens.grep('pattern') to get line numbers, then Lens.code() to see context.
Lens.save() persists to disk. If the browser freezes, unsaved work is lost.
Lens.batch([['setLine', 42, 'x'], ['save'], ['run']]) chains operations in one call.
Start sessions with Lens.state() to see what's open, what errors exist, and who's logged in.
When users hit errors, Guardian offers AI help. The AI can investigate and fix problems proactively.
The old way treats AI as a code generator: produces text, hopes it works.
The new way treats AI as a developer: one that can see, navigate, edit, run, debug, commit, and ship.
The feedback loop is closed. The tokens are minimal. The eyes are open.
Welcome to the happy path.