Skip to content

About

ByteRover + Claude Code Incident Memory Demo

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Incident Memory with ByteRover and Claude Code: Capture a payment bug fix as queryable context with ByteRover

Incident Memory with ByteRover and Claude Code

Capture a payment bug fix as queryable context with ByteRover

A small FastAPI payment service with a deliberate double-credit bug, used to show how ByteRover and Claude Code analyze, fix and document an incident so the knowledge is available at coding time.


Built by Studio1 Built with ByteRover

ByteRover docs  ·  ByteRover  ·  More examples  ·  studio1hq.com


Overview

This repo shows how to capture incident knowledge inside a codebase with ByteRover and Claude Code. It uses a deliberately flawed FastAPI payment service: a rollback operation credits user balances but is not idempotent, so retries cause duplicate credits.

The workflow is to analyze the code, document it, reproduce and fix the bug, store the incident as structured context, and then query that context before changing related code. The point is that a postmortem is present when code is written, not only afterwards.

Features

  • Codebase curation: brv curate has Claude generate structured documentation from the code alone: overview, entry points, execution paths, shared state, bug analysis and a demo workflow.
  • Reproducible bug: demo.py drives the API through a charge that fails, is rolled back and is retried, which triggers the double credit.
  • Idempotent fix: an idempotency guard, enforced state transitions and no duplicate balance updates, with rollout and reconciliation steps documented.
  • Queryable memory: brv query returns the original bug, why it happened, the approved pattern, code references and rollout constraints.
  • Context next to code: the generated context tree lives in .brv/context-tree/ in the repo.

Tech stack

Layer Tool
Context and memory ByteRover CLI
Coding agent Claude Code
Service FastAPI and Uvicorn
Language Python 3.10 or later

Getting started

Prerequisites

  • Python 3.10 or later
  • ByteRover CLI, installed and authenticated
  • Claude Code with the ByteRover integration
  • Basic familiarity with FastAPI

Installation

git clone https://github.com/Studio1HQ/incident-memory.git
cd incident-memory
pip install -r requirements.txt

Run

Start the service, then run the demo script that reproduces the bug:

uvicorn app.main:app --port 8000
python demo.py

demo.py calls http://127.0.0.1:8000 and uses the /charge, /charge/{id}/confirm and /charge/{id}/rollback endpoints. The service also exposes /charge/{id}/refund.

How it works

app/
  main.py             FastAPI app
  api/routes.py       charge, confirm, rollback, refund routes
  payment/service.py  bug and fix location
  payment/store.py    in-memory state
  payment/models.py   data models
demo.py               reproduces the failure
CLAUDE.md             ByteRover workflow rules for the agent
.brv/context-tree/    generated context: structure, api_design, business_logic, bug_fixes, testing

The workflow, step by step:

  1. Initialize: brv init creates ByteRover rules and enables context capture.
  2. Curate: brv curate has Claude analyze the repository and write structured documentation based only on code behavior.
  3. Sync: brv push publishes the context so future engineers and agents can query it.
  4. Fix: the prompt used was: "Using the existing ByteRover context and current codebase, design and implement a correct, idempotent fix for the double-credit bug, explain why previous behavior failed, update the code accordingly, and document the approved fix and rollout considerations as markdown."
  5. Commit: the fix is committed so code and context evolve together.
  6. Prevent: before writing code, a future engineer asks:
brv query "What patterns should I follow when modifying user balances in payment operations?"

The exact layout of the generated documentation is decided by ByteRover and may change.

This is aimed at backend engineers on critical systems, platform teams supporting AI coding agents, and anyone evaluating ByteRover for institutional memory.

Resources

  • ByteRover: the context and memory product used here.
  • ByteRover docs: CLI commands such as brv init, brv curate, brv push and brv query.


Studio1

Built by Studio1, the technical content and DevRel partner for devtool teams. Made with ByteRover.
Browse more open-source examples at github.com/Studio1HQ.

Website Book a call X LinkedIn

studio1hq.com · Technical content, docs, video and DevRel for devtools

About

ByteRover + Claude Code Incident Memory Demo

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages