# Attach AI Agent Context

> A context uploader for an AI agent in a precise graphite style: Inter, hairline edges, tabular numerals, one indigo accent. Each file runs a short ingest pipeline, shows its tokens in its file-kind colour, and fills a context budget that gates Attach.

- Category: Dropzone
- Frameworks: Vanilla
- Dark mode: yes
- Access: free (sign in to copy the code)
- Tags: upload, ai-agent, context, tokens, file-list, progress, drag-and-drop, dark-mode, responsive
- Page: https://builder.atheros.ai/components/attach-ai-agent-context
- Preview: https://d17nmjscumqk5d.cloudfront.net/builder/templates/tpl_builder_attach_files/preview-54fbf5aa36f4.webp

## Features

- One card in three parts: a header (a 40px indigo-tinted keycap the height of the title and description), the drop area with the file list, and a footer band with the context budget on the left and Attach to agent on the right
- Files come from the picker (`multiple`), a drop, or a paste while focus is anywhere in the card; paste is not advertised, and a pasted screenshot named `image.png` is renamed `pasted-image-N.png`
- The drop area is full size when empty ("Drop files here, or browse" plus the accepted types and size limit) and shrinks to a one-line strip ("Drop more files, or browse") whose icon centres over the file-icon column and whose text starts on the file-name edge
- Each file row: a 38px tile the height of its two text lines (a Tabler file-type glyph in the file-kind colour, or a real thumbnail for images), the name with the extension kept visible when the stem is cut, a meta line, the token column and retry / remove actions
- Ingest stages are data (Uploading, Parsing, Chunking, Indexing). In flight a row reads `2.3 MB · Indexing…`, shows its percentage beside a hollow swatch, and draws a four-segment bar under its text that rides in the row padding, so the row never changes height
- A ready row reads `2.3 MB · 293 chunks` and shows `150k tokens` beside a filled swatch in its file-kind colour, right against its remove button
- Token estimates are data: bytes / 4 for text and code, bytes / 16 for PDF, a fixed 1,600 tokens per image, 512 tokens per chunk
- Problem rows stay in the list with a plain sentence in the error red: `Can't read .exe files`, `Larger than the 25 MB limit`, or a failed parse with Retry; a second file with the same name is marked Duplicate and starts when the first one is removed
- File-kind hues (text violet, code cyan, sheet green, PDF magenta, image blue, each with a dark twin) tie a row's glyph and swatch to its slice of the budget bar
- Context budget (1M tokens; counts read `154.2k` or `1.2M`) in a 15rem footer meter: `464.1k / 1M tokens` with a short status on the right (`535.9k left`, `Reading 2 files`, `1.6k over`, `Attached 3 files`), one slice per ready file, a notch at the 80% mark; the count turns amber at 80% and the whole bar red over budget
- Hovering a row or a slice lights its partner: the other slices dim, the row's remove button wakes; rows get no hover fill because they are not clickable
- Attach stays disabled while files are in flight or the total is over; it then shows Attaching and Attached, emits `attachfiles:attach`, and clears the card (no network)
- Clear all in the file list header is the one way to start over; there is no Cancel button
- Continuous squircle corners where `corner-shape` is supported, with the radii grown to match
- Keyboard: Enter or Space on the drop area opens the picker; inside the list one row is in the tab order, arrows / Home / End move between rows, Delete or Backspace removes, Enter retries, Escape cancels a file in flight
- Polite live region announces additions, problems, each file becoming ready, cancels, removals and the attach confirmation, never every stage tick
- CSS-only dark mode (`body.dark`) on a graphite ladder; no built-in theme toggle

## Accessibility

- **Landmarks** — `<main>` holds the `<form>`, labelled by its `<h1>`; the file stack is a `<section>` labelled by its file count heading
- **Drop target** — The native file input covers the whole drop area, so Tab reaches it and it is the click target; `aria-label="Choose files for the agent"`, described by the limits line, the live summary and a visually hidden paste hint
- **Keyboard** — Enter and Space open the picker; Tab goes drop area, Clear all, one file row, Attach; in the list arrows / Home / End move, Delete or Backspace removes, Enter retries, Escape cancels; the keys are described on the list
- **Focus** — A 2px ring around the drop area while its input has keyboard focus, an inset ring on the focused row, the global `:focus-visible` ring elsewhere; removing a row focuses its neighbour, or the drop area when the list empties
- **Progress** — Each row bar is `role="progressbar"` with `aria-valuenow` 0–100 and `aria-valuetext` naming the stage; the budget is `role="meter"` with `aria-valuetext` such as "154,183 of 1,000,000 tokens"
- **Disabled Attach** — `aria-describedby` points at a visually hidden sentence beside the meter that says why it is disabled (files in flight, or over budget); the meter's visible status is the short form
- **Announcements** — `role="status"` + `aria-live="polite"`, batched per frame: added files, problems, each file that becomes ready, failures, cancels, removals, clear and the attach confirmation
- **Targets** — Row actions 32px, Clear all 28px tall, buttons 44px tall; nothing inflated, no pills
- **Motion** — Reduced motion collapses every transition and animation

## Common questions

**Which frameworks is Attach AI Agent Context available in?**

Attach AI Agent Context ships as Vanilla — HTML, CSS, JS source you can copy, download or clone into Atheros AI Builder.

**Is the Attach AI Agent Context dropzone component free?**

Yes. Attach AI Agent Context is a free component: preview it without an account, and sign in with a free Atheros account to copy or download the full source and customise it with AI.

**Does Attach AI Agent Context support dark mode?**

Yes. Attach AI Agent Context ships light and dark themes. Switch the preview to dark mode to compare them.

## Get the code

Preview Attach AI Agent Context live, then sign in to copy or download the source, apply another design system, or ask the AI assistant to change it: https://builder.atheros.ai/components/attach-ai-agent-context

Every component on https://builder.atheros.ai is also reachable from Claude Code, Cursor and Codex through the Atheros MCP server (paid plans). Component index: https://builder.atheros.ai/llms-components.txt
