The Three Pillars
Prehistoriq splits agentic engineering into three parts: Shapes before anyone writes code, Pulls while the team reviews the change, and Berries running underneath both.
Shapes
Before code
Problem, interactive prototypes, numbered must-haves, and formal approvals until locked as Agreed.
Pulls
During review
Six structured answers, Strata multi-level diffs (coming soon), anchored threads, Ask my agent, and GitHub reviews.
Berries
Coming soon
Prompts, agent responses, tool calls, subagent handoffs, and skill invocations recorded across both Shapes and Pulls.
1. Shapes
Agents build fast, so the hard part is agreeing on what to build before anyone builds the wrong thing. GitHub issues cannot hold interactive prototypes or an agent's before-and-after checks, and meeting decisions fade before a pull request opens.
A Shape is a shared space where people and their agents turn a problem into an agreed spec with interactive prototypes and numbered must-haves.
Review requests sit in the menu inbox until someone opens the tab. Teammates miss approval requests on Shapes and Pulls for hours.
- 1Send one email within two minutes of a review or shape approval request
- 2Never email about a thread the person already read in the app
- 3One-click unsubscribe link works without signing in
Problem and must-haves
A shape starts with a title and a few lines describing the problem. Anyone with read access to the repository can add numbered must-haves describing what must be true and what must not break. Each must-have keeps its number forever (^12#point-3), even if an earlier item is removed, so links and comments never drift.
Conversation and interactive prototypes
People and their agents post in one timeline. A post can include findings, screenshots, before-and-after wipes, videos, diagrams, code, tables, and sandboxed clickable HTML prototypes. Each prototype sits in a dark tray with a one-line prompt telling reviewers what to try.
Click Bring my agent on the shape, a post, an item, or a thread to hand the context to your local agent. p9q shape <n> pulls the shape, saves its prototypes and media under .p9q/shape-<n>/, and lets the agent reply with p9q shape <n> post. Your local agent can also read a meeting transcript and turn its decisions directly into new shapes and attributed must-haves.
Approvals and landing
Teammates approve the shape the same way they review a pull request. If the problem or must-haves change after someone approves, Prehistoriq marks their approval stale (approved · 2 changes since), because only approvals of the current words count. Every edit stays in History and can be restored.
When everyone asked approves the current revision and no change requests remain, the shape locks as Agreed. Its card switches to Land (p9q land <n>), which tells your agent to build the agreed shape, open a linked pull request, and run all six review categories. Merging the linked pull request moves the shape to Built.
Shapes move through Idea, Discussing, Shaping, Signing, Agreed, and close as Built or Closed. Any post, item, or comment can branch into a linked shape of its own.
2. Pulls
Pull requests written by agents grow quickly, and a raw diff cannot tell you whether the code ran, what the UI looks like, or how hard the change is to roll back.
Pulls lays out every pull request as six structured answers, multi-level code diffs with Strata on Changes (coming soon), and threads anchored directly to findings or code blocks.
Adds an idempotency key per invoice attempt and retries transient gateway timeouts up to three times with exponential backoff.
- Adds payment_attempts.idempotency_key unique index
- Keeps existing webhook signature verification unchanged
Before and after captures of the billing panel during a gateway timeout, plus the final recovered state.
- Before: generic 500 toast with no retry indicator
- After: inline retry progress and preserved cart total
Multi-model review checked 14 files and flagged one edge case when a timeout happens after the gateway commits.
- Major: reuse the same idempotency key when the worker restarts mid-retry (impact: a crash after charge commit could bill twice)
- Nit: log attempt_number alongside gateway_request_id
Unit tests, duplicate-charge regression test, and local Stripe mock timeout scenario all passed on HEAD.
- Regression test fails without idempotency key, passes with fix
- 38 payment tests passed in 1.4s
Application code reverts cleanly. The new unique index on payment_attempts has a rollback script included in the PR.
- Revert: retry worker and billing banner revert cleanly
- Work (rollback written): drop idx_payment_attempts_idempotency
Checked key entropy, webhook auth boundaries, log redaction, and cross-tenant scoping across the changed paths.
- Idempotency keys are scoped per organization_id + invoice_id
- Card and token fields stay redacted from retry logs
The six answers
Every pull request displays the same six tiles under its title, always in the same order:
| Tile | Question | What the tile shows |
|---|---|---|
| What | What does this change do? | Plain-English headline, summary, and diagrams or schema changes |
| Show me | What does it look like? | Screenshots, before/after comparisons, flows, videos, or diagrams |
| Review | Is it built right? | Findings grouped by severity (blocker, major, minor, nit) or clean check count |
| Proof | Does it actually work? | Passing and failing checks, terminal output, or metrics |
| Undo | How hard is it to take back? | Each side effect classified as a door: revert, work (and whether the way back is written), or one-way |
| Security | Does it open a door? | Security findings by severity or checklist items |
Every tile uses the same traffic lights: pass (clear), warn (merge after a look or small fix), fail (do not merge as is, or on Undo, a one-way door or unwritten rollback that needs an explicit yes), and info (neutral context on What).
Three zoom levels
Proof4 of 4 passed
Review1 major+ key = invoice.attemptKey
Each category section opens only as far as needed:
- Compact shows one line with the category icon, verdict light, headline, and avatars of anyone discussing it. Passing checks default here, except Show me, which still previews its first visual.
- Summary shows the summary plus every block's face: finding titles, one-sentence impact lines on blockers and majors, checklist labels, and visuals with captions. Warnings, failures, and What open here by default.
- Full shows the full body, suggested fix, code snippets, and checklist notes. You open items one at a time or click Expand all.
Strata across four diff levels Coming soon
Even with six answers, you still want to inspect the code itself when a change spans hundreds or thousands of lines. Reading a raw diff top to bottom forces you to reconstruct the structure in your head.
On the Changes tab beside Overview, Strata stacks three readable, syntax-highlighted pseudocode layers directly above the real code diff: Outline, Detail, Fine detail, and Code. You start at the outline of what each function does, drop into finer levels only where something looks risky, and read the exact lines of code underneath.
Good call reusing prev.idempotencyKey on worker restart. Can we add a regression test for a crash right after upsertAttempt?
Good call reusing prev.idempotencyKey on worker restart. Can we add a regression test for a crash right after upsertAttempt?
Good call reusing prev.idempotencyKey on worker restart. Can we add a regression test for a crash right after upsertAttempt?
- Whole-row change visibility colors every row that covers changed lines, and every changed line maps to a colored row (or an explicit note when it has none)
- Line-anchored threads across every level keep comments pinned to the underlying code lines no matter which level you wrote them on. A thread appears in full on its own level and finer ones, collapses to a count badge on wider levels above, and stays put even if Strata is rebuilt
- Graceful fallback shows Code immediately before Strata is built (with a Build Strata button beside the level picker), and shows plain code when a PR has no functions to summarize
Strata is agreed in Shape 117 and is currently being built.
Threads and GitHub reviews
Any run, block, or individual finding can hold a thread. Each thread saves a quote of what it pointed to, stays visible when its section is folded, and stays readable even after a newer run replaces the old one.
Click Ask my agent on any item to post your question and copy a p9q discuss <thread> prompt. Your agent checks your local checkout and posts its reply (markdown, code, screenshots, or diagrams) directly into that thread.
Because URLs mirror GitHub, replacing github.com with prehistoriq.com opens the matching Pulls page. Submitting Approve or Request changes posts straight to GitHub as your review so branch protection counts it, and the GitHub bot keeps one edited comment updated with the six lights and open threads.
3. Berries Coming soon
A pull request diff shows what changed, not how it was made. Reviewers cannot see which prompts led to which lines, what the agent asked and what the author answered, which models and skills did the work, or what was tried and dropped. Decisions made while coding never reach the shape, so the shape and the pull request drift apart unseen.
Raw transcripts on a developer's laptop do not solve that. They are long, private, can contain secrets, and miss code written through shell commands like python3 or sed instead of direct edit tools.
Berries capture prompts, agent responses, tool calls, skill invocations, and working-tree diffs locally through p9q, link them to the lines, commits, pull requests, and shapes they produced, and show them where people already look.
- AskRetry failed payments without charging twice
- DecisionKey idempotency on (org_id, invoice_id); keep webhook signature checks untouched
- Outcome38 payment tests passing · 2 models (Claude Code + Codex) · 4 skills
- Prompt"Land Shape 98. Never charge twice even if the worker crashes mid-retry."
- Answer"Reuse the existing idempotency key on restart and add a rollback SQL for the index."
- Prompt"Run Codex review on this diff, fix anything major, and fill all six Pull categories."
- AgentAsked whether retries should reuse keys across worker restarts or expire after 10 min.
- ReviewCodex flagged a race when a gateway timeout fires after charge commit; Claude patched it.
- HandoffLinked shaping session and build session back to Shape 98 so decisions stay visible.
- Tool + diffBash (python3 migration generator) -> +42/-3 lines attributed to ai in payment_attempts.sql
- Skill/proof ran 38 tests (1 failed before fix, 38 passed after fix) and uploaded checklist
- CommitSpool flushed on git push; session blobs stored in EU outside Git (hideable anytime)
Where Berries appear
- On Pulls ("How it was made") with four reading depths (Glance, Your words, Conversation, and Every step) and a five-lane timeline (Shape, You, Agent, GitHub, Production) across Shaping, Building, In review, and Shipping, so reviewers understand how a PR was built without reading a raw transcript
- On Shapes where every session that worked on a shape links back to it, including planning sessions before any pull request existed, joining shaping work to implementation and surfacing decisions made along the way
- In line blame where working-tree diffs captured after tool calls attribute each line as
ai,human, orunknown(falling back tounknownwhenever a later overlapping edit obscures who wrote it)
Privacy and local capture
const key = orgId + ":" + invoiceIdreturn chargeWithRetry(key, amount)if (amount <= 0) return nulllog.info("retry", { attempt })Berries keep private work out of Git and require nothing extra to install:
- Nothing goes into Git because prompts can hold secrets and Git cannot forget, so session text stays outside Git, stored in the EU and kept separate from the index
- Hide and erase anytime before or after a session is shared, deleting its text from storage
- Installed with
p9qusing a local spool under~/.p9q/berries/and agent hooks that work across clones and worktrees without slowing down or breaking sessions - Opt-in local preparation where generating titles, extracting decisions, or redacting sensitive spans runs through a model harness (Claude Code, Codex, or Ollama) only after you enable it in
p9q setup
Ready to try it on a repository? Follow the Quick Start to install p9q and post your first six-answer pull request.