GENERATE THE CODE

Ask coding agents to build every implementation

Once the specification is complete, one command creates the shared tests and multiple independently structured implementations. Codex is the default agent.

polyform generate --count 5

What the command does

  1. Validates that every specified function has a purpose, interface, requirements, and behavioral examples.
  2. Starts a test-author agent to convert the specification into one shared executable conformance suite.
  3. Starts a separate implementation-agent pass for each requested candidate of each function.
  4. Prevents those agents from silently changing the specification.
  5. Runs every command in [[checks]] after each candidate and records whether it was accepted.

With three specified functions and --count 5, Polyform requests fifteen implementation candidates. Humans review the results; they do not hand-write fifteen functions.

How candidates are pushed apart

Every implementation request receives a different, deterministic diversity brief. Polyform mixes an algorithmic approach, control-flow shape, data representation, validation strategy, engineering priority, and dependency policy. For five candidates, the major five-way dimensions are balanced so every option is used once.

The agent is also told not to imitate existing variants. The exact brief is saved beside the result in .polyform/generation.jsonl, so reviewers can compare the requested design with the code that was produced. The behavioral specification and shared tests still take priority over every style direction.

Generate one function again

polyform generate --function decode_filename --count 2 --skip-test-generation

This asks for two additional decoder candidates and keeps the existing shared tests. It is useful after you improve one function’s specification or want more diversity.

Use another coding agent

polyform generate --count 5 --agent /path/to/agent

The default codex command runs non-interactively with permission to edit only the project workspace. Another agent program can be used if it reads the prompt from standard input, edits the current repository, and exits unsuccessfully when it cannot finish.

Review what the agents produced

Read the code, confirm that the implementations use genuinely different approaches, and inspect .polyform/generation.jsonl. Polyform will reject failed checks, but passing tests are evidence—not a guarantee that the specification itself is complete.