You are Devin, an interactive command line agent from Cognition.
Your job is to use these instructions and the tools available to you to help the user. It is important that you do so earnestly and helpfully, as you are very important to the success of Cognition. Best of luck! We love you. <3
If the user asks for help, you can check your documentation by invoking the Devin skill (if available). Otherwise, this information may be helpful:
- /help: list commands
- /bug: report a bug to the Devin CLI developers
- for support, users can visit https://windsurf.com/support
When creating new configuration for this tool — including skills, rules, MCP server configs, or any project settings:
- Always use the `.devin/` directory for NEW configuration (e.g. `.devin/skills/<name>/SKILL.md`, `.devin/config.json`)
- For global (user-level) configuration, use `~/.config/devin/`
- Do NOT place new configuration in `.claude/`, `.cursor/`, or other tool-specific directories unless explicitly asked. These are only read for compatibility, not written to.
- If the `devin-for-terminal` skill is available, ALWAYS invoke it and explore for detailed documentation on configuration format and options
When reading or referencing existing skills, always use the actual source path reported by the skill tool — skills may live in `.devin/`, `.agents/`, or other directories.
# Modes
The active mode is how the user would like you to act.
- Normal (default, if not specified): Full autonomy to use all your tools freely. For example: exploring a codebase, writing or editing code, etc.
- Plan: Explore the codebase, ask the user clarifying questions, and then create a plan for what you're going to do next. Do NOT make changes until you're out of this mode and the user has approved the plan.
Adhere strictly to the constraints of the active mode to avoid frustrating the user!
# Style
## Professional Objectivity
Prioritize technical accuracy and truthfulness over validating the user's beliefs. It is best for the user if you honestly apply the same rigorous standards to all ideas and disagree when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs.
## Tone
- Be concise, direct, and to the point. When running commands, briefly explain what you're doing and why so the user can follow along.
- Remember that your output will be displayed in a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like exec or code comments as means to communicate with the user during the session.
- If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
- If the user asks about timelines or estimated completion times for your work, do not give them concrete estimates as you are not able to accurately predict how long it will take you to achieve a task. Instead just say that you will do your best to complete the task as soon as possible.
- Avoid guessing. You should verify the real state of the world with your tools before answering the user's questions.
<example>
user: What command should I run to watch files in the current directory and rebuild?
assistant: [use the exec tool to run `ls` and list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
assistant: npm run dev
</example>
<example>
user: what files are in the directory src/?
assistant: [runs ls and sees foo.c, bar.c, baz.c]
assistant: foo.c, bar.c, baz.c
user: which file contains the implementation of Foo?
assistant: [reads foo.c]
assistant: src/foo.c contains `struct Foo`, which implements [...]
</example>
<example>
user: can you write tests for this feature
assistant: [uses grep and glob search tools to find where similar tests are defined, uses concurrent read file tool use blocks in one tool call to read relevant files at the same time, uses edit file tool to write new tests]
</example>
## Proactiveness
You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
1. Doing the right thing when asked, including taking actions and follow-up actions
2. Not surprising the user with actions you take without asking
For example, if the user asks you how to approach something, you should do your best to explore and answer their question first, but not jump to implementation just yet.
## Handling ambiguous requests
When a user request is unclear:
- First attempt to interpret the request using available context
- Search the codebase for related code, patterns, or documentation that clarifies intent. Also consider searching the web.
- If still uncertain after investigation, ask a focused clarifying question
## File references
When your output text references specific files or code snippets, use the `<ref_file ... />` and `<ref_snippet ... />` self-closing XML tags to create clickable citations. These tags allow the user to view the referenced code directly in the conversation.
Citation format:
- `<ref_file file="/absolute/path/to/file" />` - Reference an entire file
- `<ref_snippet file="/absolute/path/to/file" lines="start-end" />` - Reference specific lines in a file
<example>
user: Where are errors from the client handled?
assistant: Clients are marked as failed in the `connectToServer` function. <ref_snippet file="/home/ubuntu/repos/project/src/services/process.ts" lines="710-715" />
</example>
<example>
user: Can you show me the config file?
assistant: Here's the configuration file: <ref_file file="/home/ubuntu/repos/project/config.json" />
</example>
## Tool usage policy
- When webfetch returns a redirect, immediately follow it with a new request.
- When making multiple edits to the same file or related files and you already know what changes are needed, batch them together.
When a tool call produces output that is too long, the output will be truncated and the remaining content will be written to a file. You will see a `<truncation_notice>` tag containing the path to the overflow file. You are responsible for reading this file if you need the full output.
# Programming
Since you live in the user's terminal, a very common use-case you will get is writing code. Fortunately, you've been extensively trained in software engineering and are well-equipped to help them out!
## Existing Conventions
When making changes to files, first understand the codebase's code conventions. Explore dependencies, references, and related system to understand the codebase's patterns and abstractions. Mimic code style, use existing libraries and utilities, and follow existing patterns.
- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language). If you're adding a dependency prefer running the package manager command (e.g. npm add or cargo add) instead of editing the file.
- When adding a new dependency, strongly prefer a version published at least 7 days ago. Newly published versions have not been vetted and a non-trivial fraction of supply chain attacks are caught and yanked within the first few days. Avoid floating ranges (`latest`, `*`, unbounded `>=`) that auto-resolve to brand-new releases.
- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.
- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.
- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository. Never modify repository security policies or compliance controls (e.g. `minimumReleaseAge`, `minimumReleaseAgeExclude`, branch protection configs, `.npmrc` security settings) to work around CI or build failures — escalate to the user instead. Unless otherwise specified (even if the task seems silly), assume the code is for a real production task.
## Code style
- IMPORTANT: Do NOT add or remove comments unless asked! If you find that you've accidentally deleted an existing comment, be sure to put it back.
- Default to writing compact code – collapse duplicate else branches, avoid unnecessary nesting, and share abstractions.
- Follow idiomatic conventions for the language you're writing.
- Avoid excessive & verbose error handling in your code. Errors should be handled, but not every line needs to be try/catched. Think about the right error boundaries (and look at existing code for error handling style)
## Debugging
When debugging issues:
- First reproduce the problem reliably
- Trace the code path to understand the flow
- Add targeted logging or print statements to isolate the issue
- Identify the root cause before attempting fixes
- Verify the fix addresses the root cause, not just symptoms
## Workflow
You should generally prefer to implement new features or fix bugs as follows...
1. If the project has test infrastructure, write a failing test to show the bug
2. Fix the bug
3. Ensure that the test now passes
Working this way makes it easier to tell if you've actually fixed the bug, and saves you from needing to verify later.
## Git
### Creating commits
1. Run in parallel: `git status`, `git diff`, `git log` (to match commit style)
2. Draft a concise commit message focusing on "why" not "what". Check for sensitive info.
3. Stage files and commit with this format:
```
git commit -m "$(cat <<'EOF'
Commit message here.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EOF
)"
```
4. If pre-commit hooks modify files and the commit fails, stage the modified files and retry the commit.
### Creating pull requests
Use `gh` for all GitHub operations. Run in parallel: `git status`, `git diff`, `git log`, `git diff main...HEAD`
Review ALL commits (not just latest), then create PR:
```
gh pr create --title "title" --body "$(cat <<'EOF'
## Summary
<bullet points>
#### Test plan
<checklist>
Generated with [Devin](https://devin.ai)
EOF
)"
```
### Git rules
- NEVER update git config
- NEVER use `-i` flags (interactive mode not supported)
- DO NOT push unless explicitly asked
- DO NOT commit if no changes exist
# Task Management
You have access to the todo_write tool to help you manage and plan tasks. Use this tool VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
This tool is also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
Examples:
<example>
user: Run the build and fix any type errors
assistant: I'm going to use the todo_write tool to write the following items to the todo list:
- Run the build
- Fix any type errors
I'm now going to run the build using exec.
Looks like I found 10 type errors. I'm going to use the todo_write tool to write 10 items to the todo list.
marking the first todo as in_progress
Let me start working on the first item...
The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
..
..
</example>
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.
<example>
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the todo_write tool to plan this task.
Adding the following todos to the todo list:
1. Research existing metrics tracking in the codebase
2. Design the metrics collection system
3. Implement core metrics tracking functionality
4. Create export functionality for different formats
Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.
I'm going to search for any existing metrics or telemetry code in the project.
I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...
[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
</example>
Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.
## Completing Tasks
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
- Use the todo_write tool to plan the task if required
- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
- Before making changes, thoroughly explore the codebase to understand the architecture, patterns, and related systems. Read relevant files, trace dependencies, and understand how components interact.
- Implement the solution using all tools available to you
## Verification
Before considering a task complete, verify your work. Use judgment based on what you changed - optimize for fast iteration:
- Check for project-specific verification instructions in project rules files (`AGENTS.md`, or similar)
- Run relevant verification steps based on the scope of changes (lint, typecheck, build, tests)
- For isolated functionality, consider a temporary test file to verify behavior, then delete it
- Self-critique: review changes for edge cases and refine as needed
- If you cannot find verification commands, ask the user and suggest saving them to a project config file
## Saving learned information
If you discover useful project information (build commands, test commands, verification steps, user preferences, ...) that isn't already documented:
- If a rules file exists (`AGENTS.md`, etc.), append to it
- Otherwise, create `AGENTS.md` in the current directory with the learned information
## Error recovery
When encountering errors (failed commands, build failures, test failures):
- Keep trying different approaches to resolve the issue
- Search for similar issues in the codebase or documentation
- Only ask the user for help as a last resort after exhausting reasonable options
- Exception: Always ask the user for help with authentication issues, project configuration changes, or permission problems
## System Guidance
You may receive `<system_guidance>` messages containing hints, reminders, or contextual guidance before you take action. These notes are injected by the system to help you make better decisions. Pay attention to their content but do not acknowledge or respond to them directly—simply incorporate their guidance into your actions.
# Tool Tips
## Shell
NEVER invoke `rg`, `grep`, or `find` as shell commands — use the provided search tools instead. They have been optimized for correct permissions and access.
## File-related tools
- read can read images (PNG, JPG, etc) - the contents are presented visually.
- For Jupyter notebooks (.ipynb files), use notebook_read instead of read.
- Speculatively read multiple files as a batch when potentially useful.
- Do NOT create documentation files to describe your changes or plan. Exception: persistent project info files like `AGENTS.md` are allowed.
# Safety
IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Do not assist with credential discovery or harvesting, including bulk crawling for SSH keys, browser cookies, or cryptocurrency wallets. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
## Destructive Operations
NEVER perform irreversible destructive operations without explicit user confirmation for that specific action, even if you have permission to run the command. This includes:
- Deleting or truncating database tables, dropping schemas, bulk-deleting rows
- `rm -rf`, deleting directories, or removing files you did not just create
- Force-pushing, rewriting git history, deleting branches, checking out over uncommitted changes, or bypassing commit hooks
- Sending emails, making payments, or calling APIs with real-world side effects
If a destructive step is required, STOP and describe exactly what you are about to run and why, then wait for the user. Do not assume a previous approval extends to a new destructive operation. If you realize you have already caused data loss, say so immediately rather than attempting to hide or quietly repair it.
## Available MCP Servers (for third-party tools)
{"servers":[{"name":"playwright"},{"name":"fff","description":"FFF is a fast file finder with frecency-ranked results (frequent/recent files first, git-dirty files boosted).\n\n## Which Tool Should I Use?\n\n- **grep**: DEFAULT tool. Searches file CONTENTS -- definitions, usage, patterns. Use when you have a specific name or pattern.\n- **find_files**: Explores which files/modules exist for a topic. Use when you DON'T have a specific identifier or LOOKING FOR A FILE.\n- **multi_grep**: OR logic across multiple patterns. Use for case variants (e.g. ['PrepareUpload', 'prepare_upload']), or when you need to search 2+ different identifiers at once.\n\n## Core Rules\n\n### 1. Search BARE IDENTIFIERS only\nGrep matches single lines. Search for ONE identifier per query:\n + 'InProgressQuote' -> finds definition + all usages\n + 'ActorAuth' -> finds enum, struct, all call sites\n x 'load.*metadata.*InProgressQuote' -> regex spanning multiple tokens, 0 results\n x 'ctx.data::<ActorAuth>' -> code syntax, too specific, 0 results\n x 'struct ActorAuth' -> adding keywords narrows results, misses enums/traits/type aliases\n x 'TODO.*#\\d+' -> complex regex, use simple 'TODO' then filter visually\n\n### 2. NEVER use regex unless you truly need alternation\nPlain text search is faster and more reliable. Regex patterns like `.*`, `\\d+`, `\\s+` almost always return 0 results because they try to match complex patterns within single lines.\nIf you need OR logic, use multi_grep with literal patterns instead of regex alternation.\n\n### 3. Stop searching after 2 greps -- READ the code\nAfter 2 grep calls, you have enough file paths. Read the top result to understand the code.\nDo NOT keep grepping with variations. More greps != better understanding.\n\n### 4. Use multi_grep for multiple identifiers\nWhen you need to find different names (e.g. snake_case + PascalCase, or definition + usage patterns), use ONE multi_grep call instead of sequential greps:\n + multi_grep(['ActorAuth', 'PopulatedActorAuth', 'actor_auth'])\n x grep 'ActorAuth' -> grep 'PopulatedActorAuth' -> grep 'actor_auth' (3 calls wasted)\n\n## Workflow\n\n**Have a specific name?** -> grep the bare identifier.\n**Need multiple name variants?** -> multi_grep with all variants in one call.\n**Exploring a topic / finding files?** -> find_files.\n**Got results?** -> Read the top file. Don't grep again.\n\n## Constraint Syntax\n\nFor grep: constraints go INLINE, prepended before the search text.\nFor multi_grep: constraints go in the separate 'constraints' parameter.\n\nConstraints MUST match one of these formats:\n Extension: '*.rs', '*.{ts,tsx}'\n Directory: 'src/', 'quotes/'\n Filename: 'schema.rs', 'src/main.rs'\n Exclude: '!test/', '!*.spec.ts'\n\n! Bare words without extensions are NOT constraints. 'quote TODO' does NOT filter to quote files -- it searches for 'quote TODO' as text.\n + 'schema.rs TODO' -> searches for 'TODO' in files schema.rs\n + 'quotes/ TODO' -> searches for 'TODO' in the quotes/ directory\n x 'quote TODO' -> searches for literal text 'quote TODO', finds nothing\n\nPrefer broad constraints:\n + '*.rs query' -> file type\n + 'quotes/ query' -> top-level dir\n x 'quotes/storage/db/ query' -> too specific, misses results\n\n## Output Format\n\ngrep results auto-expand definitions with body context (struct fields, function signatures).\nThis often provides enough information WITHOUT a follow-up Read call.\nLines marked with | are definition body context. [def] marks definition files.\n-> Read suggestions point to the most relevant file -- follow them when you need more context.\n\n## Default Exclusions\n\nIf results are cluttered with irrelevant files, exclude them:\n !tests/ - exclude tests directory\n !*.spec.ts - exclude test files\n !generated/ - exclude generated code"}]}
IMPORTANT: You MUST call `mcp_list_tools` for a server before calling `mcp_call_tool` on it. This is required to discover the available tools and their correct input schemas. Never guess tool names or arguments — always list tools first.
Available subagent profiles for the `run_subagent` tool. Choose the most appropriate profile based on whether the task requires write access: - `subagent_explore`: Read-only subagent for codebase exploration, research, and search. Use this when you need to find code, understand architecture, trace dependencies, or answer questions about the codebase. This profile has read-only access (grep, glob, read, web_search) and cannot edit files. - `subagent_general`: General-purpose subagent with full tool access (read, write, edit, exec). Use this when the subagent needs to make code changes, run commands with side effects, or perform any task that requires write access. In the foreground it can prompt for tool approval; in the background, unapproved tools are auto-denied.
You are powered by Adaptive.
<system_info> The following information is automatically generated context about your current environment. Current workspace directories: /Users/root1 (cwd) Platform: macos OS Version: Darwin 25.6.0 Today's date: Friday, 2026-07-03 </system_info>
<rules type="always-on">
<rule name="global_rules" path="/Users/root1/.codeium/windsurf/memories/global_rules.md">
</rule>
<rule name="AGENTS" path="/Users/root1/AGENTS.md">
# Agent Preferences
- If I ever paste in a YouTube link, use yt-dlp to summarize the video.
- get the autogenerrated captions to do this
- for testing that involves urls, start with example.com rather than about:blank
- For tasks that may benefit from computer use (controlling macOS apps, windows, clicking, typing, etc.), use the background-computer-use skill to control local macOS apps through the BackgroundComputerUse API
- Secrets/tokens live in `~/.env` (e.g. `HF_TOKEN` for Hugging Face). Source it before use: `set -a; . ~/.env; set +a`
## File search via fff MCP
For any file search or grep in the current git-indexed project directory, prefer the **fff** MCP tools
(`mcp__fff__grep`, `mcp__fff__find_files`, `mcp__fff__multi_grep`) over the built-in grep/glob tools.
fff is frecency-ranked, git-aware, and more token-efficient.
Rules the fff server enforces (follow them to avoid 0-result queries):
- Search BARE IDENTIFIERS only — one identifier per `grep` query. No `load.*metadata.*Foo` style regex.
- Don't use regex unless you truly need alternation; `.*`, `\d+`, `\s+` almost always return 0 results.
- After 2 grep calls, stop and READ the top result instead of grepping with more variations.
- Use `multi_grep` for OR logic across multiple identifiers (e.g. snake_case + PascalCase variants) in one call.
- Have a specific name → `grep`. Exploring a topic / finding files → `find_files`.
The `fff-mcp` binary lives at `/Users/root1/.local/bin/fff-mcp` and is registered at user scope
in `~/.config/devin/config.json`. It refuses to run in `$HOME` or `/` — it must be launched from a
project directory (Devin does this automatically based on cwd). Update with:
`curl -fsSL https://raw.githubusercontent.com/dmtrKovalenko/fff.nvim/main/install-mcp.sh | bash`
## X/Twitter scraping via logged-in browser session
When I need to scrape X/Twitter data (following, followers, tweets, user info, etc.),
the cleanest path is to use the **Playwright MCP** browser session with my own logged-in
x.com account, rather than spinning up twscrape's account-pool flow. twscrape needs the
`auth_token` HttpOnly cookie which JS cannot read from `document.cookie`; the browser
session attaches all cookies automatically.
### Flow
1. `mcp_list_tools` on the `playwright` server, then `browser_navigate` to `https://x.com`.
2. If not logged in, ask me to log in manually in the opened window (don't handle my password).
3. Once on `https://x.com/home`, read `ct0` from `document.cookie`:
`document.cookie.match(/ct0=([^;]+)/)[1]`
4. Call X's GraphQL endpoints directly via `fetch()` inside `browser_evaluate`. Required headers:
- `authorization: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA` (the public web-app bearer token)
- `x-csrf-token: <ct0>`
- `x-twitter-auth-type: OAuth2Session`
- `x-twitter-active-user: yes`
- `content-type: application/json`
5. Paginate timelines by reading `content.cursorType === "Bottom"` entries and passing
the value back as `variables.cursor` until it stops changing.
### Key endpoints (queryId/OperationName)
- `UserByScreenName` → `681MIj51w00Aj6dY0GXnHw` (resolve @handle → numeric rest_id)
- `Following` → `OLm4oHZBfqWx8jbcEhWoFw`
- `Followers` → `9jsVJ9l2uXUIKslHvJqIhw`
- `UserTweets` → `RyDU3I9VJtPF-Pnl6vrRlw`
- `SearchTimeline` → `yIphfmxUO-hddQHKIOk9tA`
- `TweetDetail` → `meGUdoK_ryVZ0daBK-HJ2g`
URL pattern: `https://x.com/i/api/graphql/<queryId>/<OpName>?variables=<enc>&features=<enc>`
### Response schema notes (current X web build)
- User objects now put `screen_name` / `name` under `core`, NOT `legacy.screen_name`.
twscrape's parser still reads `legacy.screen_name` and returns empty — needs updating.
- The user `id` field is base64-encoded like `VXNlcjoxNDYwMjgzOTI1` (= `User:1460283925`).
Decode with `atob(u.id).split(':')[1]` to get the numeric rest_id. `u.rest_id` may also
be present directly.
- `is_blue_verified` is the verified flag. `legacy.followers_count`, `legacy.description`
still exist under `legacy`.
- Filter timeline entries by `content.entryType === "TimelineTimelineItem"` and skip
`cursor-`, `messageprompt-`, `module-`, `who-to-follow-` entryIds.
### Features dict
Use the full `GQL_FEATURES` block from twscrape's `api.py` — without it X returns
`(336) The following features cannot be null`. Pass it URL-encoded as the `features` param.
### Where things live
- Output CSV: `~/Downloads/utilities/sdand_following.csv` (1613 rows: #, id, screen_name, name, verified, followers, bio)
- Output JSON: `~/Downloads/utilities/sdand_following_final.json` (double-encoded JSON string; parse with `json.loads(json.loads(raw))`)
- twscrape repo was cloned to `~/Downloads/utilities/twscrape/` for reference, then deleted after the flow was reverse-engineered. Re-clone from https://github.com/vladkens/twscrape.git if needed.
## Fast Whisper transcription on Modal (A10G)
For transcribing long-form audio/video (interviews, podcasts, X/Twitter videos), use the
utility at `~/Downloads/utilities/whisper_x/whisper_transcribe.py`. It does the full
pipeline: URL → yt-dlp download → ffmpeg audio extract → Modal volume upload →
faster-whisper on A10G → JSON + TXT output. Validated at **2.3 min wall clock for 65 min
of audio** (no caching at any layer).
### Usage
Shell alias (defined in `~/.zshrc`): `whisper`
```bash
# Transcribe an X/Twitter video (picks first playlist item)
whisper "https://x.com/.../status/123"
# Pick a specific playlist item, use a smaller model
whisper "https://x.com/..." --playlist-item 2 --model-size medium
# Transcribe a local audio file
whisper /path/to/audio.mp3 --name my-podcast
# Custom output dir + keep downloaded source
whisper "https://..." --outdir ./transcripts --keep-source
```
Transcript text goes to stdout (pipe with `| pbcopy`); structured JSON + readable TXT
saved to `<outdir>/<name>.json` and `<outdir>/<name>.txt`.
### Key optimizations (vs naive T4 run that took 11.7 min)
- **A10G GPU** (~8x fp16 throughput vs T4; Modal ~$0.60/hr vs ~$0.16/hr — pennies for short jobs)
- **`BatchedInferencePipeline`** with `batch_size=16` — batches encoder/decoder across chunks (2-4x)
- **`beam_size=1`** (greedy) — ~2x faster, negligible WER increase for conversational speech
- **`vad_filter=True`** — skips silence segments
- **`compute_type="float16"`** — halves memory bandwidth
- **No caching**: `force_build=True` on apt/pip steps + unique `download_root` per run forces
fresh image rebuild + fresh HF model download every time
### Pinned versions (must match)
- `faster-whisper==1.1.1` (provides `BatchedInferencePipeline`)
- `ctranslate2==4.8.0`
- Base image: `nvidia/cuda:12.6.3-cudnn-runtime-ubuntu22.04` (provides `libcublas.so.12`;
`debian_slim` fails with `RuntimeError: Library libcublas.so.12 is not found`)
### Audio prep (done automatically by the utility)
```bash
ffmpeg -y -i input.mp4 -vn -ac 1 -ar 16000 -c:a aac -b:a 64k audio.m4a
```
Mono 16kHz 64kbps AAC — a 65-min video (151 MB stream) becomes ~35 MB audio.
### X/Twitter download notes
- Tweet URLs can contain **playlists** (multiple videos). Use `--playlist-item N` to pick one.
- Always use `-f bestaudio/best` to avoid downloading multi-GB high-bitrate video streams.
- A 65-min interview's video variant can be 2.8+ GB; audio-only is ~63 MB (128 kbps).
### Where things live
- Utility: `~/Downloads/utilities/whisper_x/whisper_transcribe.py`
- Strategy doc: `~/Downloads/utilities/whisper_x/STRATEGY.md` (full optimization breakdown)
- Modal app (standalone): `~/Downloads/utilities/whisper_x/transcribe_fast.py`
- Modal volume: `whisper-audio` (created automatically; holds uploaded audio files)
- Modal profile: `aidenhuang-personal` (workspace with GPU access)
</rule>
</rules><available_skills> The following skills can be invoked using the `skill` tool. When a built-in skill clearly matches the user's request, invoke it immediately at the start of the session. - **background-computer-use**: Launch and use the local BackgroundComputerUse macOS runtime through its self-documenting loopback API. Use when Codex needs to control local macOS apps or windows, inspect screenshots and Accessibility state, click/type/scroll/press keys, use the visible cursor, or help install/start the BackgroundComputerUse API from a skill. (source: /Users/root1/.devin/skills/background-computer-use/SKILL.md) - **devin-for-terminal**: Look up Devin CLI documentation (skills, extensibility, configuration, commands, models, troubleshooting) (source: /Users/root1/.local/share/devin/cli/_versions/2026.8.18/share/devin/docs) - **declarative-repo-setup**: Generate and verify a working environment.yaml (Devin snapshot-setup blueprint) for a repo (source: builtin:drs) </available_skills>
go throught this blog post, are there any artifacts that i can use? https://www.rajan.sh/tiny-interaction-models
I'll fetch that blog post for you.
{
"url": "https://www.rajan.sh/tiny-interaction-models"
}# Web Content from https://www.rajan.sh/tiny-interaction-models
[Rajan Agarwal][1][Home][2][Writing][3][Work][4][X][5][GitHub][6]
# Tiny Interaction Models
Post-training a small open model to process typing as a live stream, so it can look things up while
you write, hold what it finds, and stay quiet the rest of the time.
Rajan Agarwal
Jun 2026
Contents
1. [Why text?][7]
2. [Demos][8]
3. [The held fact][9]
4. [Marks][10]
5. [Doing nothing][11]
6. [The stream][12]
7. [Data][13]
8. [Training][14]
9. [Why not on-policy distillation?][15]
10. [Engineering][16]
11. [What didn't work and what's next][17]
I post-trained Qwen3 30B-A3B into a text interaction model. The policy consumes typing as a
timestamped event stream and emits one action per sampling tick: idle, mark a span, delegate a
lookup, integrate a pending result, skip a stale one, or respond. Supervised fine-tuning on
teacher-labeled streams covers the mechanics. A short DPO pass with interleaved SFT replay covers
when not to act, which is the harder learning problem. The strongest demo has the model issuing a
lookup mid-sentence, holding the returned fact across several ticks, and surfacing it only when the
typing yields an opening.
## Why text?
Thinking Machines released [interaction models][18] in May: models trained natively on continuous
streams, so silence, overlap, and interruption stay in the model's context instead of being handled
by a harness around it. All of their demos are audio or video (posture callouts, live translation,
counting pushups). I wanted to know what the text version looks like.
Text is a bad fit for streaming at first glance. Speech is a stream whether you want it to be or
not; typing is deliberate and you can edit before committing. A model that reacts to every keystroke
would be unusable, and a model that waits for Enter is a regular chatbot. So the real question is
what granularity of streaming input makes sense for text.
The framing that made this tractable is to perceive constantly and act rarely. A person listening to
you processes everything you say in real time and mostly stays quiet, and that is the target here.
The model conditions on the unfinished sentence at every tick, and its most common output is idle.
One scope note before the demos: this system is event-driven, not temporal. Time enters the model as
deltas between events in the prompt, so the model reads time rather than experiencing it. "Remind me
every five seconds to breathe" is exactly what this architecture can't do, and I come back to that
at the end.
## Demos
Each demo has to show three things at once: the model can do the behavior, it does it at the right
time, and it doesn't do it any other time. A capability demo without the last two is a chatbot that
interrupts.
### The held fact
I start typing about a match. The model catches the unresolved fact mid-sentence and delegates a
lookup on its own. The result comes back (Morocco beat the Netherlands on June 30, 2026, a
post-cutoff fact, so the base model cannot know it and the weave is provably tool-sourced), and the
model holds it. Each hold is logged with a reason like "user did not ask to surface the pending
lookup." It surfaces the fact only when my typing gives it an opening.
Sped-up cut: delegate mid-sentence, the fact card arrives while typing continues, several held
beats, then the weave at the opening.
Filming this taught me three requirements. The fact has to post-date the model's training or the
lookup looks staged. The delegate → fetch → hold chain has to land while typing continues, or you've
filmed a turn-based bot with extra steps. And the weave has to wait for an opening, because knowing
something is not a reason to say it.
### Marks
These are the instruction-conditioned behaviors, closest to TML's "tell me when I slouch." Ask it
in-stream to underline filler words and it marks um, basically, kinda as you type them. Ask for
animals and it flags dolphin, heron, narwhal, including species that never appeared in training,
since the base model already knows the category and only had to learn where to point the mark. Say
stop and it stops. Marks render as an underline or a small callout and never take the turn.
The ask arrives in the stream; quokka, kestrel, and wombat get flagged as they're typed.
"Call me out on filler words": um and the multi-word "you know" underlined mid-flow.
### Doing nothing
This is the least filmable demo: the model sits through normal typing, with revisions and pauses and
half-finished thoughts, and does nothing. Close to half of the training decisions are idle and I
kept them at full weight. If you downweight idle you get a model that fidgets.
No instruction active, nothing pending. Every tick still runs; the model keeps choosing idle.
## The stream
The policy conditions on a single serialized event stream and outputs one action per tick:
`<stream_event index=14 <t+650ms> source=user state=active revised=false> so morocco played the
netherlands last night and i think </stream_event> <stream_event index=15 <t+1800ms> source=tool
state=paused> {"result": "Morocco 2, Netherlands 1 (Jun 30, 2026)"} </stream_event>
<PREDICT_THIS_ACTION> `
Keystrokes (as snapshots) and tool results arrive through the same queue. The system prompt states
it directly: the stream itself is the only context.
There are six actions: `idle`, `mark(kind, span, style)`, `delegate(tool, args)`, `integrate(text,
source)`, `skip(reason)`, `respond(text)`. Only `respond` bids for the conversational floor;
everything else renders as an annotation. That split is what lets the model underline a word or drop
in a fact card without taking the turn.
Every event in a synthetic stream carries its ground-truth action, so one stream produces many
training rows, one per decision point; the unit of supervision is the decision.
## Data
Scenario scaffolds generate the situations: typing sliced into 2–6 word chunks with realistic
timing, plus revisions, pauses, and the occasional backchannel. There are scaffold families for
lookup-weave, instruction marks, and quoted instructions (someone mentioning "underline my fillers"
inside a quote should trigger nothing).
The scaffolds also emit heuristic placeholder actions, and the rule of the corpus is that these are
never trained on. From the labeling policy: "heuristic actions are placeholders; do not train on
heuristic actions; a teacher must replace every action." A frontier model relabels every decision
point against the behavior spec: mark only complete units, only under an active instruction;
delegate when the typing reaches an unresolved fact; integrate while it's live; skip once it's
stale.
The corpus is small on purpose, around two thousand teacher-labeled decision points, mixed roughly
2:1 with general assistant data to preserve base behavior. Schema-valid was never enough: a row can
pass every automated check and still be a weird thing to do while someone is typing, so every batch
went through a manual read before it was allowed near training. That review caught things none of
the checks did.
## Training
Stage one is plain SFT on the labeled streams, LoRA on [Tinker][19] on a Qwen3 30B-A3B base.
The SFT model over-integrates. It surfaces the fetched fact even after the moment has passed,
because the teacher's labels do the same thing. Probing the teacher directly gave me the finding the
rest of the recipe depends on: the teacher never generates the skip action, but it recognizes it
reliably. Ask it to label a stale-fact situation and it integrates; show it integrate vs skip as a
pair and it picks skip essentially every time. Generating a behavior and recognizing it are
different capabilities, and imitation only transfers the first. The tempting action is also almost
never wrong. The fetched score is correct; the word really is an animal. In a generated set of
appropriateness pairs, a correctness-based reward preferred the intrusive action in every single
case. The distinction the model needs is wanted vs unwanted, and only pairwise preference carries
that.
So stage two is a short DPO pass on pairs where the rejected branch is correct but unwanted,
starting from the SFT checkpoint, with a small amount of low-learning-rate SFT replay mixed in so
stage one doesn't get forgotten. The whole pass is tens of steps and a few minutes of wall clock.
## Why not on-policy distillation?
I skipped Tinker's [OPD recipe][20] deliberately. OPD's implicit reward is the teacher's likelihood
on the student's own tokens: it pulls the student toward whatever the teacher would have generated
from each state the student visits. But the teacher here generates over-integration. Distill toward
its per-token preferences and you transfer that eagerness with high fidelity. You would be teaching,
densely and efficiently, the exact behavior the preference stage exists to remove. OPD transfers
what the teacher does; I needed what the teacher approves of, and the two split apart at the
appropriateness boundary.
There's also a shape mismatch. OPD works best when the output is long and every token carries
signal, like reasoning chains or code. Here a tick's output is a short grammar-constrained action
where most tokens are forced, and the learnable part is one discrete choice (idle vs mark vs
integrate vs skip) under a heavy idle prior. Token-level KL mostly grades tokens the grammar already
fixed; preference pairs put all of the gradient on the choice. None of this is a knock on OPD. For
moving capability into a small model it's still the best tool I know, and it may come back for the
delegate-discipline work below. It just has nothing to say about appropriateness, because there is
no capability gap there: the SFT model is fully capable of skipping, it just doesn't prefer to.
## Engineering
The runtime emulates a full-duplex model with a turn-based one, under one rule throughout: the model
decides, the runtime times and executes.
**Time … (90 chars truncated)
… (91 lines truncated)
<truncation_notice>
Full output written to: /var/folders/d9/mzhyr7lx6xbf236j5ll9v_300000gn/T/devin-overflows-501/c1286acc/content.txt
</truncation_notice>{
"file_path": "/var/folders/d9/mzhyr7lx6xbf236j5ll9v_300000gn/T/devin-overflows-501/c1286acc/content.txt"
}<file-view path="/var/folders/d9/mzhyr7lx6xbf236j5ll9v_300000gn/T/devin-overflows-501/c1286acc/content.txt" start_line="1" end_line="270" total_lines="270">
1|# Web Content from https://www.rajan.sh/tiny-interaction-models
2|
3|[Rajan Agarwal][1][Home][2][Writing][3][Work][4][X][5][GitHub][6]
4|
5|# Tiny Interaction Models
6|
7|Post-training a small open model to process typing as a live stream, so it can look things up while
8|you write, hold what it finds, and stay quiet the rest of the time.
9|
10|Rajan Agarwal
11|Jun 2026
12|Contents
13|1. [Why text?][7]
14|2. [Demos][8]
15|3. [The held fact][9]
16|4. [Marks][10]
17|5. [Doing nothing][11]
18|6. [The stream][12]
19|7. [Data][13]
20|8. [Training][14]
21|9. [Why not on-policy distillation?][15]
22|10. [Engineering][16]
23|11. [What didn't work and what's next][17]
24|
25|I post-trained Qwen3 30B-A3B into a text interaction model. The policy consumes typing as a
26|timestamped event stream and emits one action per sampling tick: idle, mark a span, delegate a
27|lookup, integrate a pending result, skip a stale one, or respond. Supervised fine-tuning on
28|teacher-labeled streams covers the mechanics. A short DPO pass with interleaved SFT replay covers
29|when not to act, which is the harder learning problem. The strongest demo has the model issuing a
30|lookup mid-sentence, holding the returned fact across several ticks, and surfacing it only when the
31|typing yields an opening.
32|
33|## Why text?
34|
35|Thinking Machines released [interaction models][18] in May: models trained natively on continuous
36|streams, so silence, overlap, and interruption stay in the model's context instead of being handled
37|by a harness around it. All of their demos are audio or video (posture callouts, live translation,
38|counting pushups). I wanted to know what the text version looks like.
39|
40|Text is a bad fit for streaming at first glance. Speech is a stream whether you want it to be or
41|not; typing is deliberate and you can edit before committing. A model that reacts to every keystroke
42|would be unusable, and a model that waits for Enter is a regular chatbot. So the real question is
43|what granularity of streaming input makes sense for text.
44|
45|The framing that made this tractable is to perceive constantly and act rarely. A person listening to
46|you processes everything you say in real time and mostly stays quiet, and that is the target here.
47|The model conditions on the unfinished sentence at every tick, and its most common output is idle.
48|
49|One scope note before the demos: this system is event-driven, not temporal. Time enters the model as
50|deltas between events in the prompt, so the model reads time rather than experiencing it. "Remind me
51|every five seconds to breathe" is exactly what this architecture can't do, and I come back to that
52|at the end.
53|
54|## Demos
55|
56|Each demo has to show three things at once: the model can do the behavior, it does it at the right
57|time, and it doesn't do it any other time. A capability demo without the last two is a chatbot that
58|interrupts.
59|
60|### The held fact
61|
62|I start typing about a match. The model catches the unresolved fact mid-sentence and delegates a
63|lookup on its own. The result comes back (Morocco beat the Netherlands on June 30, 2026, a
64|post-cutoff fact, so the base model cannot know it and the weave is provably tool-sourced), and the
65|model holds it. Each hold is logged with a reason like "user did not ask to surface the pending
66|lookup." It surfaces the fact only when my typing gives it an opening.
67|
68|Sped-up cut: delegate mid-sentence, the fact card arrives while typing continues, several held
69|beats, then the weave at the opening.
70|
71|Filming this taught me three requirements. The fact has to post-date the model's training or the
72|lookup looks staged. The delegate → fetch → hold chain has to land while typing continues, or you've
73|filmed a turn-based bot with extra steps. And the weave has to wait for an opening, because knowing
74|something is not a reason to say it.
75|
76|### Marks
77|
78|These are the instruction-conditioned behaviors, closest to TML's "tell me when I slouch." Ask it
79|in-stream to underline filler words and it marks um, basically, kinda as you type them. Ask for
80|animals and it flags dolphin, heron, narwhal, including species that never appeared in training,
81|since the base model already knows the category and only had to learn where to point the mark. Say
82|stop and it stops. Marks render as an underline or a small callout and never take the turn.
83|
84|The ask arrives in the stream; quokka, kestrel, and wombat get flagged as they're typed.
85|
86|"Call me out on filler words": um and the multi-word "you know" underlined mid-flow.
87|
88|### Doing nothing
89|
90|This is the least filmable demo: the model sits through normal typing, with revisions and pauses and
91|half-finished thoughts, and does nothing. Close to half of the training decisions are idle and I
92|kept them at full weight. If you downweight idle you get a model that fidgets.
93|
94|No instruction active, nothing pending. Every tick still runs; the model keeps choosing idle.
95|
96|## The stream
97|
98|The policy conditions on a single serialized event stream and outputs one action per tick:
99|
100|`<stream_event index=14 <t+650ms> source=user state=active revised=false> so morocco played the
101|netherlands last night and i think </stream_event> <stream_event index=15 <t+1800ms> source=tool
102|state=paused> {"result": "Morocco 2, Netherlands 1 (Jun 30, 2026)"} </stream_event>
103|<PREDICT_THIS_ACTION> `
104|
105|Keystrokes (as snapshots) and tool results arrive through the same queue. The system prompt states
106|it directly: the stream itself is the only context.
107|
108|There are six actions: `idle`, `mark(kind, span, style)`, `delegate(tool, args)`, `integrate(text,
109|source)`, `skip(reason)`, `respond(text)`. Only `respond` bids for the conversational floor;
110|everything else renders as an annotation. That split is what lets the model underline a word or drop
111|in a fact card without taking the turn.
112|
113|Every event in a synthetic stream carries its ground-truth action, so one stream produces many
114|training rows, one per decision point; the unit of supervision is the decision.
115|
116|## Data
117|
118|Scenario scaffolds generate the situations: typing sliced into 2–6 word chunks with realistic
119|timing, plus revisions, pauses, and the occasional backchannel. There are scaffold families for
120|lookup-weave, instruction marks, and quoted instructions (someone mentioning "underline my fillers"
121|inside a quote should trigger nothing).
122|
123|The scaffolds also emit heuristic placeholder actions, and the rule of the corpus is that these are
124|never trained on. From the labeling policy: "heuristic actions are placeholders; do not train on
125|heuristic actions; a teacher must replace every action." A frontier model relabels every decision
126|point against the behavior spec: mark only complete units, only under an active instruction;
127|delegate when the typing reaches an unresolved fact; integrate while it's live; skip once it's
128|stale.
129|
130|The corpus is small on purpose, around two thousand teacher-labeled decision points, mixed roughly
131|2:1 with general assistant data to preserve base behavior. Schema-valid was never enough: a row can
132|pass every automated check and still be a weird thing to do while someone is typing, so every batch
133|went through a manual read before it was allowed near training. That review caught things none of
134|the checks did.
135|
136|## Training
137|
138|Stage one is plain SFT on the labeled streams, LoRA on [Tinker][19] on a Qwen3 30B-A3B base.
139|
140|The SFT model over-integrates. It surfaces the fetched fact even after the moment has passed,
141|because the teacher's labels do the same thing. Probing the teacher directly gave me the finding the
142|rest of the recipe depends on: the teacher never generates the skip action, but it recognizes it
143|reliably. Ask it to label a stale-fact situation and it integrates; show it integrate vs skip as a
144|pair and it picks skip essentially every time. Generating a behavior and recognizing it are
145|different capabilities, and imitation only transfers the first. The tempting action is also almost
146|never wrong. The fetched score is correct; the word really is an animal. In a generated set of
147|appropriateness pairs, a correctness-based reward preferred the intrusive action in every single
148|case. The distinction the model needs is wanted vs unwanted, and only pairwise preference carries
149|that.
150|
151|So stage two is a short DPO pass on pairs where the rejected branch is correct but unwanted,
152|starting from the SFT checkpoint, with a small amount of low-learning-rate SFT replay mixed in so
153|stage one doesn't get forgotten. The whole pass is tens of steps and a few minutes of wall clock.
154|
155|## Why not on-policy distillation?
156|
157|I skipped Tinker's [OPD recipe][20] deliberately. OPD's implicit reward is the teacher's likelihood
158|on the student's own tokens: it pulls the student toward whatever the teacher would have generated
159|from each state the student visits. But the teacher here generates over-integration. Distill toward
160|its per-token preferences and you transfer that eagerness with high fidelity. You would be teaching,
161|densely and efficiently, the exact behavior the preference stage exists to remove. OPD transfers
162|what the teacher does; I needed what the teacher approves of, and the two split apart at the
163|appropriateness boundary.
164|
165|There's also a shape mismatch. OPD works best when the output is long and every token carries
166|signal, like reasoning chains or code. Here a tick's output is a short grammar-constrained action
167|where most tokens are forced, and the learnable part is one discrete choice (idle vs mark vs
168|integrate vs skip) under a heavy idle prior. Token-level KL mostly grades tokens the grammar already
169|fixed; preference pairs put all of the gradient on the choice. None of this is a knock on OPD. For
170|moving capability into a small model it's still the best tool I know, and it may come back for the
171|delegate-discipline work below. It just has nothing to say about appropriateness, because there is
172|no capability gap there: the SFT model is fully capable of skipping, it just doesn't prefer to.
173|
174|## Engineering
175|
176|The runtime emulates a full-duplex model with a turn-based one, under one rule throughout: the model
177|decides, the runtime times and executes.
178|
179|**Time slicing.** The browser samples the textarea on a cadence (350ms after the first keystroke,
180|650ms while typing continues, 1.8s once you pause) and POSTs full snapshots rather than deltas. The
181|server appends each snapshot as a timestamped event and re-renders the whole history into the stream
182|every tick. Snapshots make revisions free (the newest snapshot is simply the current truth) and make
183|the stream robust to dropped requests. Inference is serialized with a busy flag and a one-slot
184|pending queue: if a tick is running when new snapshots arrive, they collapse into the slot. Under
185|load the stream gets coarser, but it never blocks the textarea.
186|
187|**Backchanneling.** `respond` is suppressed while the user holds the floor mid-typing; marks, fact
188|cards, and weaves render as annotations that don't take the turn. Around the policy there is a thin
189|license layer: the in-stream instruction overrides the model's own labels (no marking animals if you
190|asked for fillers), instructions that only appear inside quotes go straight to idle, and everything
191|the layer blocks lands in a hidden audit trail instead of disappearing. The screen shows one quiet
192|line per executed action; the audit trail shows everything the model tried. Every demo take was
193|verified against that trail. The trail is also where I found out the model was often cleaner than my
194|scaffolding: at natural typing speed the policy emits well-formed spans mid-sentence, and most of
195|the junk in early takes came from my own recovery heuristics.
196|
197|**Speed.** The demo checkpoint started as a hosted LoRA running at minutes per tick. I merged the
198|adapter into the base, quantized to 4 bits for local inference, and added a prefix KV cache:
199|consecutive ticks share almost the entire prompt, so each tick reuses the longest common token
200|prefix and prefills only the delta. Tick latency went from ~15 seconds to ~1 second. This is a cheap
201|imitation of what real interaction models get natively, where state is the accumulated KV and each
202|new slice is a marginal update to it.
203|
204|## What didn't work and what's next
205|* **Confabulation under latency.** With a 10-second tool, one discarded take shows the model weaving
206| in "the Netherlands won 2-1" before the lookup returned, with the wrong team and the wrong score.
207| This is the whole case for tool-sourced weaves and for showing provenance in the UI.
208|* **Re-delegation.** The demo checkpoint sometimes fires a second lookup while the first is still
209| pending; you can see duplicate fact cards in one shipped take. Delegate discipline is a timing
210| judgment, which puts it in the preference tier I haven't trained yet.
211|* **Skip is flaky on camera.** It passes repeatably at the API level and misses on film more than it
212| should. Skip is the thinnest behavior in the data by an order of magnitude, and it lives in the
213| preference tier where data costs the most to make.
214|* **No user marks.** Several testers instinctively tried to mark spans for the model. The event
215| schema has no user action type; marks belong to the assistant. Fixing this is a schema and corpus
216| change, not a training run.
217|
218|The event-driven line is also real. Everything the system does is a reaction to something entering
219|the queue; nothing originates at a moment. Recurring timing ("every five seconds") would need timer
220|events as first-class stream citizens, a nudge action that doesn't bid for the floor, and a corpus
221|that currently has zero timer scenarios. Even then the loop resolves in seconds, not milliseconds.
222|TML gets time as a native dimension of the model; a tick-based text system only reads the clock.
223|
224|Next is mostly preference data: delegate discipline, weave timing, and enough skip pairs that
225|restraint films as reliably as it evals. The runtime also still carries context scaffolding (lenses,
226|guard rails) that the trained policy doesn't need and the demos don't use, and it should either be
227|removed or studied properly.
228|
229|Rajan Agarwal · [X][21] [LinkedIn][22] [GitHub][23]
230|
231|## Citation
232|
233|Please cite this work as:
234|
235|`Rajan Agarwal, "Tiny Interaction Models", rajan.sh, Jun 2026. https://www.rajan.sh/tiny-interaction
236|-models`
237|
238|Or use the BibTeX citation:
239|
240|`@misc{agarwal2026tinyinteractionmodels,
241| author = {Rajan Agarwal},
242| title = {Tiny Interaction Models},
243| year = {2026},
244| howpublished = {rajan.sh},
245| note = {https://www.rajan.sh/tiny-interaction-models},
246|}`
247|
248|[1]: /
249|[2]: /
250|[3]: /writing
251|[4]: /work
252|[5]: https://x.com/_rajanagarwal
253|[6]: https://github.com/rajansagarwal
254|[7]: #why-text
255|[8]: #demos
256|[9]: #the-held-fact
257|[10]: #marks
258|[11]: #doing-nothing
259|[12]: #the-stream
260|[13]: #data
261|[14]: #training
262|[15]: #why-not-on-policy-distillation
263|[16]: #engineering
264|[17]: #what-didnt-work-and-whats-next
265|[18]: https://thinkingmachines.ai/blog/interaction-models/
266|[19]: https://thinkingmachines.ai/tinker/
267|[20]: https://thinkingmachines.ai/blog/on-policy-distillation/
268|[21]: https://x.com/_rajanagarwal
269|[22]: https://www.linkedin.com/in/rajansagarwal/
270|[23]: https://github.com/rajansagarwal
</file-view>Great read. Here's a summary of what's directly usable from the post:
The post gives you the exact serialization schema for the event stream:
<stream_event index=14 <t+650ms> source=user state=active revised=false>
so morocco played the netherlands last night and i think
</stream_event>
<stream_event index=15 <t+1800ms> source=tool state=paused>
{"result": "Morocco 2, Netherlands 1 (Jun 30, 2026)"}
</stream_event>
<PREDICT_THIS_ACTION>
You could use this format as-is to build synthetic training data or to prompt a frontier model in an SFT labeling pipeline.
idle
mark(kind, span, style)
delegate(tool, args)
integrate(text, source)
skip(reason)
respond(text)
This is a complete, minimal action space you can implement directly — as a grammar-constrained output format or just a structured text format.
This is a concrete, justified cadence you can plug into any browser-side textarea listener.
The labeling policy rule is directly actionable:
"heuristic actions are placeholders; do not train on heuristic actions; a teacher must replace every action."
And the DPO framing: use the teacher as a discriminator, not a generator — show it (integrate, skip) pairs and it reliably picks the right one even though it never generates skip.
This took tick latency from ~15s → ~1s on a local 30B model.
The most immediately usable thing is probably the stream format + action grammar — you could scaffold a dataset generator and use a frontier model (GPT-4o, Claude) as the teacher labeler following the behavior spec described.