Skip to content
biyuehuPublic

About

A lightweight, DSL-driven AI agent for file operations, code modification, and command execution — designed for web and client-side AI assistants.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Repository files navigation

Web Agent CI npm version crates.io License: GPL-3.0 Node.js Bun Rust

Web Agent Logo

Use the Claude, ChatGPT, DeepSeek, or Gemini web chat you already pay for as a local coding agent on your own files — no API key, no API bill.

webagent bridges your browser AI chat and your local repository: pack your files into the clipboard, paste into any web chat, copy the AI's structured response, and apply edits locally with interactive confirmation and Git-based undo.

Package naming note: This project is published as webagent on crates.io (Rust) and webagentx on npm (Node/Bun) due to registry naming availability. Both provide the same CLI and install the short aliases wa and ro.

The 15-Second Loop

Web Agent 15-Second Loop Demo
1. webagent pack src/auth.rs --goal "Fix expiry"          # Packs prompt + files -> clipboard
2. Paste into Claude / ChatGPT / DeepSeek web chat        # AI replies with structured edits
3. Copy the AI's response                                 # (TUI loop auto-detects clipboard)
4. webagent apply                                         # Reviews & applies edits locally

Safety by Default

Running commands or modifying files from AI output shouldn't require blind trust:

  • Explicit confirmation (default without --allow-all): Every dangerous operation (DELETE and COMMAND) pauses and asks for interactive confirmation before executing. Nothing is deleted or run in your shell unless you approve it (or explicitly pass --allow-all).
  • Automatic Git undo: Before applying changes, webagent saves a reverse Git patch snapshot in .git/romi/undo (disable with --no-undo). Run webagent undo anytime to roll back.
  • Read-before-write guard: If an AI response mixes READ/EXISTS and write operations on the same file in a single batch, the batch is rejected so edits aren't applied against stale context.

How It Compares

  • vs. Repomix: Repomix packs your codebase into a prompt and stops there. webagent packs context and applies the AI's edits, executes approved commands, copies outputs back for the next turn, and tracks undo snapshots.
  • vs. Aider (--copy-paste): Aider requires a Python environment and its own agent workflow. webagent is a lightweight standalone CLI (single Rust binary or Node/Bun package) with a clipboard-watching TUI loop built for any web chat.

Why Web Agent?

Most AI coding assistants are either:

  • Cloud-based: Require API keys, network access, and recurring per-token billing
  • Heavy: Packed with features you don't need, slow to start

Web Agent is different:

  • Works with any web AI — Use the browser chat you already have (Claude, ChatGPT, DeepSeek, Gemini, etc.)
  • Zero extra cost — No API calls, no token billing
  • Instant — Runs locally as a native Rust binary or via Bun/Node, no server setup
  • Transparent — You see every file change and confirm dangerous commands before they execute
  • Your data stays yours — No telemetry, no cloud sync, no third-party servers

Features

  • DSL-based operations — File create, replace, delete, read, move, copy, write, append, prepend, exists, and command execution
  • Markdown or plain-text DSL — Works with any AI output format
  • Interactive TUI — Monitor clipboard, trigger operations automatically
  • Git integration — Undo support, diff preview, .gitignore awareness
  • Zero dependencies for the core runtime — Built with Bun, runs fast

Installation

Rust (Cargo)

cargo install webagent

This installs the webagent binary along with the shorter aliases wa and ro.

Node / Bun

bun install -g webagentx
npm install -g webagentx
pnpm add -g webagentx
yarn global add webagentx

Direct usage (no install)

bunx webagentx
npx webagentx
pnpm dlx webagentx
yarn dlx webagentx

Usage

After installation, the following commands are available (you can use webagent, webagentx, or the short aliases wa / ro):

Command Alias Description
webagent ro, wa Enter interactive TUI / clipboard monitor mode
webagent apply [file] ap Apply Markdown / Plain DSL blocks
webagent pack [...globs] pa Pack context and project tree for AI
webagent undo — Undo last change using reverse git patch
webagent version — Show version
# Equivalent usages
webagentx apply
webagentx ap

Apply DSL from clipboard

webagentx apply
webagentx ap

Apply from file

webagentx apply ./instructions.md
webagentx ap ./instructions.md

Pack context for AI

webagentx pack ./src/**/*.ts --goal "Refactor the auth module"
webagentx pa ./src/**/*.ts

Interactive TUI

webagentx loop
webagentx l

Inside the TUI:

Command Description
ap [--allow-all] Apply DSL from clipboard
pa <globs...> [--no-tree] [--plain] Pack context to clipboard
$ <shell> Execute a shell command
help Show TUI commands
exit Exit TUI mode

Undo last change

webagentx undo

AGENT.txt

Place an AGENT.txt file in your project root to inject custom instructions into every pack. The file supports inline directives:

  • !PRESET — Load the default preset from the package
  • !https://example.com/file.txt — Fetch and include remote content
  • !/path/to/file.txt — Include a local file (absolute or relative to project root)

Directives can be nested. Circular references are detected and ignored.

Example:

You are a specialized Rust reviewer.

!PRESET

!https://raw.githubusercontent.com/rust-lang/rust/master/README.md

!./docs/internal-rules.md

How It Works

  1. Pack: webagent pack collects your code context, project structure, and system instructions into a prompt
  2. AI: Copy the prompt to your browser AI (Claude, ChatGPT, DeepSeek, Gemini, etc.)
  3. Apply: The AI responds with DSL operations — copy that response, run webagent apply
  4. Review: Confirm dangerous operations (DELETE and COMMAND) before execution

The workflow is clipboard-based and works with any AI that can follow structured output formats.

Options

apply

Option Description
--stdin Read from standard input instead of clipboard
--allow-all Skip confirmation for dangerous operations
--plain Use plain-text DSL instead of Markdown
--no-undo Disable undo snapshot generation

pack

Option Description
--goal <text> Task goal for the AI
--plain Use plain-text DSL instead of Markdown
--no-tree Exclude project directory tree
--no-diff Exclude Git diff of focus files

undo

Option Description
--list List available undo snapshots

Configuration

Biome

The project uses Biome for linting and formatting:

bun fix

Lefthook

Pre-commit hooks run formatting and tests automatically:

bun init  # Installs lefthook hooks

Development

TypeScript (Bun)

bun install
bun run build
bun test

Rust (Cargo)

cargo build
cargo test
cargo clippy -- -D warnings

License

GPL-3.0

Author

ArimuraSena i@arimuraromi.com

About

A lightweight, DSL-driven AI agent for file operations, code modification, and command execution — designed for web and client-side AI assistants.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages