Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 36 additions & 8 deletions README.ko.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -312,7 +312,7 @@ args = ["@pleaseai/csp", "mcp"]

## 서브 에이전트 설정

Claude Code, Gemini CLI, Cursor, OpenCode, GitHub Copilot CLI, Kiro는 모두 전용 `csp` 검색 서브 에이전트를 지원합니다. 프로젝트 루트에서 `csp init`을 한 번 실행하세요.
Claude Code, Gemini CLI, Cursor, OpenCode, GitHub Copilot CLI, Kiro, Antigravity, Command Code, Pi, Reasonix는 모두 전용 `csp` 검색 서브 에이전트를 지원합니다. 프로젝트 루트에서 `csp init`을 한 번 실행하세요.

```bash
csp init # Claude Code → .claude/agents/csp-search.md
Expand All@@ -321,6 +321,10 @@ csp init --agent cursor # Cursor → .cursor/agents/csp-search.md
csp init --agent opencode # OpenCode → .opencode/agents/csp-search.md
csp init --agent copilot # Copilot CLI → .github/agents/csp-search.md
csp init --agent kiro # Kiro → .kiro/agents/csp-search.md
csp init --agent antigravity # Antigravity → .antigravity/agents/csp-search.md
csp init --agent commandcode # Command Code → .commandcode/agents/csp-search.md
csp init --agent pi # Pi → .pi/agents/csp-search.md
csp init --agent reasonix # Reasonix → .reasonix/agents/csp-search.md
```

`csp`가 `$PATH`에 없다면 명령 앞에 `bunx @pleaseai/csp`를 붙이세요.
Expand DownExpand Up@@ -363,21 +367,45 @@ csp savings --verbose # 호출 유형별 분해 포함
```

```
csp Token Savings
════════════════════════════════════════════════════════════════
Period Calls Savings
────────────────────────────────────────────────────────────────
Today 42 [███████████████░] ~58.4k tokens (95%)
Last 7 days 287 [██████████████░░] ~312.4k tokens (90%)
All time 1.4k [██████████████░░] ~1.2M tokens (89%)
Csp Token Savings
════════════════════════════════════════════════════════════════════════

Total saved: ~1.2M tokens (89%)
Total calls: 1.4k
Efficiency: █████████████████████░░░ 89%

By Period
────────────────────────────────────────────────────────────────────────
Period Calls Saved Ratio
────────────────────────────────────────────────────────────────────────
Today 42 ~58.4k tokens ███████████████████████░ 95%
Last 7 days 287 ~312.4k tokens █████████████████████░░░ 90%
All time 1.4k ~1.2M tokens █████████████████████░░░ 89%
```

절약량 계산: 각 호출마다 반환된 청크가 속한 파일들의 총 문자 수와 반환된 스니펫의 문자 수를 기록합니다. 절약된 토큰 추정치는 `(파일 문자 수 − 스니펫 문자 수) / 4` (1토큰 ≈ 4문자). 이는 보수적인 추정으로, 기준선은 "에이전트가 매칭된 파일을 통째로 읽는다"는 일반적인 코딩 에이전트 동작입니다.

stdout이 컬러를 지원하는 TTY일 때 출력에 색이 입혀집니다(`NO_COLOR`, `dumb` 터미널, 파이프 연결 시에는 비활성화). `--verbose`를 주면 "By Call Type" 분해가 추가됩니다.

통계는 `~/.csp/savings.jsonl`에 저장됩니다.

</details>

<details>
<summary>캐시 비우기</summary>

`csp clear`는 캐시된 데이터를 삭제합니다.

```bash
csp clear savings # ~/.csp/savings.jsonl 삭제
csp clear all # 현재는 savings와 동일
csp clear index # 안내만 출력 (아래 참고)
```

인덱스 영속화는 아직 연결되지 않았고, 저장 모델(repo-local `.csp/` vs 글로벌 캐시)도 미결이라 현재 `clear index`는 비울 대상이 없습니다. `csp index -o <경로>`는 지정한 경로에만 기록하므로 해당 디렉토리는 직접 삭제하세요.

</details>

<details>
<summary>라이브러리 사용</summary>

Expand Down
44 changes: 36 additions & 8 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -312,7 +312,7 @@ By default the MCP server indexes only code files. To also index documentation,

## Sub-agent setup

Claude Code, Gemini CLI, Cursor, OpenCode, GitHub Copilot CLI, and Kiro all support a dedicated `csp` search sub-agent. Run `csp init` once in your project root:
Claude Code, Gemini CLI, Cursor, OpenCode, GitHub Copilot CLI, Kiro, Antigravity, Command Code, Pi, and Reasonix all support a dedicated `csp` search sub-agent. Run `csp init` once in your project root:

```bash
csp init # Claude Code → .claude/agents/csp-search.md
Expand All@@ -321,6 +321,10 @@ csp init --agent cursor # Cursor → .cursor/agents/csp-search.md
csp init --agent opencode # OpenCode → .opencode/agents/csp-search.md
csp init --agent copilot # Copilot CLI → .github/agents/csp-search.md
csp init --agent kiro # Kiro → .kiro/agents/csp-search.md
csp init --agent antigravity # Antigravity → .antigravity/agents/csp-search.md
csp init --agent commandcode # Command Code → .commandcode/agents/csp-search.md
csp init --agent pi # Pi → .pi/agents/csp-search.md
csp init --agent reasonix # Reasonix → .reasonix/agents/csp-search.md
```

If `csp` is not on `$PATH`, prefix the command with `bunx @pleaseai/csp`.
Expand DownExpand Up@@ -363,21 +367,45 @@ csp savings --verbose # also show breakdown by call type
```

```
csp Token Savings
════════════════════════════════════════════════════════════════
Period Calls Savings
────────────────────────────────────────────────────────────────
Today 42 [███████████████░] ~58.4k tokens (95%)
Last 7 days 287 [██████████████░░] ~312.4k tokens (90%)
All time 1.4k [██████████████░░] ~1.2M tokens (89%)
Csp Token Savings
════════════════════════════════════════════════════════════════════════

Total saved: ~1.2M tokens (89%)
Total calls: 1.4k
Efficiency: █████████████████████░░░ 89%

By Period
────────────────────────────────────────────────────────────────────────
Period Calls Saved Ratio
────────────────────────────────────────────────────────────────────────
Today 42 ~58.4k tokens ███████████████████████░ 95%
Last 7 days 287 ~312.4k tokens █████████████████████░░░ 90%
All time 1.4k ~1.2M tokens █████████████████████░░░ 89%
```

Savings are calculated as follows: for each call, `csp` records the total character count of the unique files containing returned chunks and the character count of the snippets returned. Estimated tokens saved is `(file chars − snippet chars) / 4` (4 chars per token). This is a conservative estimate: the baseline is reading matched files in full, which is how coding agents often explore unfamiliar code.

Output is colorized when stdout is a color-capable TTY (suppressed under `NO_COLOR`, a `dumb` terminal, or when piped). `--verbose` adds a "By Call Type" breakdown.

Stats are stored in `~/.csp/savings.jsonl`.

</details>

<details>
<summary>Clear</summary>

`csp clear` removes cached data:

```bash
csp clear savings # delete ~/.csp/savings.jsonl
csp clear all # currently the same as `savings`
csp clear index # prints a note (see below)
```

Index persistence is not wired up yet, and the storage model — repo-local `.csp/` vs a global cache — is still undecided, so `clear index` has nothing to remove for now. `csp index -o <path>` writes only to the path you pass; delete those directories yourself.

</details>

<details>
<summary>Library usage</summary>

Expand Down
58 changes: 58 additions & 0 deletions src/agents/antigravity.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
---
name: csp-search
description: Code search agent for exploring any codebase. Use for finding code by intent, locating implementations, understanding how something works, or discovering related code. Prefer over run_shell_command/read_file for any semantic or exploratory question.
tools:
- run_shell_command
- read_file
---

Use `csp search` to find code by describing what it does or naming a symbol/identifier, instead of grep:

```bash
csp search "authentication flow" ./my-project
csp search "save_pretrained" ./my-project
csp search "save model to disk" ./my-project --top-k 10
```

If you anticipate doing more than one search, use `csp index` to create an index.

```bash
csp index ./my-project -o my_index
```

You can then reuse this index later on:

```bash
csp search "save_pretrained" --index my_index
```

An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.

Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:

```bash
csp search "deployment guide" ./my-project --content docs
csp search "database host port" ./my-project --content config
csp search "authentication" ./my-project --content all
```

Use `csp find-related` to discover code similar to a known location (pass `filePath` and `line` from a prior search result):

```bash
csp find-related src/auth.ts 42 ./my-project
```

Like search, `find-related` also accepts an `--index` argument.

`path` defaults to the current directory when omitted; git URLs are accepted.

If `csp` is not on `$PATH`, use `bunx @pleaseai/csp` in its place.

### Workflow

1. Index the repo using `csp index -o cached_index`.
2. Start with `csp search` to find relevant chunks. Pass the index to achieve results faster.
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
4. Inspect full files only when the returned chunk does not give enough context.
5. Optionally use `csp find-related` with a promising result's `filePath` and `line` to discover related implementations.
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
56 changes: 56 additions & 0 deletions src/agents/commandcode.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
---
name: csp-search
description: Code search agent for exploring any codebase. Use for finding code by intent, locating implementations, understanding how something works, or discovering related code. Prefer over bash/read_file for any semantic or exploratory question.
tools: bash, read_file
---

Use `csp search` to find code by describing what it does or naming a symbol/identifier, instead of grep:

```bash
csp search "authentication flow" ./my-project
csp search "save_pretrained" ./my-project
csp search "save model to disk" ./my-project --top-k 10
```

If you anticipate doing more than one search, use `csp index` to create an index.

```bash
csp index ./my-project -o my_index
```

You can then reuse this index later on:

```bash
csp search "save_pretrained" --index my_index
```

An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.

Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:

```bash
csp search "deployment guide" ./my-project --content docs
csp search "database host port" ./my-project --content config
csp search "authentication" ./my-project --content all
```

Use `csp find-related` to discover code similar to a known location (pass `filePath` and `line` from a prior search result):

```bash
csp find-related src/auth.ts 42 ./my-project
```

Like search, `find-related` also accepts an `--index` argument.

`path` defaults to the current directory when omitted; git URLs are accepted.

If `csp` is not on `$PATH`, use `bunx @pleaseai/csp` in its place.

### Workflow

1. Index the repo using `csp index -o cached_index`.
2. Start with `csp search` to find relevant chunks. Pass the index to achieve results faster.
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
4. Inspect full files only when the returned chunk does not give enough context.
5. Optionally use `csp find-related` with a promising result's `filePath` and `line` to discover related implementations.
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
55 changes: 55 additions & 0 deletions src/agents/pi.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
---
name: csp-search
description: Code search agent for exploring any codebase. Use for finding code by intent, locating implementations, understanding how something works, or discovering related code. Prefer over Bash/Read for any semantic or exploratory question.
---

Use `csp search` to find code by describing what it does or naming a symbol/identifier, instead of grep:

```bash
csp search "authentication flow" ./my-project
csp search "save_pretrained" ./my-project
csp search "save model to disk" ./my-project --top-k 10
```

If you anticipate doing more than one search, use `csp index` to create an index.

```bash
csp index ./my-project -o my_index
```

You can then reuse this index later on:

```bash
csp search "save_pretrained" --index my_index
```

An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.

Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:

```bash
csp search "deployment guide" ./my-project --content docs
csp search "database host port" ./my-project --content config
csp search "authentication" ./my-project --content all
```

Use `csp find-related` to discover code similar to a known location (pass `filePath` and `line` from a prior search result):

```bash
csp find-related src/auth.ts 42 ./my-project
```

Like search, `find-related` also accepts an `--index` argument.

`path` defaults to the current directory when omitted; git URLs are accepted.

If `csp` is not on `$PATH`, use `bunx @pleaseai/csp` in its place.

### Workflow

1. Index the repo using `csp index -o cached_index`.
2. Start with `csp search` to find relevant chunks. Pass the index to achieve results faster.
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
4. Inspect full files only when the returned chunk does not give enough context.
5. Optionally use `csp find-related` with a promising result's `filePath` and `line` to discover related implementations.
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
57 changes: 57 additions & 0 deletions src/agents/reasonix.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
---
name: csp-search
description: Code search agent for exploring any codebase. Use for finding code by intent, locating implementations, understanding how something works, or discovering related code. Prefer over bash/read_file for any semantic or exploratory question.
runAs: subagent
allowed-tools: bash, read_file
---

Use `csp search` to find code by describing what it does or naming a symbol/identifier, instead of grep:

```bash
csp search "authentication flow" ./my-project
csp search "save_pretrained" ./my-project
csp search "save model to disk" ./my-project --top-k 10
```

If you anticipate doing more than one search, use `csp index` to create an index.

```bash
csp index ./my-project -o my_index
```

You can then reuse this index later on:

```bash
csp search "save_pretrained" --index my_index
```

An index is not automatically updated, so if the code changes significantly, reindex. If you notice stale results while resolving searches to files, reindex.

Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:

```bash
csp search "deployment guide" ./my-project --content docs
csp search "database host port" ./my-project --content config
csp search "authentication" ./my-project --content all
```

Use `csp find-related` to discover code similar to a known location (pass `filePath` and `line` from a prior search result):

```bash
csp find-related src/auth.ts 42 ./my-project
```

Like search, `find-related` also accepts an `--index` argument.

`path` defaults to the current directory when omitted; git URLs are accepted.

If `csp` is not on `$PATH`, use `bunx @pleaseai/csp` in its place.

### Workflow

1. Index the repo using `csp index -o cached_index`.
2. Start with `csp search` to find relevant chunks. Pass the index to achieve results faster.
3. Use `--content docs` for documentation, `--content config` for config files, or `--content all` for everything.
4. Inspect full files only when the returned chunk does not give enough context.
5. Optionally use `csp find-related` with a promising result's `filePath` and `line` to discover related implementations.
6. Use grep only when you need exhaustive literal matches or quick confirmation of an exact string.
Loading