Embedded cat. The simplest way to context engineer.
Project description
ecat — Embedded Cat
Embedded concatenation for context engineering.
ecat works like cat, but wraps every source — files, shell commands, and
URLs — in a labelled Markdown code fence before writing it to stdout. The
result is ready to pipe directly into an LLM CLI or any tool that reads a
prompt from stdin.
ecat [OPTIONS] [SOURCE ...]
A source is one of:
| Pattern | Treated as |
|---|---|
- |
stdin |
| existing file path | file contents |
https?://… |
fetched URL, HTML → Markdown |
| anything else | shell command output |
All blocks are joined with a blank line and written to stdout.
Install
pip install ecat
Quick Start
# Embed a file
ecat src/ecat/ecat.py
# Embed command output
ecat "git log --oneline -20"
# Embed a web page
ecat https://docs.python.org/3/library/pathlib.html
# Read a question from stdin and pipe everything to Claude
ecat schema.sql "SELECT * FROM orders LIMIT 5" \
| claude "$(cat question.txt)"
Usage
Options
| Flag | Default | Description |
|---|---|---|
-s, --shell |
bash |
Shell used to run command sources |
Sources
Files are fenced with their path as the language tag:
```src/ecat/ecat.py
… file contents …
```
Commands are fenced as bash with a $ prompt line:
```bash
$ git log --oneline -20
abc1234 fix typo
…
```
URLs are fetched, converted from HTML to Markdown, and fenced as bash
with the equivalent curl invocation shown:
```bash
$ curl -s https://example.com | html2markdown
… page content in Markdown …
```
Stdin (-) is embedded as plain text — no fence is added so you can
supply free-form prose or a question directly.
Context Engineering Patterns
ecat is designed to be composed with other tools via pipes. The idea is
simple: build a rich context block, then ask a question.
Explain a bug
ecat src/app.py "pytest tests/ 2>&1 | tail -30" \
| llm "Why is the test suite failing and how do I fix it?"
Review a diff
git diff main | ecat - \
| llm "Review this diff. Call out logic errors and security issues."
Summarise a web page
ecat https://news.ycombinator.com \
| llm "Give me the five most interesting links and a one-line summary of each."
Generate code from a schema
ecat schema.sql \
| llm "Generate a SQLAlchemy model file for every table in this schema."
Combine multiple sources
ecat \
README.md \
src/ecat/ecat.py \
"pip show ecat" \
| llm "Write a CHANGELOG entry for the next release."
Use a different shell
ecat --shell fish "status" "functions --all"
How It Works
argv tokens
│
├── "-" → read stdin ┐
├── file path → read file ├─→ Markdown code fence
├── https?://… → fetch + html2md │
└── other → run in shell ┘
│
join with "\n\n"
│
stdout
Each source becomes one self-contained block. The LLM always knows where each piece of context came from because the fence label carries the origin (file path, URL, or the literal command that was run).
Development
git clone https://github.com/rodolfovillaruz/ecat
cd ecat
pip install -e ".[dev]"
make check # format-check + lint + typecheck + test
make format # auto-format with black + isort
make test # pytest only
License
MIT © Rodolfo Villaruz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecat-1.0.0.tar.gz.
File metadata
- Download URL: ecat-1.0.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd3ad657162ca0f1cd22ab1b2b6fff14fd23cfa4d64c8d186d8c0b06318e7d1
|
|
| MD5 |
463d945654aa11353cf38feb1084ac29
|
|
| BLAKE2b-256 |
8bf9403a8886c62beeeaab41a3c03bd41dd7bc3a77267f08de1a8972548d2840
|
File details
Details for the file ecat-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ecat-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7e822a5e5f43e5a62a6d2fef6b9dafcc80ce54e57c2b85bce619d7563f59243
|
|
| MD5 |
66d233bf410a5e9ba4a5c647305b7a1c
|
|
| BLAKE2b-256 |
2f3a4bcabb69f43e475d73dd2e87c61bbb79d9fce2f7045f79f14bff74e2c2e3
|