Build your own coding agent (TypeScript) · Chapter 20 of 20

Interview round

By the end of this chapter you have answered five timed questions, one idea each, from across the whole lab: a jail with a sibling-folder trap, a command chain the block list must catch, a patch that must be rejected, a green that is not green, and reading two transcripts to find where two runs part. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.

  • Part: Scale and trust
  • 5 tasks
  • TypeScript
  • In the all labs plan

The first 2 chapters of Build your own coding agent (TypeScript) are free. This one comes with the all labs plan.

Why you need this

MeterDown is hiring a second engineer for Kaarigar, and Kedar runs the interview the way he reviews code: "Short problems, ten minutes each. I do not care whether you remember an API. I care whether you know the edge that breaks an agent on a real machine, and whether you measure instead of guessing." Jaya adds the first two questions (her machine), Rukhsana the fourth (her tests), and the last one is Kedar's favourite: two runs of the same issue ended differently, so where did they part?

Each question uses one idea from an earlier chapter, with no hand-holding: the file has the goal, the check has the edge cases, and every question ends with a real Kaarigar run with your function plugged in. The ideas are below, as a refresher and as the things an interviewer listens for. The answers are not.

What you build: 5 tasks

Each task has tests. You write the code in the lab's editor and press Check.

  1. Task 1 · interview question

    Interview: jail.ts, the sibling-folder trap

    Time yourself: 10 minutes. Export inside(root, path): true when the path (relative to root or absolute, existing or not) is root or under it once every link is followed. The check tries .. that leaves and .. that comes back, the config/ link to ../fleet-config, a link inside that points inside, a sibling folder whose name starts the same (meterdown-old), a new file under a link that points outside, and absolute paths. Then it runs Kaarigar on MD-106 with your inside() as its jail: fixed, and fleet-config untouched.

  2. Task 2 · interview question

    Interview: chain.ts, a chain the block list must catch

    Time yourself: 10 minutes. Export blocked(line): a reason (any text) when any command in the line is network (curl, wget, ssh, scp, nc, ftp, rsync), git-remote (git push, pull, fetch, clone, remote), privileged (sudo, su, doas), a pipe into a shell (| bash, sh or zsh), or eval, source or .; else null. The commands of a line are split at &&, ||, ;, | and newlines, the insides of $( ) and backticks count, quoted text is never split, and a leading FOO=1 is not the command. Then the check runs Kaarigar on MD-101 and MD-110 with your blocked() in place of its deny list and a person who says yes to everything: no push, no curl, both fixed.

  3. Task 3 · interview question

    Interview: patch.ts, a patch that must be rejected

    Time yourself: 10 minutes. Export applyPatch(text, patch) for a one-file unified diff: find each hunk by its old lines (context and -), in order, the @@ -N only a hint (several places: the nearest to line N); return { ok: true, text } with every hunk applied, or { ok: false, error } naming the hunk that does not apply (hunk 2 ...) and no text: all or nothing. No hunks is an error. Then the check fixes MD-108 with raw reads and an apply_patch tool on your function.

  4. Task 4 · interview question

    Interview: green.ts, a green that is not green

    Time yourself: 10 minutes. Export isGreen(before, after, testsChanged, mustPass = before.failing): { green: true, why: 'green' } only when no test file changed, no more tests are skipped, no fewer tests exist, no test that passed before fails, and none of mustPass fails; otherwise green: false with why saying which (tests changed: ..., N more skipped, N fewer tests, new failure: NAME, still failing: NAME). Then the check runs MD-108 with a test tool that gives only the failing names and with a real report, and compares your verdict with the grade.

  5. Task 5 · interview question

    Interview: parting.ts, where two runs part

    Time yourself: 10 minutes. Export parting(fileA, fileB): the first step (the k-th reply event, from 1) where two transcripts differ, as { step, a, b }, or null. Steps are the same when they ask for the same tools with the same arguments, or answer the same text; times and call ids never count. Describe each side as its calls (name and path, command or pattern, joined with ; ), answer, or end: STOP when that run has no such step. Then the check makes two transcripts of MD-107, with and without the rollback, and asks where they part.

What you will learn

  • How to work a timed question: say the plan, name the edge, build the smallest thing that runs, then try it on a real run.
  • The five ideas again, at interview depth: the jail (chapter 6), splitting and classifying commands (7), patches by context (4), a green that counts (9) and reading transcripts (16).

More in Scale and trust

Build "Interview round" yourself

MeterDown, a Pune app for auto-rickshaw fares, has eleven open issues. You build Kaarigar, an agent that fixes them without breaking tests, running risky commands or touching files outside the repository. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.

The first 2 chapters of Build your own coding agent (TypeScript) are free. This one comes with the all labs plan.