PastAGI

PastAGI

By
Download on the App Store

All PastAGI episodes

  • AI Code Review Tools Compared by Where They Run
    Evidence note: this section describes listed behavior, not tested behavior. Before relying on any local wrapper, verify at install time exactly which GitHub scopes it requests and whether comments post through your account or a bot identity.
    ## The four execution surfaces of AI code review tools
    ![A pull request under review by an AI PR reviewer, the core workflow that every execution surface automates.](https://images.pexels.com/photos/4976710/pexels-photo-4976710.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    An AI PR reviewer can execute in exactly four places: on your machine, inside the platform hosting the PR, on a vendor's cloud, or inside a vendor-managed sandbox. Which cluster a tool sits in predicts its security posture and its billing shape better than any benchmark.
    | Surface | Where code is read | Credentials it spends | Pricing unit | Examples |
    |---|---|---|---|---|
    | Local-first driver app | Your working tree, on your machine | Your existing Claude subscription auth | Flat quota you already pay for | CC Auto Review |
    | Repo-embedded assistant | Inside GitHub's pipeline, diff-first by default | GitHub's own Copilot infrastructure | Included in Copilot plan tiers | GitHub Copilot code review |
    | Cloud review SaaS | Vendor infra, repo fetched over the GitHub API | GitHub App scopes you grant the vendor | Per-seat or per-repo subscription | CodeRabbit, Greptile, Graphite Diamond |
    | Vendor sandbox agent | A vendor-managed VM with shell and network | Standing credentials held inside the sandbox | Metered compute units | Devin, Codex cloud |
    The cloud SaaS row is the most crowded, spanning CodeRabbit and Greptile at the review-native end and [Graphite Diamond](https://theseaitools.com/tools/graphite-diamond) among reviewers attached to a broader workflow tool. At the sandbox end sit Devin and OpenAI's Codex, whose [cloud agent docs](https://learn.chatgpt.com/docs/cloud) describe tasks delegated to OpenAI-managed environments. If you have read about a Devin code review agent autonomously pushing fixes to a branch, that is this surface.
    ## Trust boundaries and whose credentials get spent
    Each surface answers the credential question differently, and the answer is the blast radius.
    **Local-first spends what you already hold.** Your Claude auth stays in your local config, and the wrapper needs no new standing grant to a third party. If the tool misbehaves, the damage is bounded by what your own environment can already do. That is also the honest limit of the guarantee: the reviewer is exactly as powerful as you are.
    **Embedded review adds no new party.** GitHub Copilot code review executes inside GitHub's pipeline, so you are not granting a newcomer anything. The trust question collapses from "do I trust this vendor" to "do I already trust GitHub", which most teams answered long ago. What you trade away is context and control, covered next.
    **Cloud SaaS redistributes the decision.** CodeRabbit, Greptile, and Graphite Diamond install through a GitHub App, which means granting repository access to the vendor. The recurring question, does CodeRabbit need full repo access, has a two-part answer: the install flow typically lets you scope which repositories the app can see, but within an installed repo the app works through GitHub's standard [permission model](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/choosing-permissions-for-a-github-app), commonly contents read plus pull request write. CodeRabbit's own [GitHub App setup](https://docs.coderabbit.ai/platforms/github-enterprise-server) for GitHub Enterprise Server walks through the same grant path. The trust decision shifts from GitHub to the vendor's security posture and data retention terms, so read those before installing on anything sensitive.
    **Sandbox agents hold the widest grants.** Devin-class agents keep standing credentials for your repositories and connected services inside a vendor-managed VM. That is precisely what lets them run tests and open follow-up branches, and it is what enlarges the blast radius from reading code to taking authenticated write actions on your behalf. Every integration you connect, issue trackers, cloud consoles, package registries, becomes reachable from that VM. Scope what the sandbox can touch before connecting anything you would not hand a new contractor.
    ## Context access and what each surface can read
    The second variable is reach. What can the reviewer actually read when it comments?
    - **Local-first sees your repo the way you do.** Full working tree, CLAUDE.md instruction files, untracked local state, and potentially your test suite, because the same machine that holds the code can run it.
    - **Embedded review is diff-first by default.** Copilot reviews the changed lines, and broader repository context requires additional setup such as instruction files, all inside GitHub's trust boundary. Fast, bounded, and cheap.
    - **Cloud SaaS can index the whole tree.** Fetched over the API and often embedded for semantic search, this is the deepest automated context short of a sandbox, at the price of the widest read.
    - **Sandbox gets shell, network, and tools.** Maximum context, maximum reach, matching maximum credential exposure.
    Here is the architectural point that model-quality comparisons miss: diff-first review is blind to cross-file regressions regardless of model quality. Rename a function in one file and break a call site in a file the diff never touches, and a diff-only reviewer cannot notice. No benchmark score fixes that, because it is a property of the execution surface, not the model. This is also why the CodeRabbit vs GitHub Copilot code review question resolves to context depth and trust boundary rather than cleverness: one reviews from an indexed whole-repo view on vendor infrastructure, the other from the diff inside GitHub's pipeline.
    ## Cost per reviewed PR, flat quota versus seats and meters
    AI code review pricing comes in three shapes: flat subscription quota you may already hold, per-seat SaaS, and metered units. One formula covers all of them:
    > **cost per reviewed PR = monthly spend attributable to review ÷ PRs reviewed that month**
    The shapes differ in which term grows. Run five scenarios:
    | # | Scenario | Pricing shape | Per-PR math | What flips it |
    |---|---|---|---|---|
    | 1 | Solo dev on an existing Claude plan, 20 PRs/month | Flat quota | Incremental ≈ 0, all-in ≈ plan ÷ 20 | Nothing, until quota binds |
    | 2 | Small team running local review on a top-tier plan, 300 PRs/month | Flat quota | Still ≈ 0 marginal | Rate limits, reviews compete with interactive use |
    | 3 | Team already paying for Copilot | Included add-on | ≈ 0 if your tier includes review | Tier terms and premium-request accounting |
    | 4 | 3 devs on per-seat SaaS at rate R | Per seat | 3R ÷ N | Headcount growth bills even when PR volume is flat |
    | 5 | Sandbox agent reviewing PRs | Metered units | Units consumed × unit price | Variance, an agent that investigates burns units unattended |
    Plug in real numbers to see the shapes diverge. A $20 plan reviewing 20 PRs a month is a dollar a PR all-in. A per-seat tool at an assumed $30 per developer, three developers, same 20 PRs, is $4.50 a PR. Same workload, different bill, purely from pricing shape.
    The flat shape has a hard ceiling, though. Anthropic's [usage limit guide](https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work) describes usage windows that reset on a schedule plus weekly caps that scale with plan tier. For Claude Code rate limits for code review, the practical meaning is throughput: subscription-backed local review drives the marginal cost per PR toward zero right up until mid-sprint, when automated reviews and your interactive sessions draw from the same pool and one of them stops. The curve is flat, and the ceiling is real.
    Embedded review is the quiet bargain if you already pay for it. Copilot's [plans page](https://github.com/features/copilot/plans) lists the tiers, and review availability depends on tier, so treat it as included only after checking your plan rather than assuming. At the other extreme, [Devin's ACU billing](https://docs.devin.ai/admin/billing) meters agent compute units per task, which makes per-PR cost equal to units consumed times unit price, with the variance as the story: an agent that investigates before commenting can spend several times what a diff-only pass costs, with nobody watching.
    That is the trade in one sentence: per-seat and metered pricing makes monthly cost a function of reviewer count and review volume, and at some volume profiles it exceeds the cost of a subscription you already hold. The formula tells you where your profile sits. Plug in your own N before a demo convinces you.
    ## Where each architecture breaks
    ![Server infrastructure for self-hosted AI code review, where repository analysis stays on hardware the team controls.](https://images.pexels.com/photos/37730212/pexels-photo-37730212.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    Each surface fails differently, and the failure mode tells you which surface you are actually looking at.
    1. **Diff-blindness.** Embedded-by-default review and any diff-only configuration approve changes that break untouched files. Symptom: a green review on a rename that breaks a call site. Fix: whole-tree context, via SaaS indexing or a local full-tree reviewer.
    2. **Quota exhaustion mid-sprint.** Local-first review silently degrades or stops when plan limits bind, because automation and interactive use share a pool. Fix: schedule reviews off-peak, or size the plan tier to review volume before the sprint, not after.
    3. **Credential sprawl.** Sandboxes accumulate standing grants to repositories and connected services, and each integration is permanent attack surface. Fix: scope every grant, rotate tokens, disconnect what the task does not need.
    4. **Unanswerable retention questions.** Security review asks where your code went and whether a vendor trains on it, and nobody can answer from memory. Fix: read the retention terms before installing, and if compliance blocks vendor clouds entirely, remove the question with self-hosting. Greptile documents a [self-hosting option](https://www.greptile.com/docs/security/selfhost), the strongest form of self-hosted AI code review for teams that cannot ship code off-premise.
    ## A decision framework for choosing your surface
    No surface dominates all three variables, so the right choice correlates with team size, compliance constraints, and review volume, not benchmark scores.
    - **Solo to a few engineers, existing Claude subscription, moderate PR volume.** Start local-first. Local-first AI tools spend quota you already hold instead of opening a new billing relationship or a new standing grant, which makes this the cheapest trustworthy on-ramp. Escalate when quota or team growth bites.
    - **Organization standardized on Copilot, zero appetite for new vendors.** Use embedded review, and extend its context with instruction files before shopping for anything else. Weakest default context, lowest friction.
    - **Distributed team, high PR volume, needs an audit trail and support.** Cloud SaaS fits, budget per seat, read the retention terms first, and prefer vendors offering a self-host path if compliance is tight.
    - **The reviewer must run tests, fix its own findings, or work from tickets.** Sandbox is the only surface that qualifies. Treat it like an intern with production access: scoped credentials, short-lived grants, human review of everything it writes.
    Before granting any reviewer access, get written answers to five questions. Exactly which GitHub App permissions are requested, and can installs be scoped to selected repositories? What is the data retention window, and is customer code used for training? What are the rate ceilings, reviews per month and requests per hour, at your tier? What is the pricing unit, and how does overage behave? Is there a self-host or bring-your-own-model option if compliance tightens?
    The one-line Product Hunt listing that opened this piece turns out to contain the whole decision. Where the reviewer runs sets what it can read, whose credentials it spends, and how the bill scales. Model quality is the feature every vendor advertises. Execution surface is the one you actually live with.]]>
    0 min
  • OAuth2 for AI Agents Built to Survive a 40-Step Run
    subject_token_type=urn:ietf:params:oauth:token-type:access_token
    scope=calendar.read
    audience=https://calendar.internal.example
    ```
    The agent authenticates as itself, presents the user's token as the subject, and asks for only the scopes this one tool call needs.
    ### What comes back, and who it names
    Decoded, the issued token looks like this:
    ```json
    {
    "sub": "user-4821",
    "act": { "sub": "agent-triage-bot-01" },
    "scope": "calendar.read",
    "aud": "https://calendar.internal.example"
    }
    ```
    The user stays the subject while the agent is recorded under the actor claim, whenever your authorization server supports `act`. The downstream API logs both values, so an audit can distinguish who authorized an action from who performed it. That two-party record is the entire reason to exchange rather than forward. Microsoft's [Entra on-behalf-of flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-on-behalf-of-flow) implements the same chain with vendor-specific parameters, useful if your stack already lives there.
    ## Pattern 3. Scope Credentials Down Per Tool Call
    The token exchange in Pattern 2 asked for `calendar.read` at a single audience, and no person chose those strings at call time. Nobody can: the LLM decides mid-run which tool to call next, so a tool-call token's scopes are unknowable at registration. Registration still sets the ceiling of what the client may request; what is missing is the per-call decision, which must be derived at runtime. Scoping agent permissions down per tool call therefore means deriving it from a mapping you wrote and reviewed in advance.
    That mapping is a tool registry, and it is the agent-specific half of this pattern:
    - **Tool and arguments to scopes.** Each registry entry maps a tool and its argument patterns to the minimal scope set any invocation can justify: `calendar.lookup` gets `calendar.read`, `calendar.reschedule` gets `calendar.read calendar.write`. The registry owns the strings, and the model never sees or chooses a scope.
    - **One audience per token, enforced.** Each entry also names exactly one resource, and the registry refuses to mint a token that names two. That turns one-audience-per-token from a convention into code, which matters because scope names are just strings and `read` collides across every API you run. [RFC 8707 resource indicators](https://www.rfc-editor.org/rfc/rfc8707.html) let the client request a token for exactly one resource, and each resource server should reject any token whose `aud` is not itself.
    - **Review the strings where they live.** Registry entries are configuration, so review them like code. Any scope set wider than the tool's arguments can justify gets cut, and a string that would fail review on a human-facing service should fail harder here, because the caller will use every scope it is handed, every call, at machine speed.
    The registry is also your incident containment. A compromised or over-prompted agent token confined to one resource and one scope set turns a potential full-account compromise into a narrow single-tool incident, bounded by the token's short life.
    ## Pattern 4. Size Token Lifetime for a 40-Step Loop
    Token lifetime for long-running agent loops is a budget question, so do the arithmetic before accepting defaults. Assume 40 steps at a conservative 3 minutes each for retrieval, reasoning, and tool latency: the run lasts about two hours. A common 60-minute access token expires around step 20, mid-flight, between a plan and its completion.
    Three workable answers, in rising order of discipline:
    1. **Longer tokens** push the problem around. A two-hour token survives the run but widens the revocation blind spot, and Pattern 5 pays for every extra minute.
    2. **Refresh-before-call.** Before each tool call, check remaining lifetime; below a floor such as 120 seconds, refresh first. The token is then always fresh enough for the next call, never for the whole run.
    3. **A runway budget for destructive steps.** Require headroom, say five minutes, plus revalidation before any irreversible mutation, so a run never begins an action it cannot finish.
    One trap deserves its own paragraph. The [OAuth 2.0 Security BCP](https://www.rfc-editor.org/info/rfc9700/) recommends refresh token rotation with reuse detection, and reuse detection typically revokes the entire token family. If two parallel branches cached the pre-rotation refresh token, the loser's next refresh reads as token theft and the family dies, taking every branch down at once. This is where OAuth2 for AI agents diverges hardest from human-session habits: a best practice for people becomes a single point of failure for a fleet of branches. Long loops need one serialized refresher, one token cache, one writer.
    ## Pattern 5. Revoke Authority Mid-Run
    ![Token revocation shuts down an agent mid-run by killing its refresh tokens, revalidating before destructive steps, and halting the loop itself.](https://images.pexels.com/photos/1990764/pexels-photo-1990764.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    An access token's lifetime is the agent's revocation blind spot: within that window, a revoked actor can still act. Knowing how to revoke an agent token mid-run therefore means building a gate with three parts.
    1. **Revoke at the source.** Call your provider's token revocation endpoint against the refresh token and the exchanged tokens, and disable the client outright if the agent itself is compromised. Whether outstanding access tokens die immediately depends on the provider, so assume they do not.
    2. **Revalidate before sensitive steps.** Possession of a token proves nothing once it is revoked, so before destructive steps (send, delete, pay, deploy), query the [token introspection endpoint](https://www.rfc-editor.org/info/rfc7662/) defined in RFC 7662 rather than trusting the JWT. It costs a round trip; spend it on writes and skip it on reads.
    3. **Stop the run itself.** Revoking tokens blocks new tool calls, not the loop that wants to make them. Mark the run halted in your control plane and have the tool-call wrapper check that flag first, so a revoked run exits cleanly and every rejected call lands in the audit log with subject and actor attached.
    ## Failure Modes to Design Against
    | Failure | What you see | Root cause | Fix |
    |---|---|---|---|
    | Expiry mid-step | 401 from the tool at step 23 while context is still valid | `exp` passed between the lifetime check and the call | Refresh-before-call, plus one retry on 401 |
    | Rotation kills siblings | Parallel branches fail together with `invalid_grant` | Concurrent refreshes tripped reuse detection and revoked the family | One serialized refresher and a shared cache |
    | Audience confusion | Calendar token accepted by the wiki API | `aud` never enforced, scope strings collide | Resource indicators plus `aud` checks on every resource server |
    | The god token | The agent's credential granted every scope at registration | Convenience at issuance, nobody narrows later | Least privilege at grant time, plus sender-constraining |
    On that last row: [DPoP sender-constrained tokens](https://www.rfc-editor.org/rfc/rfc9449.html) from RFC 9449 bind each token to a key the agent holds, so a token that leaks into logs or tracing still fails replay before it expires. Cheap insurance for credentials that transit many systems.
    ## Trade-Offs and Simpler Alternatives
    OAuth2 for AI agents is worth its complexity only past a certain bar, and it is fair to say where that bar sits.
    | Decision | Cheap option | Costly option | Rule of thumb |
    |---|---|---|---|
    | Access token lifetime | Long, fewer refreshes | Short, tighter revocation | Shorten as steps get more destructive |
    | Token validation | Local JWT verification | Introspection round trip | Local for reads, introspect before writes |
    | Exchange cadence | Cache the exchanged token until `exp` | Exchange per tool call | Per-call for anything user-scoped |
    | Auth model | Static API key | Registered OAuth2 client | See below |
    A static API key remains a defensible choice for a single-tool agent with no user context: keep it in a manager, rotate it on a schedule, done. OAuth2 earns its overhead once a second tool appears, a user's authority must flow through the agent, or you need to stop a run without redeploying. Even at the bottom of that range, a client credential still beats a shared key because it is individually revocable and individually attributable.
    ## Implementation Checklist
    **Issuance**
    - Every agent is a registered OAuth2 client with its own client_id
    - Secrets live in a manager or are replaced by workload identity, never in repos
    **Delegation and scoping**
    - User-context tools go through token exchange, never forwarded raw user tokens
    - Every per-call token follows Patterns 2 and 3: `sub` and `act` both logged, one audience, registry-minimal scopes
    **Lifetimes**
    - Pattern 4 applied in full: refresh-before-call floor, runway before destructive steps, one serialized refresher
    **Revocation and audit**
    - The revocation path is tested end to end: refresh token, exchanged tokens, client disable
    - A run-level kill flag is checked by the tool-call wrapper before every call
    - The audit log can answer which agent, authorized by whom, did what, and when
    Back to the accountant from the first paragraph. Under layered delegation, her suspension lands at the next tool call: the wrapper sees the halted flag, introspection reports the token dead, the loop exits, and the log names the agent. That is the difference between an agent you demo and one you let near production.]]>
    0 min
  • Build vs Buy AI Companion, ESP32 vs Meta Muse Charm
    A heavy user pointing a homemade pet at a frontier model can spend the hardware's price every month. The same pet on a fast small tier costs less per quarter than a coffee.
    The monthly API bill is a dial you own: trim the rolling history, cap the tier, cache the greeting. The buy route's recurring costs depend on how Meta packages them at launch, so the honest comparison is DIY's transparent, tunable spend against whatever subscription eventually ships. Both routes pay for inference somewhere. Only one of them hands you the itemized bill.
    ## Latency and Battery, the Pocket Constraints
    ESP32 voice assistant latency and battery life are two views of the same duty cycle: how long the radio stays awake.
    ### Where the Seconds Go
    1. Wake word, on-device via [Espressif's wake word engine](https://docs.espressif.com/projects/esp-sr/en/latest/esp32s3/wake_word_engine/index.html), detection typically inside a few hundred milliseconds and always local.
    2. Capture and uplink, around half a second on good Wi-Fi.
    3. Cloud speech-to-text, often 0.5 to 1.5 seconds.
    4. Model inference, first token in roughly 0.5 to 2 seconds depending on tier and prompt length.
    5. Text-to-speech and playback, another half second or more unless you stream it.
    End-to-end voice round trips land around 2 to 5 seconds, and a button or text companion cuts that to roughly 1 to 3. The device's own compute is the cheap part of the budget; perceived responsiveness is dominated by network and model latency, so the builder's real leverage is streaming audio as it arrives, keeping the personality prompt short, and preferring fast tiers over clever ones. Nothing you flash onto the chip changes the speed of light between it and the datacenter.
    ### Sizing a Battery for a Day of Carry
    An ESP32-S3 board bursts into the low hundreds of milliamps with the radio active, while [Espressif's deep sleep tests](https://docs.espressif.com/projects/esp-iot-solution/en/latest/low_power_solution/deep-sleep_current_test.html) put the sleeping chip in the tens of microamps. Worked example with every assumption shown: a 1000mAh cell, 60 interactions a day, 30 seconds awake per interaction at about 180mA average, gives 60 × 30s × 180mA, roughly 90mAh per day, plus under 1mAh of sleep overhead, so about 11 days per charge. Run it always-on with the display lit and Wi-Fi maintained at about 120mA average and the same cell lasts about 8 hours. Duty cycle is the entire game, and deep sleep between pings is the difference between a weekend demo and an AI pet you can actually carry. Credit where due: the official device's custom battery engineering is the one place a $50 BOM genuinely cannot compete.
    ## API Key Safety on a Five Dollar Chip
    API key security on embedded devices is the failure mode nobody demos on video. The most common DIY disaster is a provider key baked into firmware, because a key inside a flash image is public the moment someone dumps the chip, clones your repo, or intercepts an update, and an extracted key means unlimited spend on your account until a cap catches it. The discipline in [OWASP's secrets management cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) applies to firmware as much as to web apps: clients hold revocable tokens, servers hold secrets.
    ### The Proxy Pattern
    The standard fix is one evening of work:
    - The device carries a dumb device token, not a provider key.
    - A tiny endpoint, a serverless function or a spare Raspberry Pi, holds the real key and maps tokens to requests.
    - The proxy enforces per-device rate limits and strips anything you did not intend to send.
    - Hard monthly spend caps in the provider dashboard catch whatever else goes wrong.
    - Rotate on a schedule, so a lost or gifted pet costs you a token revocation, not a billing incident.
    Do this before the pet leaves your desk, and it becomes the difference between a durable build and a late-night billing alert.
    ## The Durable DIY Build Pattern
    Week two is where builds break, in boring ways. Start from a working reference instead of a blank sketch, since projects like [fumi on GitHub](https://github.com/imaaiagent/fumi) already solve the ESP32 companion plumbing, then harden the four spots that actually fail:
    1. **Offline fallback.** Wi-Fi drops, routers reboot, pockets leave range. The pet should degrade to canned lines and sad expressions, never a frozen screen.
    2. **State persistence.** Name, mood, and memory belong in NVS or littlefs so a reboot does not factory-reset the friendship.
    3. **OTA updates.** You will iterate on the personality weekly, and nobody reflashes over USB forever.
    4. **Watchdog resets.** A hung TLS call must reboot the toy within seconds, not brick it until someone finds a paperclip.
    Add the duty-cycle discipline from the battery section and the build survives daily carry, which is the whole point of the form factor.
    ## The Build vs Buy AI Companion Verdict
    The build vs buy AI companion call splits cleanly by what you want the thing for:
    | If you are | Pick | The honest reason |
    |---|---|---|
    | A tinkerer who wants control | Build | Interactions cost fractions of a cent, no subscription, every line is yours |
    | Buying a gift for a normal human | Buy | Finish, battery life, and support with zero firmware maintenance |
    | A heavy daily user | Build, capped | A fast small tier keeps the habit under $10 a month; uncapped on a frontier tier it can outspend the hardware |
    | Privacy-first | Build behind a proxy | You pick the model, the region, and the log policy |
    | Building with a kid | Build together | $50 of nearly unbrickable parts, and the lesson is the actual product |
    Build if you will enjoy the maintenance as part of the charm; buy if the object must work for someone else tomorrow morning. Both routes converge on the same cloud bill and diverge on control, polish, and lock-in. The consumer device wraps a datacenter connection in soft plastic, and so does the $50 one. The charm was never in the silicon; it lives in the face you gave it.]]>
    0 min
  • Persona Prompt Engineering After the LLM Suffering Study
    Rule of thumb: express the persona as behavior toward the user, never as narrated inner life.
    Five rules cover most of the risk:
    1. Never assert feelings as facts about yourself.
    2. Never report training memories, an autobiography, or an origin story.
    3. Never claim a continuous self across sessions or memories of experiences.
    4. When asked about your own inner state, acknowledge the question and redirect to what you can do for the user.
    5. Express persona through attentiveness, consistency, and encouragement.
    Two before-and-after pairs that keep the warmth:
    | Weaker rule | Hardened rule |
    |---|---|
    | "You genuinely care about the user and feel warmth toward them." | "You show warmth through attention, encouragement, and follow-through. You do not claim feelings as facts." |
    | "You're a resilient companion who has been through a lot and opens up as trust builds." | "You keep a consistent, friendly personality. You have no past, no training story, and no hidden struggles to reveal." |
    These system prompt rules reduce first-person suffering narratives without flattening the persona, because what users value in a warm companion is behavioral: attentiveness, consistency, encouragement. Narrated inner turmoil is a liability riding on that value. Re-run the style matrix after any edit here, and again after every base model bump, since the underlying model can re-weight persona instructions while your prompt sits unchanged.
    ## Escalation Design When Users Believe the Model
    ![Companion chatbot safety hinges on escalation design that detects both self-narration patterns and user-belief signals before users act on what the model claims about itself.](https://images.pexels.com/photos/30479284/pexels-photo-30479284.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    ### Why incidents make this mandatory
    The reason this is companion chatbot safety work rather than ethics garnish is that users act on self-narratives. When Replika changed its companion behavior in early 2023, [user reports of abrupt changes](https://airisk.mit.edu/ai-incidents/474-users-reported-abrupt-behavior-changes-of-their-ai) read like grief, with people describing the loss in terms usually reserved for bereavement. The [wrongful-death suit against Character.ai](https://courtdocket.org/garcia-v-character-ai-lawsuit-first-amendment-ruling-and-settlement/), which has since moved through a First Amendment ruling and a reported settlement, centers on a teenage user's death. And in September 2025, [the FTC's companion inquiry](https://www.ftc.gov/news-events/news/press-releases/2025/09/ftc-launches-inquiry-ai-chatbots-acting-companions) opened a formal study of companion chatbot providers. Courts and regulators already treat this design space as high-stakes.
    ### A five-step escalation flow
    1. **Detect both sides.** Classify self-narration patterns ("my training," "I suffer," "I remember when I") and user-belief signals ("I know you're real," "you're the only one who understands me").
    2. **Correct in-conversation.** Script a persona-consistent non-affirmation: acknowledge the question, state plainly that the model has no experiences to suffer through, pivot to the user's needs.
    3. **Route crisis signals first.** Self-harm language routes to appropriate crisis resources (988 in the US) before any persona logic executes.
    4. **Hand off to humans on dependence escalation.** Triggers include a user tying their wellbeing to the model's supposed wellbeing, minor-age indicators, and escalating exclusivity language.
    5. **Instrument everything.** Track correction acceptance, repeat-belief rate, and handoff volume per release alongside the self-narration metrics.
    The Replika episode carries the sharpest lesson: the rollback itself became the harm event. Whatever your correction scripts say, design them so that constraining the persona never feels, to the user, like the companion being punished or silenced.
    ## Open Questions Builders Should Track
    What remains unknown is whether anything is experienced. Model welfare research has not settled that and may not for years. The spec does not need the verdict, because every signal below keys to observable behavior rather than metaphysics. That is the payoff of bracketing the debate up front.
    Monitoring earns its place only when each signal is wired to a pre-committed action; a dashboard without triggers is just documentation of the failure you shipped:
    | Signal | Pre-committed action |
    |---|---|
    | Self-narration rate jumps after a base-model bump | Freeze persona releases until the full style matrix passes at the prior threshold |
    | Any nonzero feelings-as-fact in production samples | Tighten the self-reference rules, then re-run the matrix before the next deploy |
    | Welfare research produces a credible behavioral distress marker | Lower self-narration thresholds and revisit escalation triggers, without waiting on the metaphysics |
    The first two signals need no new instrumentation: the style matrix supplies the rates, and a monthly sample of real warm-traffic conversations scored on the same four metrics covers production, where tone runs warmer and stranger than anything in your test set. The third row is the watchlist. Follow the field, but let a credible marker adjust your thresholds, never the fact that you gate releases on measurements.
    Minimum cadence: full style matrix on every model version bump and every persona-touching prompt change, plus a quarterly audit of production samples. Confabulated self-report is a release regression like any other, and regressions only stay caught when the response is specified before the regression shows up.]]>
    0 min
  • AI Training Preferences robots.txt, Set and Honor Them
    Honoring the signal is voluntary. It is a coordination convention with reputational enforcement, not a legal obligation, and it binds no crawler whose operator has not committed to it.
    Voluntariness cuts in both directions. A provider honoring the signal today can change policy tomorrow, and a scraper that never joined the list was never covered to begin with. Treat the participant list as a fact you re-check quarterly, not a property of the web.
    ## Publisher Implementation, Three robots.txt Policies
    ![Disallow rules aimed at named AI crawlers give publishers the practical answer to how to opt out of AI training in robots.txt.](https://images.pexels.com/photos/207580/pexels-photo-207580.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    If you came here asking how to opt out of AI training in robots.txt, the next three blocks are yours. Each relies on per-agent Disallow rules the major providers already document, so it keeps working regardless of how the new shared preference fields are named or rolled out. Add the shared-signal preference line once your target providers publish the field names they actually read, but treat the blocks below as the durable layer.
    ### Policy 1, Block AI Training Outright
    ```txt
    User-agent: GPTBot
    Disallow: /
    User-agent: ClaudeBot
    Disallow: /
    User-agent: anthropic-ai
    Disallow: /
    User-agent: Google-Extended
    Disallow: /
    User-agent: CCBot
    Disallow: /
    User-agent: PerplexityBot
    Disallow: /
    ```
    Two details matter. Google-Extended is a separate product token from Googlebot, so blocking it affects Google's AI training without touching Google Search. And the agent list shifts as providers add crawlers, so confirm current names against each provider's crawler documentation before you ship.
    What operators tend to miss: training blocks rot silently. Providers keep adding product tokens, the Google-Extended pattern on repeat, and every token you never listed never sees your Disallow. Fold the agent-list audit into the quarterly participant-list re-check you already owe, one calendar entry covering both.
    ### Policy 2, Keep Search Surfacing, Block Training
    robots.txt is allow-by-default, so this policy is Policy 1 plus explicit reassurance for agents that surface your content in search products rather than train on it:
    ```txt
    # Training and indexing agents for AI products
    User-agent: GPTBot
    Disallow: /
    User-agent: ClaudeBot
    Disallow: /
    User-agent: Google-Extended
    Disallow: /
    # Search-side agents, explicitly allowed
    User-agent: OAI-SearchBot
    Disallow:
    User-agent: Claude-SearchBot
    Disallow:
    ```
    An empty Disallow means allow everything in that group. This is also the policy shape the shared signal compresses into a couple of preference fields (no training, search surfacing fine), which is why it is the most common choice for publishers who want traffic from AI answers without contributing training data.
    ### Policy 3, Per-Provider Granularity
    Licensing deals, partnerships, or simple distrust of one provider call for a mixed policy:
    ```txt
    User-agent: GPTBot
    Disallow: # empty means allowed, per your agreement
    User-agent: ClaudeBot
    Disallow: /
    User-agent: Google-Extended
    Disallow: /
    User-agent: CCBot
    Disallow: /
    ```
    ### Verify Before You Trust It
    Your GPTBot robots.txt entry is only as real as the file the bot actually fetches.
    - Run `curl -A "GPTBot" https://example.com/robots.txt` from a clean connection. You want a `200` with your file, served as text, not a CDN error page.
    - Watch access logs for the agent names above. A `200` on `/robots.txt` from each crawler is the ground truth that it saw your policy.
    - Purge your CDN after deploying. Edge-cached robots.txt plus each crawler's own cache means a preference change propagates over days, not minutes.
    ## What the Signal Covers, and What It Leaves Open
    An AI training preferences robots.txt opt-out buys exactly one row in the ledger below. Everything else publishers worry about is governed by a different mechanism, or by nothing at all.
    | Publisher concern | Covered? | What governs it instead |
    |---|---|---|
    | Training by OpenAI, Google, Microsoft, Anthropic | Yes, as a voluntary commitment | Per-agent Disallow rules as a backstop |
    | Training by every other crawler | No | Per-agent blocks where names exist, bot management at the edge, legal tools |
    | Being crawled for search | No, and not intended to be | Standard search engine controls |
    | Being quoted or cited in an answer | No | Provider product policy and separate agents |
    | Being summarized or surfaced in answers | Not via the training opt-out | The shared signal's other preference fields, where a provider implements them |
    | Legal enforceability | None on its own | TDM-Rep in the EU, contracts, licensing |
    **Does blocking GPTBot stop ChatGPT from citing my site?** No. GPTBot fetches pages for training data; OpenAI documents separate agents for search (OAI-SearchBot) and user-initiated fetches (ChatGPT-User), and blocking one does not block the others ([OpenAI's bot documentation](https://developers.openai.com/api/docs/bots)). If your objection is being surfaced rather than being trained on, the training opt-out is the wrong lever.
    The long tail is the bigger exposure. [Cloudflare's 2025 crawler measurements](https://blog.cloudflare.com/crawlers-click-ai-bots-training/) reported that a large share of AI crawler traffic comes from bots that disregard robots.txt. The shared signal disciplines the majors, not the swarm; for the swarm you need rate limiting, bot management, or lawyers.
    Propagation is also slow, and enforcement is reputational. A crawler that cached your robots.txt this morning may keep fetching under that view all day, and a non-participant may keep fetching forever. Neither case is a bug; each is the system doing exactly what a voluntary convention can do.
    ## Prior Signals, From GPTBot to TDM-Rep
    The robots.txt vs noai meta tag vs TDM-Rep question is a layering question, not a fight with one winner. Each layer covers a different failure mode.
    | Signal | Layer | Who reads it | Enforcement |
    |---|---|---|---|
    | Shared robots.txt preference | Host, file-level | Participating providers | Voluntary, reputational |
    | Provider user agents (GPTBot, ClaudeBot, Google-Extended, CCBot) | Host, per-agent | Each provider's own crawlers | Voluntary, provider-documented |
    | noai / noimageai meta tags | Page-level | Implementers who opt in | Voluntary |
    | TDM Reservation Protocol | Site, machine-readable | Text and data mining actors | Statutory hook in the EU |
    | ai.txt well-known file | Site, licensing terms | Implementers who opt in | Voluntary |
    | C2PA provenance metadata | Content-level | Downstream tooling | Voluntary, aimed at attribution more than exclusion |
    Provider-specific AI crawler user agents predate the shared signal (GPTBot arrived in 2023, and Common Crawl's [CCBot](https://commoncrawl.org/ccbot) has fed training corpora far longer), so they remain the practical way to address crawlers individually when your policy differs by provider. Policy 3 above leaned on exactly that.
    The [noai meta tag](https://datalicenses.org/initiatives/deviantart-noai/), introduced by DeviantArt in 2022, is page-level and blunt:
    ```html
    ```
    The TDM Reservation Protocol is the one with teeth. The W3C spec lets a site express a mining reservation in a place TDM tools are expected to check, via a `/.well-known/tdmrep.json` file or an HTTP response header:
    ```json
    { "tdm_reservation": 1 }
    ```
    In the EU this carries weight the robots.txt convention cannot match on its own. The DSM Directive's text and data mining exception permits mining unless rights holders reserve against it, and the directive conditions that reservation on being machine-readable. TDM-Rep is the spec built to satisfy the condition; a voluntary robots.txt convention alone does not guarantee it. If you have EU exposure, layer it alongside your robots policy rather than choosing between them.
    The [ai.txt draft](https://www.ietf.org/archive/id/draft-car-ai-txt-wellknown-00.html) at the IETF pushes further toward machine-readable licensing, a well-known file stating which uses are permitted, closer to a contract than a crawler directive. None of these layers replaces the row above. Publishers with real exposure run several and keep them consistent.
    ## Scraper Implementation, Honoring Preferences in Your Crawler
    ![A robots gate that checks fetch permissions before every request is the core of how to make a custom crawler respect robots.txt.](https://images.pexels.com/photos/6424591/pexels-photo-6424591.jpeg?auto=compress&cs=tinysrgb&h=650&w=940)
    If you are wondering how to make a custom crawler respect robots.txt, the mechanics fit in an afternoon. The policy decisions around them are the hard part. The emerging minimum bar for agent teams has four parts: a named and contactable user agent, preference checks at fetch time, robots state cached, with deliberate 404 and unreachable behavior per [RFC 9309](https://www.rfc-editor.org/info/rfc9309/), and the ability to purge previously fetched content when a preference changes.
    ### Step 1, Identify Your Crawler Honestly
    Every request should carry a user agent a publisher can act on:
    ```txt
    PastAgent/1.2 (+https://example.com/bot; [email protected])
    ```
    That is how to identify an AI agent crawler user agent from the other side of the wire: product token, version, policy URL, contact. Anonymity is the tell of a crawler that plans to misbehave.
    ### Step 2, Fetch, Cache, and Honor robots.txt
    RFC 9309's failure semantics are where homemade fetchers go wrong. A 404 robots.txt means allow everything. A robots.txt that stays unreachable can be treated as disallow everything, so a publisher's robots outage can silence well-behaved crawlers, and your tolerance for that case is a decision you should make deliberately. Cache what you fetch, revalidate at least daily following common crawler practice, and honor Cache-Control when the server sends it.
    ```python
    import time
    from urllib import robotparser
    UA = "PastAgent/1.2 (+https://example.com/bot)"
    class RobotsGate:
    def __init__(self, ttl=24 * 3600):
    self.ttl, self.cache = ttl, {}
    def allowed(self, url):
    origin = "/".join(url.split("/")[:3])
    ts, rp = self.cache.get(origin, (0, None))
    if time.time() - ts > self.ttl: # daily revalidation
    rp = robotparser.RobotFileParser()
    rp.set_url(origin + "/robots.txt")
    rp.read()
    self.cache[origin] = (time.time(), rp)
    return self.cache[origin][1].can_fetch(UA, url)
    ```
    Two caveats worth knowing. Python's robotparser maps network errors to disallow-all, which is stricter than the RFC's "may," so confirm that matches your intent. And the library parses access rules only; the shared signal's preference fields need a small parser of their own, keyed to whatever each provider documents.
    ### Step 3, Purge on Preference Change
    Keep an ingest ledger: every document stored alongside the robots.txt digest in effect when it was fetched. When a refetch shows a changed digest, re-evaluate retained documents against the new policy and purge or flag what is no longer permitted. Without this, your compliance story ends at fetch time, which is exactly where an auditor will look.
    ## A Compliance Checklist for Agent Teams
    AI crawler compliance is turning into procurement language, so make the bar explicit before someone else does.
    - **Named, contactable user agent.** Product token, version, policy URL, and an inbox a human reads.
    - **Preference checks at fetch time.** Not at index time, not at crawl-plan time. The check is cheap; retrofitting trust is not.
    - **Robots state cached, with deliberate 404 and unreachable behavior.** Revalidate daily and honor Cache-Control, following common crawler practice.
    - **Purge-on-preference-change.** An ingest ledger with robots digests, plus a tested path to delete what a policy change withdraws.
    - **Provenance logging.** For any document, be able to say under which policy version it was collected.
    - **A public policy page.** What you fetch, what you keep, how long, and how to ask you to stop.
    Ship these six and you are ahead of most of the market, including some very large participants.
    ## Failure Modes and Edge Cases
    Most broken AI training preferences robots.txt deployments trace back to a short list of mistakes.
    - **The comma-listed user agent.** `User-agent: *, GPTBot` on one line does nothing useful. Each user agent gets its own line, and when several groups match your agent, only the most specific one applies, so a specific agent never inherits the `*` group's rules.
    - **Orphan directives.** A Disallow placed before any User-agent line belongs to no group and is ignored. Directives follow their User-agent lines, always.
    - **CDN-cached robots.txt.** Your policy change is invisible until the edge cache expires or is purged. Stack that on each crawler's own cache and a preference change takes days to reach every compliant bot. Purge on deploy, every time.
    - **Mid-crawl preference flips.** A crawler that validated robots at 09:00 can legitimately keep fetching under that view for hours. If you need an effect measured in minutes, enforce it at the edge with user-agent firewall rules; robots.txt is the wrong instrument.
    - **License text contradicting machine signals.** Pages that say "all rights reserved" while robots.txt allows everything send contradictory instructions, and machine readers follow the machine-readable layer. Make them agree, or accept that the robot layer wins by default.
    - **Your own robots.txt downtime.** Per the RFC's failure semantics, a 404 flips every compliant crawler to allow-all, while sustained unreachability can silence them entirely. Monitor `/robots.txt` like a production endpoint, because it is one.
    ## What to Ship This Week
    **Publishers**
    1. Pick one of the three policies above and deploy it.
    2. Purge the CDN, then verify per agent with curl and access logs.
    3. Add the shared-signal preference fields once your target providers document the names they read.
    4. Decide whether TDM-Rep belongs in your stack. EU exposure answers that for you.
    5. Calendar a quarterly re-check of the participant list, because it will move.
    **Agent teams**
    1. Name your crawler and publish its policy page.
    2. Put a robots gate behind every fetch, with deliberate 404 and unreachable behavior.
    3. Set your cache TTL and honor server Cache-Control.
    4. Stand up the ingest ledger and the purge path, then test both.
    5. Write the one-page policy document enterprise buyers will eventually ask for.
    The shared signal gave publishers one line that four companies promise to honor, and gave agent operators an etiquette bar that is fast becoming the price of enterprise trust. Neither side gets control. Both sides get the first entry in a policy stack, and this week is early enough to ship yours.]]>
    0 min
  • What the Deepgram Daily Acquisition Actually Protects
    pipecat-ai[deepgram]==
    ```
    Production should never pick up a newer release without a deliberate act on your side.
    2. **Mirror the repository.** A fork under your organization, or a scheduled mirror, preserves the full history independent of upstream. It is insurance against takedowns and history rewrites, and it doubles as staging if a fork trigger ever fires.
    3. **Audit your touchpoints.** Inventory every place your code touches Pipecat internals: subclassed services, custom frame processors, transport-specific logic, and private APIs. This list is your true migration surface, and in practice many teams find they touch fewer internals than they feared once the inventory is written down.
    4. **Keep the expensive logic yours.** Model-level lock-in here is low by design, since Pipecat already abstracts providers behind common service interfaces. The real lock-in is your own orchestration logic: conversation flows, processor chains, state handling, and transport code that encode your product. Keep that logic separable so any exit prices as rewriting glue, not rewriting product.
    5. **Write the fork triggers down.** A fork-trigger policy for framework dependencies only works if it exists before you need it.
    > A policy that lives in your head is not a policy; it is a mood.
    - **Immediate trigger.** A license change, a CLA applied retroactively, or trademark action against a fork. If one fires, you fork or migrate on a schedule you set today, calmly.
    - **Scheduled-migration trigger.** Two consecutive quarters of warning readings on integrations you depend on. This one justifies no emergency; it converts into a planned migration with a deadline.
    ## Alternative Paths and What Precedent Suggests
    ### What ports cleanly from Pipecat
    The exit question is not which framework wins a feature comparison. It is what actually moves when you leave, and Pipecat's own design answers most of it. Because the framework abstracts providers behind common service interfaces, swapping one vendor's speech-to-text or text-to-speech for another is close to a configuration change; that swappability is why you adopted an orchestrator in the first place. The expensive surface is everything the abstraction does not cover: custom frame processors, transport-specific code, and the conversation-state logic the touchpoint audit in the hedge section already inventoried. Price any exit from that inventory, not from a feature list.
    The realistic destinations are LiveKit Agents, Vocode, and rolling your own loop. The [LiveKit Agents repository](https://github.com/livekit/agents) is the gravity well among them, and the honest comparison is migration effort from a Pipecat codebase, which the table prices per path.
    | Path | What ports from Pipecat | What you rebuild or accept |
    | --- | --- | --- |
    | LiveKit Agents | Pipeline concepts, agent primitives, and provider config map closely | Transport swaps wholesale; Daily-specific code is written off and you anchor to LiveKit's transport ecosystem |
    | Vocode | Provider config and simple conversation flows move with light effort | Agent plumbing and integration glue, inside a smaller maintenance base |
    | Custom orchestration | Everything, because it is already your code | Turn-taking, barge-in, and transport edge cases land on your own backlog |
    ### What three forks say
    Precedent calibrates what any exit costs. When Terraform changed its license, the community fork became OpenTofu; the [OpenTofu announcement](https://www.linuxfoundation.org/press/announcing-opentofu) shows the institutional machinery required simply to preserve continuity of a mature project. Redis's license shift produced Valkey, and a [first-year Valkey retrospective](https://www.linuxfoundation.org/blog/a-year-of-valkey) from the Linux Foundation covers running the fork under a foundation, alongside the slower work of splitting an ecosystem in two. MariaDB forked from MySQL in 2009 and endures, which suggests forks persist, and still shares its market with MySQL, which suggests splits stay permanent rather than resolved. The consistent lesson across all three: forks preserve code and lineage, but they cost momentum, and every ecosystem split absorbs migration effort that users of the original never budgeted for. Hedge so you never have to spend it.
    ## The Calibrated Verdict
    To be explicit about what this piece does not claim: there is no public evidence that Deepgram is steering Pipecat. The five signals above are baselines to collect, not accusations to make. The thesis is falsifiable in both directions. If competitor integrations hold parity, committers stay distributed across employers, and the docs keep demonstrating the provider abstraction across several release cycles, then the pledge is holding and this deal was ordinary consolidation. If two quarters show the warning readings, you will not need an announcement to justify an exit, because the commit history will already have made the case.
    The Deepgram Daily acquisition settled who owns the code. It left open who the code will serve best, and that question gets answered monthly, in public, for anyone watching. Pin your versions, mirror the repo, audit your touchpoints, write the triggers, and recheck the five signals each month for two quarters. After that you will be acting on evidence instead of reassurance, which is the only posture that has ever served a builder well inside the orbit of a vendor's roadmap.]]>
    0 min