Claude Code powers new jensagent AI tool on GitHub, boosting automation
Photo by Possessed Photography on Unsplash
Claude Code now powers the jensagent tool on GitHub, letting developers automate tasks via a simple API or interactive TUI; the library lets users programmatically send prompts—e.g., “Build a hello‑world web app”—and receive full assistant responses, reports indicate.
Key Facts
- •Key company: Claude Code
Claude Code’s integration with the open‑source jensagent library marks the first publicly available SDK that lets developers invoke Anthropic’s Claude model as a programmable “agent” rather than a simple completion endpoint. The repository on GitHub (jensb1/jensagent) shows a thin wrapper—`import { Claude } from "./src/claude"`—that spins up a hidden pseudo‑terminal (PTY) running Claude Code, then communicates via a Unix‑domain socket and a session‑file tailer. According to the project’s README, the API supports two interaction modes: a high‑level `send()` call that returns a full response object, and a streaming `stream()` generator that yields incremental events such as `text`, `tool_use`, and `question` prompts (see the “API reference” section). This dual approach gives developers the choice between batch‑style automation and real‑time, interactive workflows.
The core of the driver is the `ClaudeDriver` module, which manages PTY lifecycle, watches the `~/.claude/projects/*.jsonl` session files for new messages, and forwards idle‑signal hooks (Stop, Notification, PreToolUse) to the driver via a Unix socket. The architecture diagram in the repo illustrates how the driver sits between the Claude API layer and the hidden PTY that runs Claude Code’s TUI. When a user calls `claude.send("Build a hello world web app")`, the driver writes the prompt into the PTY, waits for Claude’s response, and then parses the JSONL output into a structured `Response` object containing `text`, `toolCalls`, and the raw `messages`. The same flow can be observed in the streaming example, where each `event` is typed (e.g., `{type:"text", text:"…"}`) and can be processed as it arrives.
A notable feature is the handling of Claude’s “AskUserQuestion” prompts. The library exposes an `onQuestion` callback that receives an array of `Question` objects; the default implementation auto‑selects the first option, but developers can supply custom logic to answer or dismiss the dialog. According to the source code comments, answers are sent by dismissing Claude’s dialog (Escape) and then posting the answer as a follow‑up message, rather than interacting directly with the TUI. While this workaround enables fully automated pipelines, the README flags it as a known limitation, suggesting future revisions may streamline the interaction.
The tool also ships an Ink‑based terminal UI (`src/tui.tsx`) that can be launched with `bun index.ts`. This interactive mode mirrors the programmatic API: users type messages, press Enter, and respond to numbered options when Claude asks questions. Pressing Escape or typing `/q` exits the session, and the underlying PTY is cleaned up with `claude.destroy()`. VentureBeat’s coverage of the recent Claude Code update notes that this “most‑requested user feature” – the ability to drive Claude from code – was added to address developer demand for batch‑style orchestration (VentureBeat). The same article highlights that Claude Code now runs on Anthropic’s managed infrastructure, allowing parallel jobs across web and mobile environments, which aligns with the jensagent driver’s design to launch multiple independent Claude processes per project directory.
From an engineering perspective, jensagent demonstrates a pragmatic solution to a gap in Anthropic’s official SDKs: the lack of a native “agent” abstraction that can invoke tools, handle follow‑up questions, and persist state across turns. By leveraging Claude Code’s PTY interface and exposing it through a clean TypeScript API, the library enables developers to embed sophisticated AI‑driven workflows—such as generating boilerplate code, writing tests, or orchestrating multi‑step deployments—directly into CI pipelines or VS Code extensions. The open‑source nature of the project also invites community contributions to address the current limitations around question handling and to extend support for additional Claude‑specific tool calls.
Sources
This article was created using AI technology and reviewed by the SectorHQ editorial team for accuracy and quality.