Mikie / Field notes

One task, three context choices

A tiny parser fix shows why the right context includes both the change and the check. Here are three ways to frame the same task.

Field note7 min read
Select relevant code from a repository, then use it for a focused coding task.REPOSITORYFOCUSED TASK
Less to read. More to work with.

The task: preserve the behavior and handle whitespace

This is an illustrative Python example, not a Mikie benchmark. Save the function as duration.py. It parses a minute suffix but fails on surrounding whitespace. The goal is to support ' 15m ' while preserving plain seconds and existing invalid-input behavior.

Python · duration.py
def parse_duration(value: str) -> int:
    if value.endswith("m"):
        return int(value[:-1]) * 60
    return int(value)

The accepted result must pass the whitespace regression and preserve the existing minute and second cases. The example makes no token or cost claim.

Choice one: hand over the whole repository

A broad request leaves the agent to discover the implementation, tests, and intended behavior. That can be appropriate for an unknown system, but it adds discovery work when the failure already identifies a small module.

Broad task prompt
Explore this repository and fix the duration parsing bug.
Work out the expected behavior and run the tests.

The weakness is an ambiguous acceptance rule. The agent could change the interface or reject whitespace differently while still reporting that the bug is fixed.

Choice two: hand over only the function

A narrow snippet is easy to understand, but it may hide caller assumptions or a test that requires a specific exception. A small prompt is useful only when it preserves the information needed to judge the patch.

Narrow task prompt
In parse_duration, accept surrounding whitespace.
Keep minute suffixes and plain seconds working.
Do not change the function signature.

This states the local behavior but still omits the verification path. Before changing a real repository, inspect the relevant callers and tests.

Choice three: pair the source with the acceptance check

Give the agent the relevant entry point, the regression, and the command that decides whether it is done. The implementation can stay small while the quality check remains explicit.

Python · test_duration.py
import pytest
from duration import parse_duration

@pytest.mark.parametrize("value, expected", [("15m", 900), (" 15m ", 900), ("45", 45)])
def test_duration(value, expected):
    assert parse_duration(value) == expected

def test_empty_duration():
    with pytest.raises(ValueError):
        parse_duration("")

Run pytest -q test_duration.py. In the illustrative function, the whitespace case fails before the fix. The task is complete when the regression and preserved cases pass; a real project may need further integration checks.

When to widen the context

Follow a caller when it supplies non-string values or expects a different error. Inspect configuration when units come from settings. Run the relevant integration when the local tests pass but the user-facing behavior still fails. These are reasons to add context, not reasons to restart a blind repository tour.

  • Start with the failure and a plausible source-and-test pair.
  • Preserve permission rules and project instructions.
  • Expand only when a dependency, test, or observed behavior needs it.
  • Record what changed and the acceptance result before comparing usage.

Sources: The parser, prompts, and tests are original illustrative examples. Project-instruction guidance checked against the primary Codex and Claude Code documentation on October 13, 2026.

Try it on your own repository.

Give your agent the context it needs, then see how your next session compares.