Skip to content

Commit 58b8120

Browse files
committed
initial commit
0 parents  commit 58b8120

41 files changed

Lines changed: 2858 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Poetry specific files
2+
.venv/
3+
/dist/
4+
/poetry.toml
5+
6+
# Python bytecode and caches
7+
__pycache__/
8+
*.pyc
9+
*.pyo
10+
*.pyd
11+
.pytest_cache/
12+
.mypy_cache/
13+
.ruff_cache/
14+
15+
# Environment variables (secret keys)
16+
.env
17+
18+
# IDE settings
19+
.vscode/
20+
.idea/

CLAUDE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# context-mode — MANDATORY routing rules
2+
3+
You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session.
4+
5+
## BLOCKED commands — do NOT attempt these
6+
7+
### curl / wget — BLOCKED
8+
Any Bash command containing `curl` or `wget` is intercepted and replaced with an error message. Do NOT retry.
9+
Instead use:
10+
- `ctx_fetch_and_index(url, source)` to fetch and index web pages
11+
- `ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox
12+
13+
### Inline HTTP — BLOCKED
14+
Any Bash command containing `fetch('http`, `requests.get(`, `requests.post(`, `http.get(`, or `http.request(` is intercepted and replaced with an error message. Do NOT retry with Bash.
15+
Instead use:
16+
- `ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context
17+
18+
### WebFetch — BLOCKED
19+
WebFetch calls are denied entirely. The URL is extracted and you are told to use `ctx_fetch_and_index` instead.
20+
Instead use:
21+
- `ctx_fetch_and_index(url, source)` then `ctx_search(queries)` to query the indexed content
22+
23+
## REDIRECTED tools — use sandbox equivalents
24+
25+
### Bash (>20 lines output)
26+
Bash is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands.
27+
For everything else, use:
28+
- `ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call
29+
- `ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context
30+
31+
### Read (for analysis)
32+
If you are reading a file to **Edit** it → Read is correct (Edit needs content in context).
33+
If you are reading to **analyze, explore, or summarize** → use `ctx_execute_file(path, language, code)` instead. Only your printed summary enters context. The raw file content stays in the sandbox.
34+
35+
### Grep (large results)
36+
Grep results can flood context. Use `ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context.
37+
38+
## Tool selection hierarchy
39+
40+
1. **GATHER**: `ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls.
41+
2. **FOLLOW-UP**: `ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call.
42+
3. **PROCESSING**: `ctx_execute(language, code)` | `ctx_execute_file(path, language, code)` — Sandbox execution. Only stdout enters context.
43+
4. **WEB**: `ctx_fetch_and_index(url, source)` then `ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context.
44+
5. **INDEX**: `ctx_index(content, source)` — Store content in FTS5 knowledge base for later search.
45+
46+
## Subagent routing
47+
48+
When spawning subagents (Agent/Task tool), the routing block is automatically injected into their prompt. Bash-type subagents are upgraded to general-purpose so they have access to MCP tools. You do NOT need to manually instruct subagents about context-mode.
49+
50+
## Output constraints
51+
52+
- Keep responses under 500 words.
53+
- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description.
54+
- When indexing content, use descriptive source labels so others can `ctx_search(source: "label")` later.
55+
56+
## ctx commands
57+
58+
| Command | Action |
59+
|---------|--------|
60+
| `ctx stats` | Call the `ctx_stats` MCP tool and display the full output verbatim |
61+
| `ctx doctor` | Call the `ctx_doctor` MCP tool, run the returned shell command, display as checklist |
62+
| `ctx upgrade` | Call the `ctx_upgrade` MCP tool, run the returned shell command, display as checklist |

Dockerrfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
# Install Poetry
6+
RUN pip install poetry
7+
8+
# Copy dependency files
9+
COPY pyproject.toml poetry.lock* ./
10+
11+
# Install dependencies without dev tools
12+
RUN poetry config virtualenvs.create false \
13+
&& poetry install --no-interaction --no-ansi --no-root
14+
15+
# Copy source code
16+
COPY src ./src
17+
18+
# Expose port
19+
EXPOSE 8000
20+
21+
# Run application
22+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]

dokcer-compose.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: '3.8'
2+
3+
services:
4+
api:
5+
build: .
6+
ports:
7+
- "8000:8000"
8+
env_file:
9+
- .env
10+
depends_on:
11+
- db
12+
volumes:
13+
- ./src:/app/src # For hot-reloading during dev
14+
15+
db:
16+
image: postgres:15-alpine
17+
environment:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: todo_db
21+
ports:
22+
- "5432:5432"
23+
volumes:
24+
- postgres_data:/var/lib/postgresql/data
25+
26+
volumes:
27+
postgres_data:

0 commit comments

Comments
 (0)