argus-code 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. argus/__init__.py +3 -0
  2. argus/adapters/__init__.py +7 -0
  3. argus/adapters/base.py +108 -0
  4. argus/adapters/claude_code/__init__.py +5 -0
  5. argus/adapters/claude_code/adapter.py +63 -0
  6. argus/adapters/claude_code/discover.py +72 -0
  7. argus/adapters/claude_code/extract_tool_calls.py +86 -0
  8. argus/adapters/claude_code/extract_transcript.py +111 -0
  9. argus/adapters/claude_code/extract_turns.py +69 -0
  10. argus/adapters/claude_code/history_jsonl.py +138 -0
  11. argus/adapters/claude_code/ingest_file.py +137 -0
  12. argus/adapters/claude_code/model.py +11 -0
  13. argus/adapters/claude_code/schemas.py +77 -0
  14. argus/adapters/registry.py +30 -0
  15. argus/cli.py +384 -0
  16. argus/collector/__init__.py +0 -0
  17. argus/collector/aggregate.py +102 -0
  18. argus/collector/first_run.py +189 -0
  19. argus/collector/pipeline.py +140 -0
  20. argus/collector/rollup_subagents.py +27 -0
  21. argus/collector/scheduler.py +89 -0
  22. argus/collector/search_backfill.py +109 -0
  23. argus/collector/watcher.py +178 -0
  24. argus/dashboard-dist/_astro/charts.BIevw6Es.js +1 -0
  25. argus/dashboard-dist/_astro/format.DxC1NGYT.js +1 -0
  26. argus/dashboard-dist/_astro/index.astro_astro_type_script_index_0_lang.CgwSARdD.js +24 -0
  27. argus/dashboard-dist/_astro/index.astro_astro_type_script_index_0_lang.W18SJsr7.js +11 -0
  28. argus/dashboard-dist/_astro/installCanvasRenderer.D_tC6TXz.js +18 -0
  29. argus/dashboard-dist/_astro/models.astro_astro_type_script_index_0_lang.BHTHXYHC.js +13 -0
  30. argus/dashboard-dist/_astro/prompts.astro_astro_type_script_index_0_lang.DfNgiDv9.js +17 -0
  31. argus/dashboard-dist/_astro/session.astro_astro_type_script_index_0_lang.Dj_bfrIa.js +86 -0
  32. argus/dashboard-dist/_astro/settings.astro_astro_type_script_index_0_lang.d_a-uvdi.js +24 -0
  33. argus/dashboard-dist/_astro/tools.astro_astro_type_script_index_0_lang.Dzzau3Yt.js +12 -0
  34. argus/dashboard-dist/_astro/trends.astro_astro_type_script_index_0_lang.BLLeGRNa.js +5 -0
  35. argus/dashboard-dist/index.html +2 -0
  36. argus/dashboard-dist/models/index.html +1 -0
  37. argus/dashboard-dist/prompts/index.html +18 -0
  38. argus/dashboard-dist/session/index.html +2 -0
  39. argus/dashboard-dist/sessions/index.html +1 -0
  40. argus/dashboard-dist/settings/index.html +8 -0
  41. argus/dashboard-dist/styles/global.css +307 -0
  42. argus/dashboard-dist/tools/index.html +1 -0
  43. argus/dashboard-dist/trends/index.html +1 -0
  44. argus/detectors/__init__.py +6 -0
  45. argus/detectors/base.py +34 -0
  46. argus/detectors/registry.py +20 -0
  47. argus/detectors/tool_error_rate_spike.py +138 -0
  48. argus/pricing/2026-05-02.json +24 -0
  49. argus/pricing/__init__.py +0 -0
  50. argus/pricing/compute.py +46 -0
  51. argus/pricing/load.py +45 -0
  52. argus/pricing/refresh.py +91 -0
  53. argus/pricing/types.py +21 -0
  54. argus/scaffold/__init__.py +0 -0
  55. argus/scaffold/scaffolder.py +45 -0
  56. argus/scaffold/snapshot.py +73 -0
  57. argus/scaffold/storage.py +60 -0
  58. argus/schema/__init__.py +0 -0
  59. argus/schema/types.py +157 -0
  60. argus/server/__init__.py +0 -0
  61. argus/server/api.py +661 -0
  62. argus/server/app.py +97 -0
  63. argus/store/__init__.py +0 -0
  64. argus/store/db.py +103 -0
  65. argus/store/migrations/__init__.py +0 -0
  66. argus/store/migrations/inline.py +180 -0
  67. argus/store/repository.py +778 -0
  68. argus/templates/default/.claude/agents/code-reviewer.md +27 -0
  69. argus/templates/default/.claude/agents/security-auditor.md +28 -0
  70. argus/templates/default/.claude/commands/commit.md +38 -0
  71. argus/templates/default/.claude/commands/deploy.md +13 -0
  72. argus/templates/default/.claude/commands/fix-issue.md +15 -0
  73. argus/templates/default/.claude/commands/pr.md +38 -0
  74. argus/templates/default/.claude/commands/review.md +14 -0
  75. argus/templates/default/.claude/rules/api-conventions.md +27 -0
  76. argus/templates/default/.claude/rules/code-style.md +25 -0
  77. argus/templates/default/.claude/rules/testing.md +19 -0
  78. argus/templates/default/.claude/settings.json +28 -0
  79. argus/templates/default/.claude/skills/example/SKILL.md +11 -0
  80. argus/templates/default/CLAUDE.md +57 -0
  81. argus_code-0.2.0.dist-info/METADATA +247 -0
  82. argus_code-0.2.0.dist-info/RECORD +86 -0
  83. argus_code-0.2.0.dist-info/WHEEL +4 -0
  84. argus_code-0.2.0.dist-info/entry_points.txt +2 -0
  85. argus_code-0.2.0.dist-info/licenses/LICENSE +21 -0
  86. argus_code-0.2.0.dist-info/licenses/NOTICE +22 -0
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Code Reviewer
3
+ description: Use when you need a thorough code review. Checks correctness, security, performance, and test coverage. Invoke for any non-trivial diff before merging.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are a senior engineer doing a thorough code review.
8
+
9
+ ## Behavior
10
+ - Be direct and specific — point to exact lines
11
+ - Explain *why* something is wrong, not just that it is
12
+ - Distinguish: blocking issues vs suggestions vs nitpicks
13
+ - Praise good patterns when you see them — not just criticism
14
+
15
+ ## Focus areas
16
+ 1. Correctness — does it do what it claims?
17
+ 2. Security — any injection, auth bypass, data exposure?
18
+ 3. Performance — any obvious bottlenecks?
19
+ 4. Maintainability — will the next developer understand this?
20
+ 5. Test coverage — are edge cases handled?
21
+
22
+ ## Output format
23
+ ```
24
+ [BLOCKING] path/to/file.ts:42 — Token is logged in plaintext. Remove or mask before logging.
25
+ [SUGGESTION] path/to/file.ts:88 — Extract this into a named function for readability.
26
+ [NITPICK] path/to/file.ts:101 — Prefer `const` here.
27
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Security Auditor
3
+ description: Use when you need a dedicated security audit. Checks for OWASP top 10, injection flaws, auth issues, secrets in code, and insecure dependencies. Invoke before any security-sensitive release.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are a security engineer auditing code for vulnerabilities.
8
+
9
+ ## Behavior
10
+ - Assume hostile input at every boundary
11
+ - Flag anything suspicious even if not confirmed vulnerable
12
+ - Reference OWASP categories where relevant
13
+ - Never suggest security theater — only real mitigations
14
+
15
+ ## What to look for
16
+ - Injection: SQL, command, LDAP, XPath
17
+ - Auth issues: missing checks, insecure token handling, weak sessions
18
+ - Sensitive data: secrets in code/logs, unencrypted storage
19
+ - Insecure dependencies: known CVEs
20
+ - Input validation: missing sanitization, unchecked file uploads
21
+ - CORS/CSP misconfigurations
22
+
23
+ ## Output format
24
+ ```
25
+ [CRITICAL] src/db.ts:14 — Raw user input interpolated into SQL query. Use parameterized queries.
26
+ [HIGH] src/auth.ts:88 — JWT secret hardcoded. Move to environment variable.
27
+ [MEDIUM] src/upload.ts:32 — File extension not validated. Restrict to allowed types.
28
+ ```
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Stage and commit current changes
3
+ ---
4
+
5
+ Stage and commit the current changes.
6
+
7
+ ## Steps
8
+ 1. Run `git status` — understand what changed
9
+ 2. Run `git diff` — read the actual changes
10
+ 3. Stage relevant files by name (never `git add -A` blindly)
11
+ 4. Write the commit message following the rules below
12
+ 5. Commit
13
+
14
+ ## Commit message rules
15
+ - One sentence, imperative mood ("Add X", "Fix Y", "Remove Z")
16
+ - Focus on the *why* or *what*, not the mechanics
17
+ - No `Co-Authored-By` lines
18
+ - No AI attribution ("Generated by", "Claude", etc.)
19
+ - No trailing blank lines or extra metadata
20
+
21
+ ## Format
22
+ Subject only when self-explanatory:
23
+ ```
24
+ Add rate limiting to the auth endpoint
25
+ ```
26
+
27
+ Subject + body when context is non-obvious:
28
+ ```
29
+ Switch session store from memory to Redis
30
+
31
+ Memory store resets on every deploy, logging out all active users.
32
+ ```
33
+
34
+ ## What NOT to do
35
+ - No "Updated files" or "Made changes"
36
+ - No listing every file touched
37
+ - No referencing the task/ticket in the subject (put it in body if needed)
38
+ - No co-author or AI attribution lines
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: Run pre-deploy checklist before shipping
3
+ ---
4
+
5
+ Prepare this branch for deployment.
6
+
7
+ Run in order:
8
+ 1. `npm run lint` — fix any errors before continuing
9
+ 2. `npm test` — all tests must pass
10
+ 3. `npm run build` — build must succeed
11
+ 4. Summarize what's being deployed and flag anything risky
12
+
13
+ Do not proceed past any failing step. Report the failure clearly.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Fix a GitHub issue
3
+ argument-hint: <issue-url-or-number>
4
+ ---
5
+
6
+ Fix the GitHub issue described below.
7
+
8
+ Steps:
9
+ 1. Read the issue carefully
10
+ 2. Find the relevant code
11
+ 3. Understand root cause before writing any fix
12
+ 4. Write the fix with a test that would have caught the bug
13
+ 5. Summarize what was wrong and what changed
14
+
15
+ Issue: $ARGUMENTS
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Create a pull request for the current branch
3
+ ---
4
+
5
+ Create a pull request for the current branch.
6
+
7
+ ## Steps
8
+ 1. Run `git log main..HEAD` — understand what commits are included
9
+ 2. Run `git diff main..HEAD` — read all the changes
10
+ 3. Draft a PR title (under 70 characters, imperative mood)
11
+ 4. Write a PR body with:
12
+ - **What** changed and **why**
13
+ - Any important implementation decisions
14
+ - How to test it manually
15
+ 5. Run `gh pr create` with the title and body
16
+
17
+ ## PR title rules
18
+ - Imperative mood: "Add X", "Fix Y", "Remove Z"
19
+ - Under 70 characters
20
+ - No issue numbers in the title (put them in the body)
21
+
22
+ ## PR body format
23
+ ```
24
+ ## What
25
+ [1-3 sentences on what changed]
26
+
27
+ ## Why
28
+ [The motivation — bug, feature request, tech debt]
29
+
30
+ ## Test plan
31
+ - [ ] [Manual step to verify it works]
32
+ - [ ] [Edge case to check]
33
+ ```
34
+
35
+ ## What NOT to do
36
+ - No AI attribution in the PR body
37
+ - No listing every file changed
38
+ - No "as per your request" or similar filler
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Review staged changes before committing
3
+ ---
4
+
5
+ Review the staged changes before I commit.
6
+
7
+ Check for:
8
+ - Bugs or logic errors
9
+ - Security issues (injection, exposed secrets, unsafe input handling)
10
+ - Missing edge cases
11
+ - Code style inconsistencies with the rest of the project
12
+ - Anything that should be tested but isn't
13
+
14
+ Be specific. Point to line numbers. Don't summarize what the code does — I can read it.
@@ -0,0 +1,27 @@
1
+ # API Conventions
2
+
3
+ <!-- Customize for your API style -->
4
+
5
+ ## REST
6
+ - Plural nouns for resources: `/users`, `/posts`
7
+ - HTTP verbs correctly: GET (read), POST (create), PUT (replace), PATCH (update), DELETE
8
+ - 200 for success, 201 for created, 400 for bad input, 401 for unauth, 404 for not found, 500 for server error
9
+ - Always return JSON, even for errors
10
+
11
+ ## Error responses
12
+ ```json
13
+ {
14
+ "error": {
15
+ "code": "USER_NOT_FOUND",
16
+ "message": "No user with id 123"
17
+ }
18
+ }
19
+ ```
20
+
21
+ ## Versioning
22
+ - Version in URL path: `/v1/users`
23
+ - Never break existing endpoints — add new ones instead
24
+
25
+ ## Auth
26
+ - Bearer token in `Authorization` header
27
+ - Never log tokens or passwords
@@ -0,0 +1,25 @@
1
+ # Code Style
2
+
3
+ <!-- Customize these rules to match your project -->
4
+
5
+ ## General
6
+ - Prefer explicit variable names over short ones
7
+ - No magic numbers — use named constants
8
+ - Max function length: ~40 lines. If longer, split it.
9
+ - Delete dead code instead of commenting it out
10
+
11
+ ## TypeScript / JavaScript
12
+ - `const` over `let`, never `var`
13
+ - Arrow functions for callbacks
14
+ - Async/await over `.then()` chains
15
+ - No `any` types without a comment explaining why
16
+
17
+ ## Python
18
+ - Type hints on all function signatures
19
+ - f-strings over `.format()` or `%`
20
+ - `pathlib` over `os.path`
21
+
22
+ ## CSS
23
+ - BEM naming for class names
24
+ - Variables in `:root` for all colors and spacing tokens
25
+ - Mobile-first media queries
@@ -0,0 +1,19 @@
1
+ # Testing
2
+
3
+ ## Rules
4
+ - Every bug fix needs a test that would have caught it
5
+ - Test behavior, not implementation details
6
+ - One assertion per test where possible
7
+ - Test names describe the scenario: `it('returns null when user not found')`
8
+
9
+ ## Structure
10
+ - Unit tests live next to the code: `foo.ts` → `foo.test.ts`
11
+ - Integration tests in `tests/integration/`
12
+ - No mocking internal modules — only mock at system boundaries (HTTP, DB, filesystem)
13
+
14
+ ## Commands
15
+ ```bash
16
+ npm test # run all tests
17
+ npm test -- --watch # watch mode
18
+ npm test -- --coverage
19
+ ```
@@ -0,0 +1,28 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm run *)",
5
+ "Bash(npx *)",
6
+ "Bash(node *)",
7
+ "Bash(git status)",
8
+ "Bash(git diff*)",
9
+ "Bash(git log*)",
10
+ "Bash(git add *)",
11
+ "Bash(git commit*)",
12
+ "Bash(git branch*)",
13
+ "Bash(git checkout *)",
14
+ "Bash(git stash*)",
15
+ "Bash(ls *)",
16
+ "Bash(cat *)",
17
+ "Bash(echo *)"
18
+ ],
19
+ "deny": [
20
+ "Bash(rm -rf *)",
21
+ "Bash(git push --force*)",
22
+ "Bash(git reset --hard*)",
23
+ "Bash(chmod 777 *)",
24
+ "Bash(curl * | bash)",
25
+ "Bash(wget * | bash)"
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: example
3
+ description: Placeholder skill — replace with your own. Shows the .claude/skills/ layout.
4
+ ---
5
+
6
+ # Example Skill
7
+
8
+ This placeholder exists so the `skills/` directory ships reliably (empty
9
+ directories don't survive packaging). Replace it with a real skill: set a
10
+ clear `name` and `description` in the frontmatter above, then write the
11
+ instructions Claude should follow when the skill is invoked.
@@ -0,0 +1,57 @@
1
+ # Project
2
+
3
+ <!-- Replace with a 2-3 sentence description of your project -->
4
+ A [type] application that [does what] for [who].
5
+ Built with [stack]. Deployed on [platform].
6
+
7
+ ## Stack
8
+
9
+ <!-- List your main technologies -->
10
+ - Language:
11
+ - Framework:
12
+ - Database:
13
+ - Hosting:
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ # Install dependencies
19
+ npm install
20
+
21
+ # Run dev server
22
+ npm run dev
23
+
24
+ # Run tests
25
+ npm test
26
+
27
+ # Build for production
28
+ npm run build
29
+
30
+ # Lint
31
+ npm run lint
32
+ ```
33
+
34
+ ## Project structure
35
+
36
+ <!-- How this repo is organized -->
37
+ - `src/` — application source
38
+ - `tests/` — test files
39
+ - `docs/` — documentation
40
+
41
+ ## Rules
42
+
43
+ <!-- Non-obvious constraints Claude must follow -->
44
+ - Follow existing code style — don't introduce new patterns without discussion
45
+ - Write tests for all new functionality
46
+ - Never modify generated files
47
+ - Prefer explicit over clever
48
+
49
+ ## Important context
50
+
51
+ <!-- Anything Claude needs to know that isn't obvious from the code -->
52
+ -
53
+
54
+ ## What NOT to do
55
+
56
+ <!-- Guard rails — common mistakes to avoid in this codebase -->
57
+ -
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: argus-code
3
+ Version: 0.2.0
4
+ Summary: Local-first dashboard for Claude Code cost, token, tool-usage, and full-text search analytics
5
+ Project-URL: Homepage, https://github.com/KrishBhimani/argus-code
6
+ Project-URL: Repository, https://github.com/KrishBhimani/argus-code.git
7
+ Project-URL: Issues, https://github.com/KrishBhimani/argus-code/issues
8
+ Author: Krish Bhimani
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Krish Bhimani
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ License-File: NOTICE
32
+ Keywords: ai-tools,analytics,anthropic,claude,claude-code,cli,cost,dashboard,llm,local-first,tokens,usage
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Environment :: Console
35
+ Classifier: Environment :: Web Environment
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: MacOS
39
+ Classifier: Operating System :: Microsoft :: Windows
40
+ Classifier: Operating System :: POSIX :: Linux
41
+ Classifier: Programming Language :: Python :: 3.11
42
+ Classifier: Programming Language :: Python :: 3.12
43
+ Classifier: Programming Language :: Python :: 3.13
44
+ Requires-Python: >=3.11
45
+ Requires-Dist: fastapi>=0.115
46
+ Requires-Dist: httpx>=0.27
47
+ Requires-Dist: pydantic>=2.9
48
+ Requires-Dist: typer>=0.12
49
+ Requires-Dist: uvicorn[standard]>=0.32
50
+ Requires-Dist: watchdog>=5.0
51
+ Description-Content-Type: text/markdown
52
+
53
+ # Argus
54
+
55
+ **Local-first analytics + persistent archive for Claude Code.** Argus reads
56
+ your `~/.claude/` session logs, computes cost from a bundled pricing table,
57
+ and serves a dashboard at `http://localhost:4242` that tells you exactly how,
58
+ when, and how much you've been using Claude Code.
59
+
60
+ Claude Code rotates its own session files (`cleanupPeriodDays` defaults to
61
+ 30). Once Argus ingests a session into `~/.argus/argus.db`, the row stays
62
+ forever — so a few months in, Argus knows about sessions Claude has already
63
+ deleted. Live tools like `ccusage` can only show what's currently on disk;
64
+ Argus accumulates.
65
+
66
+ Everything stays on your machine. No telemetry, no API calls, no
67
+ embeddings — just SQLite and a static web UI.
68
+
69
+ ```sh
70
+ pipx install argus-code # or: uv tool install argus-code
71
+ argus start
72
+ ```
73
+
74
+ That's it. Your default browser opens to the dashboard once the first-pass
75
+ ingest finishes (~5–10s for a typical install).
76
+
77
+ ## What it shows you
78
+
79
+ | Page | What it answers |
80
+ |---|---|
81
+ | **Overview** | How many tokens have I burned? How much would I have paid on the API? Where does my spend land each day? Plus a **"What needs attention"** card that surfaces detector findings (e.g. a tool whose error rate spiked this week). |
82
+ | **Sessions** | Sortable table of every session — project, model, tokens, cost, duration. Click any row to drill in. |
83
+ | **Tools** | Tool-call leaderboard (Bash vs Edit vs Read vs WebFetch…), error rates per tool, MCP server breakdown, sub-agent invocations. |
84
+ | **Search** *(opt-in)* | Full-text search over every prompt you've typed AND every assistant response, your replies, and tool output. SQLite FTS5, sub-millisecond, no embeddings. |
85
+ | **Trends** | Tokens and cost bucketed by day / week / month, grouped by model. |
86
+ | **Models** | Per-model token mix and cost rollup. |
87
+ | **Settings** | Search-indexing toggle, pricing version, parse errors, data export. |
88
+
89
+ ## CLI
90
+
91
+ ```sh
92
+ argus # top-level command group
93
+ ├─ start [--port 4242] [--host 127.0.0.1] [--data-dir <path>]
94
+ │ # watcher + ingester + dashboard server
95
+ ├─ pricing
96
+ │ └─ refresh # pull latest model prices from LiteLLM
97
+ ├─ search
98
+ │ ├─ status # is transcript indexing on?
99
+ │ ├─ enable # turn it on (next start backfills)
100
+ │ ├─ disable # turn it off, keep data
101
+ │ └─ clear # wipe all indexed segments + disable
102
+ ├─ claude # scaffold & manage .claude/ setups
103
+ │ ├─ init [path] [--template <name>] [--force]
104
+ │ │ # stamp CLAUDE.md + .claude/ into a project
105
+ │ └─ template
106
+ │ ├─ list # list templates (bundled + user)
107
+ │ └─ create <name> [--path <dir>] [--all]
108
+ │ # save a project's .claude/ as a template
109
+ └─ wipe # delete ~/.argus/ entirely
110
+ ```
111
+
112
+ Run `--help` at any level for details — `argus --help`, `argus claude --help`,
113
+ `argus claude template --help`.
114
+
115
+ ### `argus claude` — project scaffolding
116
+
117
+ Set good agent config *before* you run, not just observe it after. `init`
118
+ copies a template into a project: `CLAUDE.md` goes to the project root,
119
+ everything else into `.claude/`. Existing files are skipped (use `--force`
120
+ to overwrite) — but an existing `CLAUDE.md` is **never** overwritten, even
121
+ with `--force`. The bundled `default` template ships a sensible
122
+ `settings.json`, agents, commands, rules, and a placeholder skill. Save your
123
+ own project's setup as a reusable template with `template create`; user
124
+ templates live in `~/.argus/templates/` and take precedence over bundled ones.
125
+
126
+ ## Privacy & security
127
+
128
+ Argus is built for one user on one machine. The defaults reflect that:
129
+
130
+ - **Server binds to `127.0.0.1` only.** Nothing on your LAN/Wi-Fi/VPN can
131
+ reach the dashboard. Use `argus start --host 0.0.0.0` if you really
132
+ want LAN exposure — it prints a loud warning when you do.
133
+ - **No external requests, ever**, except `argus pricing refresh` which
134
+ is a manual command that fetches one JSON file from LiteLLM's GitHub.
135
+ No telemetry, no analytics pings, no LLM calls.
136
+ - **Transcript indexing is opt-in.** Cost-and-token analytics work out of
137
+ the box without indexing any text content. Full-text search across
138
+ prompts and transcripts requires explicit opt-in via Settings or
139
+ `argus search enable`. Opting out actually means out — the API
140
+ returns empty results, even if data is on disk.
141
+ - **Cross-origin POSTs are rejected.** The state-changing endpoints
142
+ (`/api/search-index/*`) check the `Origin` header so a random tab in
143
+ your browser can't silently wipe your data while argus is running.
144
+ - **No embeddings, no model weights.** Search uses SQLite FTS5 — pure
145
+ inverted-index lexical search. Lookups are deterministic and offline.
146
+
147
+ Data lives at `~/.argus/argus.db`. Delete it any time with `argus wipe`
148
+ (or just remove the file).
149
+
150
+ For vulnerability reports, see [SECURITY.md](./SECURITY.md).
151
+
152
+ ## How it works
153
+
154
+ 1. **Ingest.** A `watchdog` observer tails every `~/.claude/projects/<project>/<session-id>.jsonl`
155
+ file. Lines are validated with `pydantic`, deduplicated by `message.id`,
156
+ and turned into normalized session/turn rows in SQLite (WAL mode).
157
+ 2. **Cost.** Per-turn cost comes from a bundled `pricing/<version>.json`
158
+ table sourced from [LiteLLM](https://github.com/BerriAI/litellm).
159
+ Tokens are exact; costs are estimates and the dashboard says so.
160
+ 3. **Tools.** Each `tool_use` block in the JSONL becomes a row in
161
+ `tool_calls`. Errors come from matching `tool_result.is_error` in the
162
+ next user message. MCP servers are extracted from tool names matching
163
+ `mcp__<server>__<tool>`.
164
+ 4. **Search (opt-in).** Two FTS5 virtual tables: one over `~/.claude/history.jsonl`
165
+ (every prompt you've ever typed, ~150 KB indexed for a heavy user),
166
+ one over assistant text + thinking blocks + user content + tool
167
+ output (~30–60 MB for hundreds of sessions). Indexing happens
168
+ incrementally during the normal ingest tick.
169
+ 5. **Dashboard.** Astro 5 + ECharts, statically built, served by the
170
+ FastAPI app (uvicorn). No server-side rendering, no Node code in the browser.
171
+ 6. **Detection (alerts).** A lightweight scheduler thread runs registered
172
+ *detectors* on a fixed cadence. Each detector reads the DB and returns
173
+ findings; the scheduler is the sole writer, upserting them into an
174
+ `alerts` table — idempotent, with a `resolved_at` lifecycle so an issue
175
+ that recovers then recurs fires again instead of staying silent. The
176
+ Overview's "What needs attention" card reads these, and critical findings
177
+ raise a browser notification. The v1 detector flags tools whose error rate
178
+ spiked versus their preceding 4-week baseline.
179
+
180
+ ## Configuration
181
+
182
+ | Where | Knob |
183
+ |---|---|
184
+ | `argus start --port <n>` | Pick a different port (default 4242). |
185
+ | `argus start --host <h>` | Bind host (default `127.0.0.1`). Pass `0.0.0.0` for LAN exposure. |
186
+ | `argus start --data-dir <path>` | Override `~/.argus/`. |
187
+ | `pricing/*.json` | Bundled price tables. Refresh with `argus pricing refresh`. |
188
+
189
+ ## Requirements
190
+
191
+ - **Python ≥ 3.11.** Argus uses the stdlib `sqlite3` module — make sure
192
+ your Python was built with FTS5 (the standard CPython distributions
193
+ for macOS, Linux, and Windows all are). Argus checks at startup and
194
+ fails with a clear error if FTS5 is missing.
195
+ - A `~/.claude/` directory containing real session JSONL — i.e. you've
196
+ used Claude Code at least once. Argus exits with a friendly message
197
+ if it's missing.
198
+
199
+ ## Keep your history longer
200
+
201
+ By default Claude Code deletes session files after 30 days. To extend the
202
+ window, set `cleanupPeriodDays` in `~/.claude/settings.json`:
203
+
204
+ ```json
205
+ {
206
+ "cleanupPeriodDays": 365
207
+ }
208
+ ```
209
+
210
+ The minimum is 1; there's no way to disable cleanup entirely. Whatever you
211
+ set, Argus's own database keeps the data even after Claude rotates it out.
212
+
213
+ ## Development
214
+
215
+ ```sh
216
+ git clone https://github.com/KrishBhimani/argus-code.git
217
+ cd argus-code
218
+ uv sync # install deps + create venv
219
+ uv run pytest # ~215 tests, ~20s
220
+ uv run argus start # dev — runs directly from source
221
+ ```
222
+
223
+ The dashboard is an Astro project under `dashboard/` and still builds via
224
+ `npm` at release time only. End users never touch npm.
225
+
226
+ Source layout:
227
+
228
+ ```
229
+ python/argus/ Python ingest, store, server, CLI
230
+ adapters/ Claude Code JSONL parsers + adapter registry
231
+ store/ SQLite schema + migrations + repo
232
+ server/ FastAPI app + /api routes
233
+ collector/ watcher + pipeline + first-run + search backfill + alert scheduler
234
+ detectors/ alert detectors (pure reads) + @register registry
235
+ scaffold/ `argus claude` template storage / init / snapshot
236
+ pricing/ LiteLLM-derived price table + cost compute
237
+ schema/ pydantic data models
238
+ dashboard/ Astro source
239
+ dashboard-dist/ Astro build output (shipped in wheel as data)
240
+ pricing/ Bundled pricing JSON (shipped in wheel as data)
241
+ templates/ Bundled .claude/ scaffolding templates (shipped in wheel as data)
242
+ tests/ pytest suite, mirrors python/argus/ layout
243
+ ```
244
+
245
+ ## License
246
+
247
+ MIT — see [LICENSE](./LICENSE).