Metadata-Version: 2.4
Name: contextlane
Version: 0.3.0
Summary: Open-source context ingestion pipeline for persistent AI agents
Author: Talocode
License: MIT
Project-URL: Homepage, https://github.com/talocode/contextlane
Project-URL: Source, https://github.com/talocode/contextlane
Project-URL: npm, https://www.npmjs.com/package/@talocode/contextlane
Keywords: context,ai-agents,memory,ingestion,mcp,sdk,cli,talocode
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# ContextLane

**Open-source context ingestion pipeline for persistent AI agents.**

MemoryLane gives agents memory. **ContextLane gives agents something worth remembering.**

Turn files, folders, URLs, repos, and notes into structured context with citations — then optionally sync to MemoryLane for persistent agent recall.

| | |
|--|--|
| **Package** | `pip install contextlane` |
| **CLI** | `contextlane` |
| **npm** | `@talocode/contextlane` |
| **Repo** | [github.com/talocode/contextlane](https://github.com/talocode/contextlane) |
| **Docs** | [docs.talocode.site](https://docs.talocode.site) |
| **License** | MIT |

---

## Why ContextLane?

Agents fail when context is a pastebin. ContextLane standardizes:

```text
source → load → normalize → chunk → extract → cite → save → optional MemoryLane sync
```

Every ingestion run can produce:

- **Summary** — high-level overview  
- **Key facts** — statements with confidence  
- **Decisions** — active / historical  
- **Action items** — TODOs with priority  
- **Entities** — people, tools, URLs  
- **Tags** — auto topics  
- **Citations** — line-level source refs  
- **MemoryLane records** — ready to sync  

Local usage is free and open-source. Cloud mode uses Talocode when configured.

---

## Install

```bash
pip install -U contextlane
contextlane demo
```

Python **3.10+**.

From source:

```bash
git clone https://github.com/talocode/contextlane.git
cd contextlane/python && pip install -e .
```

---

## Supported sources

| Type | Examples |
|------|----------|
| File | `.md`, `.txt`, `.json`, `.pdf`, `.py`, `.ts`, `.js`, `.go`, `.rs`, `.css`, `.html`, `.yaml`, `.sh`, + many more |
| Folder | Recursive; ignores `node_modules`, `.git`, `dist`, `build`, `.next`, … |
| URL | Public pages → readable text |
| GitHub | Shallow clone; README / docs / src |
| Text | Inline or piped content |

---

## CLI

```bash
contextlane --help
contextlane --version
contextlane init                    # ~/.contextlane/
contextlane doctor
contextlane demo
contextlane ingest <path>
contextlane ingest-url <url>
contextlane ingest-github <repo>
contextlane runs list
contextlane runs show <runId>
contextlane search <query>
contextlane recall <query>
contextlane sync memorylane <runId>
contextlane export <runId> -o file.json
contextlane import file.json
contextlane serve --port 3060
```

Auto-sync during ingest:

```bash
contextlane ingest ./README.md --sync
```

---

## Python SDK

```python
from contextlane import ContextLaneClient, ingest, search

# Local engine (no network)
run = ingest("./README.md")
print(run["id"], len(run.get("extraction", {}).get("facts", [])))

results = search("authentication")
for r in results:
    print(r.get("run_id"), (r.get("chunk") or {}).get("text", "")[:120])

# Remote HTTP API
client = ContextLaneClient("http://localhost:3060")
print(client.health())
print(client.list_runs())
```

---

## HTTP API (local server)

```bash
contextlane serve --port 3060

curl -X POST http://localhost:3060/v1/contextlane/ingest \
  -H 'Content-Type: application/json' \
  -d '{"input":"./README.md"}'

curl -X POST http://localhost:3060/v1/contextlane/search \
  -H 'Content-Type: application/json' \
  -d '{"query":"What is this?"}'
```

---

## MemoryLane sync

Priority:

1. **HTTP** — `CONTEXTLANE_MEMORYLANE_URL`  
2. **CLI** — `memorylane` on `PATH`  
3. **Fallback** — `~/.contextlane/runs/<runId>/memory-records.json`

```bash
contextlane sync memorylane <runId>
```

---

## Cloud mode

```bash
export CONTEXTLANE_CLOUD_MODE=true
export TALOCODE_API_KEY=your_key
# optional: TALOCODE_BASE_URL=https://api.talocode.site
```

---

## Related packages

| Package | Role |
|---------|------|
| `contextlane` | **This package** — ingest & structure |
| `talocode` | Unified cloud client |
| MemoryLane (npm/CLI) | Persistent agent memory store |
| `talocode-searchlane` | Live web research into new context |

---

## Talocode ecosystem

| Project | Role |
|---------|------|
| **[ContextLane](https://github.com/talocode/contextlane)** | This product |
| **[MemoryLane](https://github.com/talocode/memorylane)** | Persistent memory |
| **[Codra](https://github.com/talocode/codra)** | Coding agent that can consume context |
| **[SearchLane](https://github.com/talocode/searchlane)** | Web search / research |
| **[StackLane](https://github.com/talocode/stacklane)** | Cloud control plane |
| **[Tera](https://github.com/talocode/tera)** | AI capabilities API |

More: [github.com/talocode](https://github.com/talocode) · [talocode.site](https://talocode.site)

## Links

- PyPI: https://pypi.org/project/contextlane/  
- npm: https://www.npmjs.com/package/@talocode/contextlane  
- GitHub: https://github.com/talocode/contextlane  

## License

MIT © Talocode
