Skip to content

agustif/ti

Repository files navigation

ti-code

Effect v4 native AI coding agent. The public npm CLI package is ti-agent, and it installs the ti binary.

Current state

  • Core: core ships the agent contract, domain models, plugin contracts, and the bundled ti-core-tools default tool plugin.
  • LLM: llm exposes a provider-neutral LanguageModel service, stream events, token estimation helpers, and the provider-neutral AgentRuntimeLayer.
  • Providers: packages/providers (package ti-code-providers) includes OpenAI streaming, ChatGPT auth/model helpers, and a deferred Anthropic adapter.
  • Sessions: packages/sessions (package ti-code-sessions) persists append-only sessions under .ti/sessions and exposes a SessionManager service.
  • CLI: ti-agent opens the interactive composer by default and provides login, logout, auth, models, chat, resume, and tool commands via the ti binary.
  • Plugins/Skills: first-class but minimal; static PluginHost and SkillHost contracts cover bundled tools, markdown skills, and a small Codex-style SKILL.md compatibility path while optional domains such as diagrams stay outside the default core binary.

The active implementation tracker lives in docs/planning/open-epics-tracker.md.

Quick start

pnpm install
pnpm build
pnpm test
pnpm lint

If just is installed, the root Justfile is the local command index:

just
just check
just dev
just dupes

Install the CLI

The published CLI package is ti-agent; it installs the ti binary. That npm path is useful for development and package-manager installs, but it still requires a JavaScript runtime on the target machine. The public npm package set is ti-agent, ti-code-core, ti-code-llm, ti-code-providers, and ti-code-sessions. The repo-local @effect/platform-quickjs and @effect/platform-llrt packages stay private until/unless they are coordinated with the Effect project.

One-command install:

curl -fsSL https://raw.githubusercontent.com/agustif/ti/main/install.sh | sh
npm install -g ti-agent
ti --version
ti auth

For one-off runs without a global install:

pnpm dlx ti-agent auth
npx ti-agent auth
bunx ti-agent auth

Pin a version when using the install script:

curl -fsSL https://raw.githubusercontent.com/agustif/ti/main/install.sh | TI_VERSION=0.1.8 sh

Local development can run the same binary after building:

pnpm build
node apps/cli/dist/index.js auth

Self-contained runtime binaries

GitHub releases publish standalone binaries for users who should not need Node, Bun, Deno, or pnpm installed. Download the release asset that matches the target platform, make it executable, and run it directly:

curl -L -o ti https://github.com/agustif/ti/releases/latest/download/ti-quickjs-host-darwin-arm64
chmod +x ti
./ti probe
./ti login chatgpt
./ti chat --provider chatgpt hi

The release workflow builds these required platforms on tag pushes:

Platform Status
darwin-arm64 Required
darwin-x64 Required
linux-arm64 Required
linux-x64 Required
windows-x64 Experimental until the native QuickJS host/linker path is ported

Runtime status

Current darwin-arm64 local release artifact sizes:

Runtime asset Self-contained Size Current status
ti-quickjs-host-darwin-arm64 Yes 1.5 MB Recommended smallest runtime. probe, models, chat --provider chatgpt, binary golden tests, and interactive smoke pass. Uses the custom QuickJS host with native libcurl-backed streaming HTTP.
ti-quickjs-ng-darwin-arm64 Yes, with system curl for network POST fallback 1.6 MB probe, models, chat --provider chatgpt, binary golden tests, and interactive smoke pass. ChatGPT POST/SSE is buffered through a curl subprocess because stock QuickJS-ng only exposes std.urlGet for GET.
ti-llrt-darwin-arm64 Yes 10.2 MB Fast and small compared with Node/Bun/Deno. probe and noninteractive golden tests pass. Default interactive mode is intentionally blocked because LLRT does not provide the needed interactive terminal surface. chat --provider chatgpt currently fails because LLRT's fetch response does not expose a readable body.getReader() stream.
ti-bun-darwin-arm64 Yes 60.7 MB chat --provider chatgpt and binary/interactive smoke tests pass. Uses the Bun runtime and @effect/platform-bun, so it is much larger than QuickJS/LLRT.
ti-bun-bytecode-darwin-arm64 Yes 66.5 MB Same functional surface as Bun, with Bun bytecode packaging. Larger than regular Bun in the current build.
ti-node-sea-darwin-arm64 Yes 127.0 MB chat --provider chatgpt and binary/interactive smoke tests pass. This is the true self-contained Node comparison and includes the Node runtime cost.
ti-deno-darwin-arm64 Yes 130.2 MB chat --provider chatgpt and binary/interactive smoke tests pass. Currently consumes the Node-compatible portable final bundle because there is no repo-owned @effect/platform-deno package yet.
ti-node-js.mjs No 294 kB JavaScript bundle baseline only. Requires an installed Node runtime and is not a standalone binary.

Release assets also include MANIFEST.json, SIZES.tsv, and SHA256SUMS.txt so size and checksum comparisons do not depend on README tables staying fresh.

In the table above, "binary golden tests" means the runtime can execute the same portable CLI scenarios and produce the same normalized output. "Interactive smoke" means the runtime can start the default interactive entrypoint and render the initial terminal surface; it is not claiming full long-running interactive parity for every terminal edge case yet.

What still does not have full parity

  • The shared agent loop is live for CLI/TUI chat, direct tool calls, Code Mode tool calls, and queued steering while a run is active. Provider-managed continuation state, approval interruptions, cancellation, and compaction are still evolving.
  • LLRT does not yet have full CLI parity: no interactive terminal support, and ChatGPT streaming needs a readable fetch body adapter or a small host bridge.
  • Stock QuickJS-ng works for ChatGPT now, but its POST/SSE path depends on a curl subprocess and buffers the response. The custom QuickJS host is the smaller fully integrated streaming path.
  • Windows runtime artifacts are built as an experimental matrix lane while the native QuickJS host C/linker path is made portable.
  • The npm package install remains the Node-runtime distribution path; the no-Node/no-Bun story is the GitHub release binaries.

Workspace layout

pi-effect/
├── packages/
│   ├── core/        # package: ti-code-core; domain models, agent contract, bundled tool plugin
│   ├── llm/         # package: ti-code-llm; LanguageModel service, stream events, agent runtime
│   ├── providers/   # package: ti-code-providers; OpenAI, ChatGPT auth/model helpers, Anthropic adapter
│   └── sessions/    # package: ti-code-sessions; append-only session storage and session manager
├── apps/
│   └── cli/                   # Terminal CLI and interactive entry point
└── docs/                      # ADRs, RFCs, guides, planning, and historical reviews

Package summaries

core

  • Agent service with run, runStream, and active-run steer
  • Tools.Registry service
  • Bundled default ti-core-tools plugin: read, write, edit, apply_patch, bash, py, code, and preload_cli_tool
  • Shared message, tool, session, and error types

llm

  • LanguageModel service
  • generateStream, generate, and estimateTokens
  • StreamEvent model and helpers for collecting content / usage
  • Default test layer for deterministic unit tests

ti-code-providers

  • OpenAI Chat Completions SSE provider
  • ChatGPT auth storage and model discovery helpers
  • Deferred Anthropic adapter for the first vertical slice

ti-code-sessions

  • Append-only JSONL session persistence
  • Session metadata derived from messages
  • SessionManager layer for create / append / get / list

ti-agent

Main commands:

ti
ti login chatgpt
ti logout chatgpt
ti auth
ti models chatgpt
ti chat [--provider <openai|chatgpt>] [--session <id>] [--model <model>] <prompt>
ti resume --last
ti tool <read|write|edit|apply_patch|bash|py|code> '<json-args>'

Development commands

# Show the repo-local command index
just

# Build all packages
pnpm build
just build

# Run all tests
pnpm test
just test

# Lint the workspace
pnpm lint
just lint

# Detect copy/paste drift in source, tests, and repo scripts
pnpm dupes
pnpm dupes:report
just dupes
just dupes-report

# Run the local pre-release gate
just release-check

# Auto-fix lintable issues and verify the workspace
pnpm format
pnpm format:check
just format
just format-check

The Justfile is intentionally a thin wrapper over pnpm/turbo scripts, so it is a discoverable local command index rather than a second build system. Its duplication recipes use the same tuned clone detector as pnpm dupes; the threshold is a growth-phase guardrail, not a claim that every current clone should be collapsed immediately. just release-check runs lint, typecheck, tests, build, the runtime-final bundle build, and npm package dry-runs before tagging or publishing.

Technology stack

  • Runtime: Effect v4 beta (effect@4.0.0-beta.70)
  • Language: TypeScript 5.9+ in strict mode
  • Package manager: pnpm 11.2.2+
  • Build system: Turborepo
  • Testing: Vitest with @effect/vitest
  • Linting: Rslint plus repo guard scripts for Effect-native boundaries and type assertions

Documentation

Notes

  • The Agent runtime is shared by the CLI interactive path and the runtime probe. It replays local session messages today; OpenAI previous_response_id continuation and compaction remain planned provider-state work.
  • docs/reports/ and docs/review/ contain historical snapshots retained for reference.
  • Optional domains such as Mermaid/SVG/terminal-image rendering stay outside default core; if they return, they should live in a small plugin/skill area rather than the main binary.
  • Agent budgets are policy-driven rather than globally hard-capped; any tighter stop condition belongs to an orchestrator or subagent policy.
  • packages/core, packages/llm, packages/providers, and packages/sessions are the current source folders; the package names remain ti-code-*.
  • There is no web app in the current workspace.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors