explaingit

wailers9/bragi

Analysis updated 2026-06-24

32PythonAudience · writerComplexity · 3/5Setup · easy

TLDR

Python tool for AI-assisted fantasy writing that stores world, time, place, characters, and events in a numbered tree so an LLM stops contradicting itself across chapters.

Mindmap

mindmap
  root((Bragi))
    Inputs
      Setting sentence
      Agent API keys
    Outputs
      World overview
      Story segments
      Event log
    Use Cases
      Long form AI fiction
      World consistency tracking
      Demo writing without keys
    Tech Stack
      Python
      OpenAI
      DeepSeek
      Web UI
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a fantasy world from a one-sentence setting and walk through nested places and time periods

USE CASE 2

Generate long-running story chapters that stay consistent with characters and past events

USE CASE 3

Try the whole flow offline using the built-in Demo agent before paying for an API key

What is it built with?

PythonOpenAIDeepSeek

How does it compare?

wailers9/bragiautolearnmem/automemcortex-ai-network/crypto-arbitrage-bot-automated-trading
Stars323232
LanguagePythonPythonPython
Setup difficultyeasyhardmoderate
Complexity3/55/52/5
Audiencewriterresearchergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Demo agent runs without keys, but real long stories need an OpenAI or DeepSeek key via env vars and Python 3.10.

In plain English

Bragi is a Python tool for people who write fantasy stories with the help of AI. The maintainer points out that many AI writing agents forget what they made up a few chapters ago, so characters and plot details start contradicting each other. Bragi tries to fix that by giving the world a standard structure for time, space, characters, and events, so the agent can keep adding to the same story without losing track. You give it a one sentence setting, for example a sea kingdom torn by moonlight tides, and the project generates a world overview, base rules, a history timeline, and a space layout. Each piece is stored as a numbered path like 1,2,3 so the project can walk through nested time periods and nested places. Only the current location keeps its full detail in memory, while nearby nodes keep summaries, and deeper detail is filled in on demand. On top of that world, Bragi writes story segments and updates the main and side characters as the plot moves. It records public events, private events, the protagonist's choices, prompts sent to the manager, and token usage. You can run the whole flow from the command line, or open a small black and white Web interface at a local address to click through world creation, story generation, and node browsing. The project supports three agent backends. A built in Demo agent runs locally with no API key, which is useful for trying the flow. Real generation can use OpenAI or DeepSeek, set through environment variables. The README suggests DeepSeek for long story continuation and OpenAI for the initial world build. Python 3.10 or newer is required.

Copy-paste prompts

Prompt 1
Walk me through how Bragi numbers world nodes and which level keeps full detail in memory versus a summary
Prompt 2
Help me switch Bragi from the Demo agent to DeepSeek for chapter generation and OpenAI for world building
Prompt 3
Show me the data shape Bragi uses for public events, private events, and protagonist choices
Prompt 4
Run the Bragi web UI locally and explain each tab from world creation to node browsing
Prompt 5
Extend Bragi so it exports the finished story as a single Markdown file with chapter headings

Frequently asked questions

What is bragi?

Python tool for AI-assisted fantasy writing that stores world, time, place, characters, and events in a numbered tree so an LLM stops contradicting itself across chapters.

What language is bragi written in?

Mainly Python. The stack also includes Python, OpenAI, DeepSeek.

How hard is bragi to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is bragi for?

Mainly writer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.