@akasecurity/ai-tc-claude-code 0.8.1

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "aka",
3
+ "version": "0.8.1",
4
+ "description": "AI Traffic Control — inspect and govern AI prompts in Claude Code. Detection runs locally; events are recorded to a local SQLite store on your machine.",
5
+ "homepage": "https://github.com/akasecurity/ai-tc",
6
+ "author": { "name": "AKA Security" }
7
+ }
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 AKA Security
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @akasecurity/ai-tc-claude-code — the `aka` plugin for Claude Code
2
+
3
+ [![npm](https://img.shields.io/npm/v/@akasecurity/ai-tc-claude-code?style=flat-square&labelColor=232F3E&color=00E0B8)](https://www.npmjs.com/package/@akasecurity/ai-tc-claude-code)
4
+ [![Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-232F3E?style=flat-square)](https://github.com/akasecurity/ai-tc/blob/main/LICENSE)
5
+
6
+ The Claude Code plugin for **[AI Traffic Control](https://github.com/akasecurity/ai-tc)** (`ai-tc`). It hooks into a Claude Code session and inspects its traffic — prompts, tool calls, tool results, file reads — scanning each event against your rule packs and applying inline **warn / redact / block** policies. Every event is recorded to a local SQLite store at `~/.aka/data/aka.db`.
7
+
8
+ Detection runs entirely on your machine. There's no account and no backend — nothing leaves your computer to be scanned.
9
+
10
+ ## Install
11
+
12
+ This package is distributed through the **Claude Code plugin marketplace**, not `npm install`. Add the marketplace and install the plugin from inside Claude Code:
13
+
14
+ ```text
15
+ /plugin marketplace add akasecurity/marketplace
16
+ /plugin install aka@akasecurity
17
+ ```
18
+
19
+ Or let the `aka` CLI do it for you:
20
+
21
+ ```bash
22
+ npm install -g @akasecurity/cli
23
+ aka plugins install claude-code
24
+ ```
25
+
26
+ Then run `aka init` to scaffold the local store, and `aka dashboard` to view findings.
27
+
28
+ ## What it registers
29
+
30
+ The plugin installs Claude Code hooks that run locally with no `node_modules`, and fail open (a hook error never breaks your session):
31
+
32
+ - **SessionStart** — snapshot the session context.
33
+ - **UserPromptSubmit** — scan prompts before they reach the model.
34
+ - **PreToolUse** — scan tool inputs (Bash, Edit, Write, WebFetch) before they run.
35
+ - **PostToolUse** — scan tool outputs and file reads (Bash, Read, WebFetch) after they return.
36
+ - **Stop** — reconcile token usage and finalize the session record.
37
+
38
+ It also adds slash commands for reports and setup (`/aka:health`, `/aka:findings`, `/aka:dashboard`, and more).
39
+
40
+ ## Docs
41
+
42
+ Full documentation and the built-in detection catalog live at **[akasecurity.github.io/ai-tc-docs](https://akasecurity.github.io/ai-tc-docs/)**.
43
+
44
+ ## License
45
+
46
+ [Apache-2.0](https://github.com/akasecurity/ai-tc/blob/main/LICENSE)
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: Show AKA's recent enforcement decisions
3
+ ---
4
+
5
+ # AKA audit
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: it is a space-aligned monospace table that Markdown would
11
+ otherwise collapse. Do not reformat or re-narrate the rows.
12
+
13
+ ```bash
14
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" audit
15
+ ```
16
+
17
+ This is the decision log: the most recent detections from `~/.aka/data/aka.db`
18
+ with the action AKA took (block / redact / warn / allow), the rule, and where it
19
+ fired (source tool + event kind). It is read-only.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Launch the AKA web dashboard in your browser (reads your local store)
3
+ ---
4
+
5
+ # AKA dashboard
6
+
7
+ Launch the AKA web dashboard and relay the short status the script prints **as-is**.
8
+ The command returns immediately: it starts the dashboard server in the background
9
+ and it opens in the browser once ready, so a lack of further output is **not** an
10
+ error — do not wait on it or re-run it. If the script prints install guidance (the
11
+ `aka` CLI isn't installed), relay that verbatim.
12
+
13
+ If the user asked for a specific port, pass `--port <N>` through unchanged;
14
+ otherwise run it with no arguments.
15
+
16
+ ```bash
17
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/dashboard.js" [--port <N>]
18
+ ```
19
+
20
+ This mirrors the `aka dashboard` CLI command: it serves the OSS web-ui against
21
+ your local store at `~/.aka/data` (no backend) and opens
22
+ `http://localhost:4319/security`. The web server is bundled in the
23
+ `@akasecurity/cli` package — the plugin ships no server of its own — so the
24
+ launcher delegates to the `aka` CLI and, if it isn't installed, prints how to get
25
+ it. For the terminal-only read surfaces, use `/aka:health`, `/aka:findings`,
26
+ `/aka:recommend`, `/aka:audit` or `/aka:tokens` instead.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: List installed AKA detection packs, versions, and available updates
3
+ ---
4
+
5
+ # AKA detections
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: it is a space-aligned monospace table that Markdown would
11
+ otherwise collapse. Do not reformat the columns or restate each row.
12
+
13
+ ```bash
14
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" detections
15
+ ```
16
+
17
+ This lists the detection packs installed in `~/.aka/data/aka.db` — one row per
18
+ pack with its installed version, the latest version this plugin ships, rule
19
+ count, enabled state, assigned enforcement policy, and whether an update is
20
+ available. These packs are what the plugin actually scans with.
21
+
22
+ Detection updates are **never applied automatically** — a plugin upgrade only
23
+ records what's newly available; the installed packs keep running unchanged
24
+ until the user updates them. This command is strictly **read-only**: do not
25
+ apply, enable, disable, or re-policy a detection from here. If the user wants
26
+ to update, tell them to run one of these themselves in a terminal:
27
+
28
+ - `aka detections update --all` — update every pack
29
+ - `aka detections update <pack-id>` — update one pack
30
+ - `aka dashboard` → Detections → **Update** — review and apply in the dashboard
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: List active AKA detection exceptions (masked) from the local store
3
+ ---
4
+
5
+ # AKA exceptions
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: it is a space-aligned monospace table that Markdown would
11
+ otherwise collapse. Do not reformat the columns or restate each row.
12
+
13
+ ```bash
14
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" exceptions
15
+ ```
16
+
17
+ This lists the **active** detection exceptions from `~/.aka/data/aka.db` — the
18
+ masked value, rule, scope, relative expiry, use count, and who granted it. The
19
+ approved value is never stored, only a keyed fingerprint and a masked preview.
20
+
21
+ This command is strictly **read-only**. Do not offer to create, approve, or
22
+ revoke an exception from here — creation and revocation happen only in a
23
+ terminal, out-of-band, via the `aka` CLI (`aka exception approve`,
24
+ `aka exception revoke <id>`; see `aka exception --help`). If the user asks you
25
+ to grant or revoke one, tell them to run those commands themselves in a
26
+ terminal instead.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: List recent AKA findings (masked) from the local store
3
+ ---
4
+
5
+ # AKA findings
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: it is a space-aligned monospace table that Markdown would
11
+ otherwise collapse. Do not reformat the columns or restate each row.
12
+
13
+ If the user asked to filter by severity — e.g. `--critical`, `--high`,
14
+ `--medium`, `--low`, or `--severity <level>` — pass that flag through to the
15
+ script unchanged. Otherwise run it with no flag.
16
+
17
+ ```bash
18
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" findings [--severity <critical|high|medium|low>]
19
+ ```
20
+
21
+ This lists the most recent findings from `~/.aka/data/aka.db` with their rule,
22
+ category, severity, action taken, and the **masked** match (raw secrets are
23
+ never stored), narrowed to one severity when a filter is given. It is read-only.
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Show AKA detection activity and local security posture
3
+ ---
4
+
5
+ # AKA health
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: it is space-aligned monospace (gauges, bars, a 7-day chart)
11
+ that Markdown would otherwise collapse. Do not reformat or summarize the table;
12
+ you may add at most one short sentence of context after it.
13
+
14
+ ```bash
15
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" health
16
+ ```
17
+
18
+ This reads the local store at `~/.aka/data/aka.db` (detection activity, action
19
+ breakdown, category coverage, last 7 days). It is read-only. If the store is
20
+ empty, the script says so — relay that as-is; nothing is wrong.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Surface AKA's top recommendations from recent findings
3
+ ---
4
+
5
+ # AKA recommend
6
+
7
+ Run the read script and show the user its output **exactly as printed**. The
8
+ script already prints its content inside a Markdown code fence — reproduce that
9
+ verbatim and do **not** add another code fence, strip the fence, or reformat it.
10
+ The fence is required: the output is space-aligned monospace whose lines start
11
+ with characters like `1.` and `●`; shown unfenced, Markdown collapses the
12
+ indentation and turns those into auto-numbered lists and bullets. You may expand
13
+ on the suggested next steps if the user asks, but lead with the output as-is.
14
+
15
+ ```bash
16
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/query.js" recommend
17
+ ```
18
+
19
+ This groups recent findings by category (ranked by severity, then frequency) and
20
+ prints a plain-language next step for each. It is read-only over
21
+ `~/.aka/data/aka.db`.
@@ -0,0 +1,69 @@
1
+ ---
2
+ description: Scan working-tree source files for code security flaws
3
+ ---
4
+
5
+ # AKA scan
6
+
7
+ ## Single-repo scan (default)
8
+
9
+ Run the worktree scan script and show the user its output **exactly as printed**.
10
+ The script already prints its content inside a Markdown code fence — reproduce
11
+ that verbatim and do **not** add another code fence, strip the fence, or reformat it.
12
+ The fence is required: it is space-aligned monospace that Markdown would otherwise
13
+ collapse.
14
+
15
+ ```bash
16
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/filescan.js" --dir "${PWD}"
17
+ ```
18
+
19
+ This scans all source files (`.ts`, `.js`, `.py`, `.java`, `.rb`, `.cs`, `.go`,
20
+ `.rs`, `.php`, and more) under the current project directory for insecure code
21
+ patterns — SQL injection, command injection, XSS, insecure deserialization, weak
22
+ cryptography, hardcoded credentials, dev-mode configuration leaks, and other
23
+ OWASP Top 10 issues.
24
+
25
+ Results are recorded to the local store (`~/.aka/data/aka.db`) and are visible
26
+ via `/findings`. Re-running `/aka:scan` is safe — files whose content has already
27
+ been recorded are skipped.
28
+
29
+ Files excluded by the repo's `.gitignore` are **still scanned** — local scratch
30
+ and generated files are a common place for real secrets to hide — but their
31
+ findings are marked as coming from gitignored content and reported as
32
+ informational in the summary.
33
+
34
+ To exclude paths from scanning entirely, add a `.akaignore` file (gitignore
35
+ syntax, any directory level). Unlike `.gitignore`, `.akaignore` is a **hard
36
+ skip**: matching files are never read and produce no findings. A negation also
37
+ re-includes a directory the scanner skips by default — e.g. `!vendor/` scans
38
+ first-party code living under `vendor/`.
39
+
40
+ ## Multi-repo scan (opt-in)
41
+
42
+ To scan **all git repositories** found under the current directory (up to 4
43
+ directory levels deep), use the `--discover` flag:
44
+
45
+ ```bash
46
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/filescan.js" --discover
47
+ ```
48
+
49
+ To search from a different directory, pass `--root` (and optionally `--depth`):
50
+
51
+ ```bash
52
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/filescan.js" --discover --root ~/projects --depth 3
53
+ ```
54
+
55
+ Discovery walks the filesystem from the search root looking for `.git`
56
+ directories. It skips large system directories (`Library`, `node_modules`, etc.)
57
+ and stops recursing once a repo root is found (submodules are not separately
58
+ enumerated). The output shows a per-repository breakdown in addition to the
59
+ aggregate totals.
60
+
61
+ **Scope confirmation:** `--discover` never sweeps the home directory implicitly —
62
+ the default root is the current directory. Before passing a `--root` outside the
63
+ current project (especially `--root ~`, the whole-machine sweep), tell the user
64
+ what will be read and ask for explicit confirmation. Do not assume consent from
65
+ a generic "scan everything" phrasing without naming the scope.
66
+
67
+ Deduplication is global across all repos in a single `--discover` run — a file
68
+ whose content hash is already recorded (from a previous scan or a live hook
69
+ capture) is skipped regardless of which repo it lives in.
@@ -0,0 +1,143 @@
1
+ ---
2
+ description: Set up the AKA Control Plane plugin — redaction handling and historical access
3
+ ---
4
+
5
+ # AKA setup wizard
6
+
7
+ You are onboarding the AKA Control Plane plugin for this machine. AKA works
8
+ fully locally with **zero backend and zero Docker**: detection runs in-process
9
+ and findings persist to a local SQLite store at `~/.aka/data/aka.db`. This
10
+ wizard records two preferences. Ask the questions in order, then save once.
11
+
12
+ ## 0. Show the intro card
13
+
14
+ Run the intro script and show the user its output **exactly as printed** — it is a
15
+ space-aligned monospace card (name, repository, version, what AKA adds). The script
16
+ already prints it inside a Markdown code fence; reproduce that verbatim and do
17
+ **not** add another code fence, strip the fence, or reformat it (unfenced, Markdown
18
+ collapses the indentation and mangles the `●` line). Then continue with the two
19
+ questions below.
20
+
21
+ ```bash
22
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/intro.js" "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json"
23
+ ```
24
+
25
+ ## 1. Ask the two questions
26
+
27
+ Use the **AskUserQuestion** tool — Claude Code's built-in interactive picker — to
28
+ ask both questions. The plugin can't draw its own selectable UI (it can't
29
+ capture keystrokes), so do **not** print a fake option list or ask the user to
30
+ "reply with a number"; let the picker collect the answers.
31
+
32
+ Ask these two questions (a single AskUserQuestion call with both is fine):
33
+
34
+ **Sensitive-data handling** — "When AKA detects sensitive data on its way to a model, it should:"
35
+
36
+ - **Actively redact** → `redact` _(recommended)_ — replace secrets with safe
37
+ placeholders before the request is sent.
38
+ - **Warn only** → `warn` — flag the request and let the user decide; nothing is
39
+ modified automatically. (Either mode can be changed per-project later.)
40
+
41
+ **Historical & memory access** — "Secrets often leak before AKA is installed. May I also review your temp files, agent memory & prior conversation transcripts?"
42
+
43
+ List **Grant full review** as the first (top) option:
44
+
45
+ - **Grant full review** → `full` — scan scratch/temp files, agent memory & prior
46
+ transcripts for leaked secrets (deepest coverage · one-time consent, revocable
47
+ under Policies).
48
+ - **Current session only** → `session-only` — decline historical access; AKA
49
+ reviews only what this session already touches. Even if declined, AKA can still
50
+ review: the **working tree** (all source, config & dotfiles in the repo), **this
51
+ session** (prompts, tool calls & files Claude reads or writes now), **git
52
+ history** (commits reachable from HEAD, incl. removed-but-tracked secrets), and
53
+ **pointed scans** (any path you explicitly hand AKA during a run).
54
+
55
+ Map the picked labels to the flag values shown above (`redact`/`warn`,
56
+ `full`/`session-only`).
57
+
58
+ ## 2. Save the answers
59
+
60
+ Run the onboarding writer with the chosen values. Omit a flag to keep its
61
+ default. This validates and persists to `~/.aka/settings/settings.json` (created
62
+ `0600`, owner-only) and stamps the machine as onboarded:
63
+
64
+ ```bash
65
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/onboard.js" --policy <redact|warn> --historical <full|session-only>
66
+ ```
67
+
68
+ ## 2.5 Scan history (only if they granted full review)
69
+
70
+ **Only when the user picked "Grant full review" (`historical=full`)**, run the
71
+ backfill. It sweeps prior Claude Code transcripts (last 30 days, all projects)
72
+ for secrets that leaked before AKA was installed and records them into the local
73
+ store, so they show up in the first-run summary and `/findings`. The scan is
74
+ idempotent — it skips messages already recorded — so re-running `/aka:setup` is
75
+ safe and never duplicates findings. Show its output **exactly as printed** (it
76
+ self-fences; do not add another fence or reformat). Skip this step entirely when
77
+ they chose `session-only`.
78
+
79
+ ```bash
80
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/backfill.js"
81
+ ```
82
+
83
+ ## 3. Show the first-run summary
84
+
85
+ Run the first-run script and show its output **exactly as printed** (the
86
+ install-complete summary with live findings/recommendation counts and the health
87
+ score). The script already prints it inside a Markdown code fence; reproduce that
88
+ verbatim and do **not** add another code fence, strip the fence, or reformat it (it
89
+ is space-aligned monospace that Markdown would otherwise collapse).
90
+
91
+ ```bash
92
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/firstrun.js"
93
+ ```
94
+
95
+ ## 3.5 Offer the AKA CLI + local dashboard (opt-in)
96
+
97
+ Now that the plugin is set up, offer the optional **AKA CLI + local dashboard** —
98
+ a richer, still-fully-local surface over the same `~/.aka` store this plugin
99
+ writes. The plugin works completely on its own; this is additive (and the path to
100
+ future multi-agent support). Use **AskUserQuestion**:
101
+
102
+ **Add the AKA CLI + dashboard?** — "Install the `aka` CLI for a local web +
103
+ terminal dashboard and on-demand scans? Everything stays on your machine."
104
+
105
+ - **Yes, install it** _(recommended)_ — adds the `aka` binary: `aka stats`,
106
+ `aka tui` (terminal dashboard), `aka dashboard` (local web UI), `aka scan`.
107
+ - **Not now** — skip; it can be added anytime with the one-liner below.
108
+
109
+ If they choose **Yes**, run the bootstrap installer (it ensures Node is available
110
+ and installs the global CLI from the public npm registry). **Ask permission
111
+ before running it**, then run the line for their OS:
112
+
113
+ ```bash
114
+ # macOS / Linux
115
+ curl -fsSL https://raw.githubusercontent.com/akasecurity/ai-tc/cli-latest/tools/installer/install.sh | sh
116
+
117
+ # Windows (PowerShell)
118
+ irm https://raw.githubusercontent.com/akasecurity/ai-tc/cli-latest/tools/installer/install.ps1 | iex
119
+ ```
120
+
121
+ The one-liner pins to the stable release **tag** (`cli-latest`), never `main` —
122
+ each release points that tag at its published `cli-v*` version, and the bootstrap
123
+ scripts it fetches hold the installer's pinned ref + checksum, so fetching them
124
+ from a mutable branch would defeat the integrity gate. To pin an exact version
125
+ instead, set `AKA_INSTALL_REF=cli-v<version>` before running the line. Until the
126
+ first release is published the one-liner 404s (fail-closed).
127
+
128
+ After it completes, point them at `aka init` then `aka dashboard`. If they chose
129
+ **Not now**, show the one-liner once so they can add it later, and move on —
130
+ declining keeps the plugin fully functional standalone.
131
+
132
+ **Fail open.** This install is optional, so it must never derail the session. If
133
+ the installer fails for any reason — Node missing, network/registry error, a
134
+ non-zero exit, or the checksum check rejecting a bad download — briefly report
135
+ what happened, show the one-liner so they can retry later, and continue the
136
+ wizard normally. The plugin is already fully set up and works on its own; a
137
+ failed CLI install changes nothing about that.
138
+
139
+ ## 4. Report the result
140
+
141
+ - The first-run summary already confirms the saved handling and points at
142
+ `/health`. Add at most one short sentence: detection runs locally and nothing
143
+ leaves the machine.