Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ greeting:1-2
Bobbin found a parsed function, with its source range, in the index you just built.
See the [quick start](https://scbrown.github.io/bobbin/getting-started/quick-start.html) for semantic search.

![Animated terminal: Bobbin finds a function by meaning and assembles its source context](docs/demos/terminal/demo.svg)

This 20-second recording uses a small local Python fixture. Semantic search
finds the invoice-total function; context returns its source. The optional
graph store is unavailable, and the recording retains that warning.
[Read the transcript](docs/demos/terminal/transcript.txt) or
[reproduce the recording](docs/demos/terminal.md).

## On your own code

Run `bobbin init` and `bobbin index` from your repository first.
Expand Down
32 changes: 32 additions & 0 deletions docs/demos/terminal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Find code by meaning, then read its context

This recording runs native Bobbin 0.36.1 at commit
`667a680d393c0d9e5347af7fc9d71472c00a494e` against a local public Python fixture.
The manifest pins the executable and every input. Semantic search returns
`calculate_total`; context displays its three source lines. The optional Quipu
store is unavailable, so its single warning remains visible. This does not
claim graph ranking occurred.

The two reading holds total 20 seconds. Actual command execution durations
are recorded separately. The static transcript is an accessible fallback;
the last SVG frame remains visible when animation is disabled.

The vendored renderer is byte-identical to Tambo's shared recorder at
`b0765b5d8f16a6a26acb3595552f17826d965b44`,
SHA-256 `bebbe000565314f18a58731f2a1a4690577db127b3673fa10a45ce74eef0f23c`.
It refuses possible private paths and credentials rather than filtering output.

## Reproduce

Use Python 3, the recorded Bobbin version and a compatible ONNX runtime.
Prepare a new, absent workspace with the helper. It creates an isolated HOME
and index, and indexing may download the embedding model. It does not install
hooks or connect to a graph.

```sh
python3 docs/demos/terminal/prepare.py /tmp/bobbin-terminal-demo --tool "$(command -v bobbin)"
python3 docs/demos/terminal/render.py docs/demos/terminal/demo.tape.json --workspace /tmp/bobbin-terminal-demo --tool bobbin="$(command -v bobbin)" --output /tmp/bobbin-terminal-render
```

The fixture and model cache stay inside that disposable workspace. No existing
index or user configuration is read. Use a fresh directory for each capture.
3 changes: 3 additions & 0 deletions docs/demos/terminal/demo.cast
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"version": 2, "width": 65, "height": 14, "title": "Bobbin | find code and assemble context", "env": {"TERM": "dumb"}}
[0.0, "o", "\u001b[2J\u001b[H$ bobbin search 'calculate invoice total' --mode semantic --limit\r\n 2\r\n\u2713 Found 1 results for: calculate invoice total (semantic)\r\n\r\n1. totals.py:1 (calculate_total)\r\n [totals-example] function python \u00b7 lines 1-3 \u00b7 score 0.6736\r\n"]
[10.0, "o", "\u001b[2J\u001b[H$ bobbin context 'calculate invoice total' --budget 40\r\n\u2713 Context for: calculate invoice total\r\n 1 files, 1 chunks (3/40 lines)\r\n\r\n--- totals.py [direct, score: 1.0000] ---\r\n calculate_total (function), lines 1-3\r\n def calculate_total(amounts):\r\n \"\"\"Calculate the total amount for an invoice.\"\"\"\r\n return sum(amounts)\r\n\r\n ! PPR enabled but Quipu store unavailable; continuing without \r\ngraph ranking. Use --verbose for details.\r\n"]
34 changes: 34 additions & 0 deletions docs/demos/terminal/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions docs/demos/terminal/demo.tape.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"title": "Bobbin | find code and assemble context",
"description": "Native semantic retrieval and context from a small local Python fixture; optional graph ranking is unavailable.",
"width": 1100,
"height": 700,
"font_size": 24,
"line_height": 32,
"inputs": [
"totals.py"
],
"steps": [
{
"tool": "bobbin",
"args": [
"search",
"calculate invoice total",
"--mode",
"semantic",
"--limit",
"2"
],
"requires": [
"calculate_total",
"semantic"
],
"hold": 10,
"timeout": 120
},
{
"tool": "bobbin",
"args": [
"context",
"calculate invoice total",
"--budget",
"40"
],
"requires": [
"calculate_total",
"graph ranking"
],
"allow_stderr": true,
"hold": 10,
"timeout": 120
}
]
}
3 changes: 3 additions & 0 deletions docs/demos/terminal/fixture/totals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def calculate_total(amounts):
"""Calculate the total amount for an invoice."""
return sum(amounts)
57 changes: 57 additions & 0 deletions docs/demos/terminal/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"theme": "stack-terminal-24",
"versions": {
"bobbin": "bobbin 0.36.1 (667a680d393c0d9e5347af7fc9d71472c00a494e)"
},
"binary_sha256": {
"bobbin": "d56bd5e01a82b64269c106f0b68692dc6c225bc12ad9bafb24dce1c61be57937"
},
"version_args": {
"bobbin": [
"--version"
]
},
"inputs_sha256": {
"render.py": "bebbe000565314f18a58731f2a1a4690577db127b3673fa10a45ce74eef0f23c",
"tape": "e97f346a9ebb25a1ae7f8896e6c51b7e34400558acffce1c23f2e332e62cd3f2",
"totals.py": "8b22236231ed7b92250a818a749d26334e3201f87d28a9e6bcdb38ebdec7ea19"
},
"duration_seconds": 20.0,
"timeline": "deliberate reading holds; execution times recorded separately",
"frames_checked": 2,
"commands": [
{
"tool": "bobbin",
"args": [
"search",
"calculate invoice total",
"--mode",
"semantic",
"--limit",
"2"
],
"exit": 0,
"seconds": 0.261712,
"stdout": "\u2713 Found 1 results for: calculate invoice total (semantic)\n\n1. totals.py:1 (calculate_total)\n [totals-example] function python \u00b7 lines 1-3 \u00b7 score 0.6736\n\n",
"stderr": ""
},
{
"tool": "bobbin",
"args": [
"context",
"calculate invoice total",
"--budget",
"40"
],
"exit": 0,
"seconds": 0.214701,
"stdout": "\u2713 Context for: calculate invoice total\n 1 files, 1 chunks (3/40 lines)\n\n--- totals.py [direct, score: 1.0000] ---\n calculate_total (function), lines 1-3\n def calculate_total(amounts):\n \"\"\"Calculate the total amount for an invoice.\"\"\"\n return sum(amounts)\n\n",
"stderr": " ! PPR enabled but Quipu store unavailable; continuing without graph ranking. Use --verbose for details.\n"
}
],
"sha256": {
"demo.svg": "39c22eb226479048e1bc5bc88c1f6e586907fe8ec8f4e3f6c78e5b76cb5152bf",
"transcript.txt": "f7fe87d60b1901e95f97761bc49d15b4c1a62d167c112e743e607b7b289955bc",
"demo.cast": "d955fc73c73534f684e19471b0995807d6f95f04446cceac9014685d165219fb"
}
}
43 changes: 43 additions & 0 deletions docs/demos/terminal/prepare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Prepare a disposable index and model cache for the terminal recorder."""
import argparse
import os
from pathlib import Path
import shutil
import subprocess


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("workspace", type=Path)
parser.add_argument("--tool", type=Path, required=True)
args = parser.parse_args()
tool = args.tool.resolve(strict=True)
root = args.workspace.resolve()
root.mkdir() # Refuse an existing workspace rather than reuse its state.
home = root / ".demo-home"
home.mkdir()
shutil.copyfile(Path(__file__).parent / "fixture/totals.py", root / "totals.py")
(root / ".terminal-demo-sandbox").write_text("disposable terminal fixture\n")
env = {
"PATH": str(tool.parent) + os.pathsep + os.defpath,
"HOME": str(home),
"XDG_CONFIG_HOME": str(home / ".config"),
"XDG_CACHE_HOME": str(home / ".cache"),
"XDG_STATE_HOME": str(home / ".state"),
"TMPDIR": str(root),
"LANG": "C.UTF-8",
"TERM": "dumb",
"NO_COLOR": "1",
"RUST_LOG": "off",
"BOBBIN_GPU": "0",
}
for command in [
["init", ".", "--quiet"],
["index", ".", "--repo", "totals-example", "--no-quipu-publish", "--skip-calibrate", "--quiet"],
]:
subprocess.run([str(tool), *command], cwd=root, env=env, check=True)


if __name__ == "__main__":
main()
Loading
Loading