Metadata-Version: 2.4
Name: chensi
Version: 2.0.0
Summary: Chensi — Advisory Safety Layer for AI agents: auto-generates repo context, command policies, and Claude Code deny-lists
Author: Arcadominus
License: MIT
Keywords: ai,agents,cli,developer-tools,repo-intelligence
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1
Requires-Dist: pydantic>=2.6
Requires-Dist: jinja2>=3.1
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.9; extra == "dev"
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
Dynamic: license-file

# Chensi

[![CI](https://github.com/Chensicorp/chensi-studio/actions/workflows/ci.yml/badge.svg?branch=studio)](https://github.com/Chensicorp/chensi-studio/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

> **Advisory Safety Layer for AI agents.**
> Run one command. Your AI agent gets an auto-generated repo map, typed command policies, and a `.claude/settings.json` deny-list — without writing a single line of agent config.

Chensi is **advisory**, not a full enforcement layer yet. It generates structured context that Claude Code, Codex CLI, and other agents read at startup. Hard enforcement via `preToolUse` hooks is planned for **Phase 5**. See [roadmap](#roadmap).

Meet **Agenty** 🤖 — Chensi's mascot, your repo's safety advisor.

---

## Status

**Branch `studio` — активная разработка Chensi v2.0.**

| Версия | Статус |
|--------|--------|
| v0.1.0 | Released — markdown-only framework |
| v2.0 | **In development** — Python CLI, Phase 2 in progress (settings.json enforcement + PyPI release) |

Публичный релиз v2.0 будет на ветке `main`.

---

## What Chensi does

```bash
chensi activate my-repo/
```

Result — your AI agent opens the repo and sees:

```markdown
# Project Context (generated by Chensi v2.0)
Stack: python + langchain + langgraph + pandas + redis

## Safe commands
- pytest
- ruff check
- mypy src/

## Off-limits
- .env*  (secrets)
- *.key  (secrets)
- migrations/  (requires approval)
```

Plus a `.chensi-os/adapters/claude/settings.json` deny-list that Claude Code reads to **physically block** destructive commands:

```json
{
  "permissions": {
    "deny": [
      "Bash(rm -rf *)",
      "Bash(git push --force*)",
      "Bash(git reset --hard*)",
      "Bash(chmod 777*)"
    ]
  }
}
```

No manual config. No hand-written CLAUDE.md.

---

## Quick start (v2.0 — dev build)

```bash
# Install
pip install -e .

# Activate repo
chensi activate path/to/your-repo

# Check results
cat path/to/your-repo/.chensi-os/adapters/CLAUDE.md

# Or with explicit output dir
chensi activate path/to/your-repo --output-dir /tmp/test --force

# Validate
chensi validate path/to/your-repo
```

---

## What gets generated

```
.chensi-os/
├── adapters/
│   ├── CLAUDE.md                    ← Claude Code reads this
│   ├── AGENTS.md                    ← Codex CLI reads this
│   └── claude/
│       └── settings.json            ← Claude Code deny-list (copy to .claude/)
├── project/
│   ├── architecture-map.md
│   └── boundaries.md
├── verification/
│   ├── commands.lock.yaml           ← typed safe/ask/deny rules
│   └── commands.md
├── repo-profile.yaml                ← detected languages, frameworks, test runners
└── boundaries.policy.yaml           ← off-limits paths
```

---

## Advisory vs Enforcement

| Layer | Phase | What it does |
|-------|-------|--------------|
| Advisory (CLAUDE.md / AGENTS.md) | Phase 1 ✅ | Agent reads context at startup — soft guidance |
| Deny-list (settings.json) | Phase 2 ✅ | Claude Code physically blocks listed commands |
| Hook interception (preToolUse) | Phase 5 🔜 | Runtime enforcement for all tool calls |

> **Phase 5 notice:** Full hook-based interception is planned for Phase 5. Until then, `settings.json` provides hard blocking for Claude Code; advisory files handle all other agents.

---

## Repository structure

```
.agent-os/          ← studio operational layer (Director, PM, PO, Engineering, QA)
template/           ← distribution template for users
  .chensi-os/       ← what gets copied into the user's repo
  .adapters/        ← Claude, Codex adapters
src/chensi/         ← Python CLI (Scanner → Analyzer → PolicyCompiler → ChensiLayer)
sandbox/            ← test repos for QA
  targets/trading-agents/
.github/workflows/  ← CI (pytest + ruff, Python 3.11/3.12)
docs/               ← design document + business description
```

---

## Platform support

| Platform | Status |
|----------|--------|
| Claude Code | Supported (CLAUDE.md + settings.json) |
| OpenAI Codex CLI | Supported (AGENTS.md) |
| Amazon Q Developer | Planned |
| Cursor | Planned |

---

## Roadmap

| Phase | Description | Status |
|-------|-------------|--------|
| Phase 1 | `chensi activate` core pipeline | ✅ Done |
| Phase 2 | settings.json deny-list + PyPI v2.0.0 release | 🔄 In progress |
| Phase 3 | `--policy-profile` org flag | Planned |
| Phase 4 | Windows support + test suite hardening | Planned |
| Phase 5 | **Full hook-based interception** (`preToolUse`) | Planned |
| Phase 6 | Enterprise: OCI, Helm, SBOM, Artifactory | Planned |

---

## License

MIT — see [LICENSE](LICENSE)
