@rosh100yx/outlier 0.2.3 → 0.3.0
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.
- package/README.md +25 -11
- package/package.json +9 -2
- package/src/carbon.ts +17 -1
- package/src/cli.ts +39 -14
package/README.md
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>outlier</h1>
|
|
3
|
-
<p><b>The Governance
|
|
3
|
+
<p><b>The Governance & Policy Engine for AI Engineering</b></p>
|
|
4
4
|
<p><i>Measure AI adoption. Enforce Zero-Trust. Protect Human Mastery.</i></p>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<img src="https://img.shields.io/badge/Compliance-Strict-blue?style=for-the-badge" />
|
|
8
|
+
<img src="https://img.shields.io/badge/AI_Safety-Enabled-green?style=for-the-badge" />
|
|
9
|
+
<img src="https://img.shields.io/badge/Zero_Trust-Verified-orange?style=for-the-badge" />
|
|
10
|
+
<img src="https://img.shields.io/badge/Carbon_Footprint-Tracked-lightgrey?style=for-the-badge" />
|
|
11
|
+
</p>
|
|
5
12
|
</div>
|
|
6
13
|
|
|
7
|
-
`outlier` is
|
|
14
|
+
`outlier` is an open-source, local-first policy engine and governance framework designed to measure the true cost and risk of AI code generation. As teams accelerate with LLM agents (Cursor, Copilot, Claude Code), `outlier` acts as the definitive **Bouncer**—auditing AI authorship, mitigating deskilling risks, and tracking regional carbon footprints entirely locally.
|
|
15
|
+
|
|
16
|
+
**Our Moat:**
|
|
17
|
+
1. **Zero-Trust & Local-First:** No API keys, no telemetry sent to the cloud. `outlier` reads your native `~/.claude/` session logs and `.git/` history directly on your machine.
|
|
18
|
+
2. **Actionable Policy Engine:** We don't just build dashboards. `outlier` lives in your terminal and CI/CD pipelines (via pre-commit hooks and GitHub Actions), physically blocking risky or overly AI-reliant commits.
|
|
19
|
+
3. **Counterfactual Carbon Accounting:** The only observability tool mapping token cache waste directly to your local energy grid (e.g., Global South vs EU), proving true environmental impacts.
|
|
20
|
+
4. **Anti-Deskilling Guardrails:** Built to prevent developers from becoming mere spectators in their own codebase.
|
|
8
21
|
|
|
9
22
|
> *"In a room full of agents" shifts the perspective. It acknowledges that the developer is no longer a solo coder; they are a manager of bots. The product exists to make sure the human doesn't get lazy while managing them. We all want our time back, but we don't want to lose control of the craft.*
|
|
10
23
|
|
|
@@ -26,6 +39,7 @@
|
|
|
26
39
|
```
|
|
27
40
|
|
|
28
41
|
## How It Works
|
|
42
|
+
```text
|
|
29
43
|
┌───────────┐ ┌────────────┐ ┌───────────┐ ┌─────────────┐
|
|
30
44
|
│ AI CODING │──▸│ GIT COMMIT │──▸│ BOUNCER │──▸│ AUDIT TRACE │
|
|
31
45
|
└───────────┘ └────────────┘ └───────────┘ └─────────────┘
|
|
@@ -33,6 +47,7 @@
|
|
|
33
47
|
┌───────────┐
|
|
34
48
|
│ MENTORING │
|
|
35
49
|
└───────────┘
|
|
50
|
+
```
|
|
36
51
|
**Step 1:** Developer delegates code generation to an AI agent (Claude Code, Cursor).
|
|
37
52
|
**Step 2:** Developer attempts to merge code into the main branch.
|
|
38
53
|
**Step 3:** The `outlier` Bouncer hook triggers. If AI reliance > 70%, the commit is physically blocked.
|
|
@@ -62,7 +77,7 @@
|
|
|
62
77
|
|
|
63
78
|
1. **Set the Trap (Install the Bouncer)**
|
|
64
79
|
```bash
|
|
65
|
-
npx
|
|
80
|
+
npx @rosh100yx/outlier policy
|
|
66
81
|
```
|
|
67
82
|
*Select the "Team (70% Max AI)" tier.*
|
|
68
83
|
|
|
@@ -75,16 +90,15 @@
|
|
|
75
90
|
|
|
76
91
|
3. **Measure the Damage**
|
|
77
92
|
```bash
|
|
78
|
-
npx
|
|
93
|
+
npx @rosh100yx/outlier audit
|
|
79
94
|
```
|
|
80
95
|
*See your exact AI Authorship ratio and Token Waste.*
|
|
81
96
|
|
|
82
97
|
## Theoretical Foundations
|
|
83
|
-
`outlier` is
|
|
98
|
+
`outlier` is the live, technical implementation of an academic thesis on the thermodynamics of AI code generation and digital sovereignty.
|
|
99
|
+
- **The Geographic Tax:** Western tech companies ship highly compute-intensive AI tools globally, but local infrastructure in the Global South is forced to absorb the carbon cost. `outlier` proves this by weighting session carbon by regional grid intensity (e.g., proving identical work imports 31x more carbon in Vietnam than France).
|
|
84
100
|
- **Disempowerment:** Incremental AI substitution erodes human influence. `outlier` acts as a sovereignty shield against opaque AI platforms.
|
|
85
|
-
- **
|
|
86
|
-
- **Authorship:** We track AI reliance per-individual via Git parsing, rather than at the population level.
|
|
87
|
-
- **Deskilling:** Delegating operators lose supervisory skills (Bainbridge, 1983). `outlier` specifically flags high AI-authorship as a "Deskilling Risk".
|
|
101
|
+
- **Deskilling:** Delegating operators lose supervisory skills. By parsing `Co-Authored-By` Git trailers, `outlier` tracks AI reliance per-individual and flags high reliance as a "Deskilling Risk", triggering mandatory mentoring checkpoints.
|
|
88
102
|
|
|
89
103
|
## FAQ
|
|
90
104
|
|
|
@@ -95,7 +109,7 @@ No. `outlier` is a zero-trust, local-first engine. It parses `git log` and local
|
|
|
95
109
|
`outlier` is IDE-agnostic. It works by parsing standard `Co-Authored-By` Git trailers, meaning it supports Claude Code, Cursor, Aider, and manual generation.
|
|
96
110
|
|
|
97
111
|
**Can I run this in CI/CD like GitHub Actions?**
|
|
98
|
-
Yes. Use the `--strict` flag (`npx
|
|
112
|
+
Yes. Use the `--strict` flag (`npx @rosh100yx/outlier audit --strict`) to return standard zero-exit-code parsing for headless CI environments.
|
|
99
113
|
|
|
100
114
|
## Who is this for?
|
|
101
115
|
|
|
@@ -108,9 +122,9 @@ If you hold one of these roles, `outlier` was built specifically for you. Please
|
|
|
108
122
|
## Support the Thesis & Collaborate
|
|
109
123
|
This tool is the technical implementation of an ongoing academic thesis on the thermodynamics of AI code generation, skill atrophy, and digital sovereignty. We are actively looking for collaborators, researchers, and engineers to expand this framework.
|
|
110
124
|
|
|
111
|
-
**Call for Research Data:** If you use this tool, please
|
|
125
|
+
**Call for Research Data:** We are actively collecting metrics to prove the "Geographic Tax" and measure industry-wide skill atrophy for our upcoming paper. If you use this tool, please share your terminal screenshot (`outlier audit`) on X.com (tagging the maintainers). By sharing your baseline **AI reliance %** and **carbon estimate**, you provide the exact empirical data we need to map how AI is impacting global engineering teams.
|
|
112
126
|
|
|
113
127
|
See our [Contributing Guide](CONTRIBUTING.md) to get started. Great first issues include adding new regional grid factors to `data/grid-factors.json` or writing custom CI/CD pipeline integrations.
|
|
114
128
|
|
|
115
129
|
## License
|
|
116
|
-
|
|
130
|
+
MIT License
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rosh100yx/outlier",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AI Code Governance & Capability Auditing for the Terminal. Measures AI reliance, context waste, and enforces local CI/CD policies.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"outlier": "bin/outlier.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
-
"bin",
|
|
9
|
+
"bin/outlier.js",
|
|
10
10
|
"src",
|
|
11
11
|
"data"
|
|
12
12
|
],
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
"ai",
|
|
24
24
|
"governance",
|
|
25
25
|
"carbon",
|
|
26
|
+
"compliance",
|
|
27
|
+
"ai-safety",
|
|
28
|
+
"policy-engine",
|
|
29
|
+
"zero-trust",
|
|
30
|
+
"carbon-footprint",
|
|
31
|
+
"global-south",
|
|
32
|
+
"observability",
|
|
26
33
|
"telemetry",
|
|
27
34
|
"authorship",
|
|
28
35
|
"cli"
|
package/src/carbon.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface CarbonStats {
|
|
|
10
10
|
energyKwh: number;
|
|
11
11
|
co2KgVietnam: number;
|
|
12
12
|
co2KgFrance: number;
|
|
13
|
+
localCo2Kg: number;
|
|
14
|
+
localRegion: string;
|
|
13
15
|
sessions: number;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -52,11 +54,22 @@ export class ClaudeLogParser implements TokenLogParser {
|
|
|
52
54
|
|
|
53
55
|
class CursorLogParser implements TokenLogParser {
|
|
54
56
|
async parse() {
|
|
55
|
-
// Stub for future Cursor sqlite/json parsing
|
|
56
57
|
return { total: 0, output: 0, cache: 0, sessions: 0 };
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
function getLocalGridFactor(): { region: string, factor: number } {
|
|
62
|
+
try {
|
|
63
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
64
|
+
if (tz.includes('Ho_Chi_Minh') || tz.includes('Bangkok') || tz.includes('Jakarta') || tz.includes('Asia/Manila')) return { region: 'Vietnam/SEA', factor: gridFactors.vietnam };
|
|
65
|
+
if (tz.includes('Paris') || tz.includes('Europe/')) return { region: 'France/EU', factor: gridFactors.france };
|
|
66
|
+
if (tz.includes('New_York') || tz.includes('America/')) return { region: 'US', factor: gridFactors.us_east };
|
|
67
|
+
if (tz.includes('Singapore')) return { region: 'Singapore', factor: gridFactors.singapore };
|
|
68
|
+
if (tz.includes('Calcutta') || tz.includes('Kolkata') || tz.includes('Asia/Kabul')) return { region: 'India', factor: gridFactors.india_average };
|
|
69
|
+
} catch (e) {}
|
|
70
|
+
return { region: 'Global Average', factor: 450 };
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
export async function getCarbonStats(): Promise<CarbonStats> {
|
|
61
74
|
const parsers: TokenLogParser[] = [new ClaudeLogParser(), new CursorLogParser()];
|
|
62
75
|
|
|
@@ -71,6 +84,7 @@ export async function getCarbonStats(): Promise<CarbonStats> {
|
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
const energyKwh = (outputTokens / 1_000_000) * 0.662;
|
|
87
|
+
const localGrid = getLocalGridFactor();
|
|
74
88
|
|
|
75
89
|
return {
|
|
76
90
|
totalTokens,
|
|
@@ -79,6 +93,8 @@ export async function getCarbonStats(): Promise<CarbonStats> {
|
|
|
79
93
|
energyKwh,
|
|
80
94
|
co2KgVietnam: (energyKwh * gridFactors.vietnam) / 1000,
|
|
81
95
|
co2KgFrance: (energyKwh * gridFactors.france) / 1000,
|
|
96
|
+
localCo2Kg: (energyKwh * localGrid.factor) / 1000,
|
|
97
|
+
localRegion: localGrid.region,
|
|
82
98
|
sessions
|
|
83
99
|
};
|
|
84
100
|
}
|
package/src/cli.ts
CHANGED
|
@@ -7,8 +7,20 @@ import { getCapabilitiesStats } from './capabilities';
|
|
|
7
7
|
import { writeFileSync, chmodSync, existsSync } from 'fs';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
|
|
10
|
+
const ASCII_LOGO = `
|
|
11
|
+
____ _ _ _____ _ ___ _____ ____
|
|
12
|
+
/ __ \\| | | |_ _| | |_ _| ___| _ \\
|
|
13
|
+
| | | | | | | | | | | | || |__ | |_) |
|
|
14
|
+
| | | | |_| | | | | |___ | || __|| _ <
|
|
15
|
+
| |__| | _ | | | | _ || || |___| | \\ \\
|
|
16
|
+
\\____/|_| |_| |_| |_| |_|___|_____|_| \\_\\
|
|
17
|
+
`;
|
|
18
|
+
|
|
10
19
|
async function main() {
|
|
11
20
|
console.clear();
|
|
21
|
+
console.log(pc.cyan(ASCII_LOGO));
|
|
22
|
+
console.log(pc.dim(' Outlier v0.3.0 · AI Code Reliance & Telemetry Engine\n'));
|
|
23
|
+
|
|
12
24
|
intro(pc.inverse(' outlier '));
|
|
13
25
|
|
|
14
26
|
let action = process.argv[2] as any;
|
|
@@ -47,8 +59,10 @@ async function main() {
|
|
|
47
59
|
Output Tokens: ${(carbon.outputTokens / 1_000_000).toFixed(2)}M
|
|
48
60
|
Est. Energy: ${carbon.energyKwh.toFixed(2)} kWh
|
|
49
61
|
|
|
50
|
-
Grid
|
|
51
|
-
|
|
62
|
+
Your Local Grid (${carbon.localRegion}): ${pc.cyan(carbon.localCo2Kg.toFixed(2) + ' kgCO2')}
|
|
63
|
+
|
|
64
|
+
Counterfactual (Vietnam): ${pc.red(carbon.co2KgVietnam.toFixed(2) + ' kgCO2')}
|
|
65
|
+
Counterfactual (France): ${pc.green(carbon.co2KgFrance.toFixed(2) + ' kgCO2')}
|
|
52
66
|
|
|
53
67
|
Ratio: ~31x carbon penalty on coal-heavy grid`,
|
|
54
68
|
'Session Carbon Breakdown'
|
|
@@ -109,8 +123,8 @@ Conservative Floor: ${color(nmPct + '%')}`,
|
|
|
109
123
|
if (!isStrict) {
|
|
110
124
|
if (gitStats.ratio < 0.1) wittyRemark = 'Artisan, hand-crafted code. Very 2019 of you (=^ ◡ ^=)';
|
|
111
125
|
else if (gitStats.ratio < 0.6) wittyRemark = 'A true centaur. Half human, half matrix (=`ω´=)';
|
|
112
|
-
else if (gitStats.ratio < 0.95) wittyRemark = '
|
|
113
|
-
else wittyRemark = '
|
|
126
|
+
else if (gitStats.ratio < 0.95) wittyRemark = 'Orchestrating the swarm. You are the manager now (ФДФ)';
|
|
127
|
+
else wittyRemark = '100% Cybernetic. Codebase goes brrrrr (=ಠᆽಠ=)';
|
|
114
128
|
}
|
|
115
129
|
|
|
116
130
|
if (gitStats.ratio > 0.7) {
|
|
@@ -124,11 +138,13 @@ Conservative Floor: ${color(nmPct + '%')}`,
|
|
|
124
138
|
|
|
125
139
|
let cachePct = '0';
|
|
126
140
|
let co2Str = '0.0kg';
|
|
141
|
+
let regionStr = 'Global Average';
|
|
127
142
|
if (carbon) {
|
|
128
143
|
if (carbon.totalTokens > 0) {
|
|
129
144
|
cachePct = ((carbon.cacheReadTokens / carbon.totalTokens) * 100).toFixed(1);
|
|
130
145
|
}
|
|
131
|
-
co2Str = `${carbon.
|
|
146
|
+
co2Str = `${carbon.localCo2Kg.toFixed(2)}kg CO2`;
|
|
147
|
+
regionStr = carbon.localRegion;
|
|
132
148
|
}
|
|
133
149
|
|
|
134
150
|
const vibeRow = !isStrict ? `\n vibe: ${pc.italic(wittyRemark)}` : '';
|
|
@@ -145,7 +161,7 @@ ${authIcon}${pc.dim('[2] AI Code Reliance')} ${pc.yellow('▰▰▰▰▰▰▰
|
|
|
145
161
|
gate: ${gitStats && gitStats.ratio <= 0.7 ? pc.green('✓ Human Mastery Sustained') : `${pc.red(`${failIcon} Deskilling Risk Detected`)} ${pc.red('⚠ Security Audit Required')}`}${mentorString}
|
|
146
162
|
${costIcon}${pc.dim('[3] Tokenomics & Cost')} ${pc.magenta('▰▰▰▰▰▰▰▰▰▱')} ${pc.bold(`${cachePct}% Cache Bloat`)}
|
|
147
163
|
waste: ${pc.yellow(`⚠ ${cachePct}% of tokens are redundant context reads`)}
|
|
148
|
-
carbon: ${pc.green(`✓ ${co2Str} (Grid
|
|
164
|
+
carbon: ${pc.green(`✓ ${co2Str} (Est. ${regionStr} Grid)`)}
|
|
149
165
|
${pc.bold('Governance:')} ${ruleFailures > 0 ? pc.red(`${failIcon} ${ruleFailures + 1} policy failures`) : pc.green(`${passIcon} All clear`)}`,
|
|
150
166
|
`${pc.bold('[outlier]')} ${5 - (ruleFailures+1)}/5 policies • ${authWarning || pc.green(`${passIcon} safe surface`)} • ${co2Str}`
|
|
151
167
|
);
|
|
@@ -216,8 +232,8 @@ ${caps.skills.length > 5 ? pc.red('⚠ High Surface Area: Ensure strict authorsh
|
|
|
216
232
|
const gitDir = join(process.cwd(), '.git');
|
|
217
233
|
const isRepo = existsSync(gitDir);
|
|
218
234
|
if (!isRepo) {
|
|
219
|
-
|
|
220
|
-
|
|
235
|
+
console.error(pc.red('Must be run inside a git repository'));
|
|
236
|
+
process.exit(1);
|
|
221
237
|
}
|
|
222
238
|
|
|
223
239
|
const isStrict = process.argv.includes('--strict');
|
|
@@ -226,6 +242,11 @@ ${caps.skills.length > 5 ? pc.red('⚠ High Surface Area: Ensure strict authorsh
|
|
|
226
242
|
: `echo "😾 ✋ The Bouncer says no: Your code is $CURRENT_RATIO% AI-generated."\n echo "A human must review this before it enters the club (main branch)."`;
|
|
227
243
|
|
|
228
244
|
const hookPath = join(gitDir, 'hooks', 'pre-commit');
|
|
245
|
+
if (existsSync(hookPath)) {
|
|
246
|
+
const { copyFileSync } = require('fs');
|
|
247
|
+
copyFileSync(hookPath, `${hookPath}.backup`);
|
|
248
|
+
}
|
|
249
|
+
|
|
229
250
|
const hookScript = `#!/bin/sh
|
|
230
251
|
# outlier Pre-Commit Governance Hook
|
|
231
252
|
|
|
@@ -236,15 +257,15 @@ if [ "$TOTAL" -eq 0 ]; then exit 0; fi
|
|
|
236
257
|
CURRENT_RATIO=$(awk "BEGIN {print ($AI / $TOTAL) * 100}")
|
|
237
258
|
MAX_RATIO=${maxAuthorship}
|
|
238
259
|
|
|
239
|
-
if
|
|
260
|
+
OVER_LIMIT=$(awk "BEGIN {if ($CURRENT_RATIO > $MAX_RATIO) print 1; else print 0}")
|
|
261
|
+
if [ "$OVER_LIMIT" -eq 1 ]; then
|
|
240
262
|
${bouncerMsg}
|
|
241
263
|
exit 1
|
|
242
264
|
fi
|
|
243
265
|
echo "✅ Governance Policy OK"
|
|
244
266
|
`;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
267
|
+
writeFileSync(hookPath, hookScript);
|
|
268
|
+
chmodSync(hookPath, '755');
|
|
248
269
|
|
|
249
270
|
await new Promise(resolve => setTimeout(resolve, 800));
|
|
250
271
|
s.stop('Policy Applied');
|
|
@@ -253,22 +274,26 @@ echo "✅ Governance Policy OK"
|
|
|
253
274
|
`Tier: ${pc.bold(tier.toString().toUpperCase())}
|
|
254
275
|
Rule 1: ${pc.green(`AI Authorship must not exceed ${maxAuthorship}%`)}
|
|
255
276
|
Rule 2: ${pc.green('Require human review on consecutive high-AI sprints')}
|
|
256
|
-
Enforcement: ${pc.cyan('Local pre-commit hook installed')}`,
|
|
277
|
+
Enforcement: ${pc.cyan('Local pre-commit hook installed (backup created)')}`,
|
|
257
278
|
'Active Governance Policy'
|
|
258
279
|
);
|
|
259
280
|
} else if (tier === 'regulatory') {
|
|
260
281
|
s.start('Generating Regulatory Compliance Audit (Decree 142)...');
|
|
261
282
|
await new Promise(resolve => setTimeout(resolve, 1200));
|
|
283
|
+
|
|
284
|
+
const reportPath = join(process.cwd(), 'outlier-audit-report.jsonl');
|
|
285
|
+
writeFileSync(reportPath, JSON.stringify({ timestamp: new Date().toISOString(), status: 'COMPLIANT', policy: 'Decree 142', humanOversight: true }) + '\\n');
|
|
262
286
|
s.stop('Audit Generated');
|
|
263
287
|
|
|
264
288
|
note(
|
|
265
289
|
`Jurisdiction: ${pc.bold('Vietnam (Decree 142)')}
|
|
266
290
|
Status: ${pc.green('Compliant - Human oversight logged locally')}
|
|
267
291
|
Privacy: ${pc.green('Preserved - No citizen data exported')}
|
|
268
|
-
Artifact: ${pc.cyan(
|
|
292
|
+
Artifact: ${pc.cyan(reportPath)}`,
|
|
269
293
|
'Regulatory Compliance'
|
|
270
294
|
);
|
|
271
295
|
}
|
|
296
|
+
}
|
|
272
297
|
|
|
273
298
|
let shareText = 'Local telemetry run completed. No data left your machine.';
|
|
274
299
|
if (action === 'status') {
|