arkaos 2.3.0 → 2.3.2

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 (64) hide show
  1. package/VERSION +1 -1
  2. package/arka/skills/conclave/SKILL.md +194 -0
  3. package/arka/skills/human-writing/SKILL.md +143 -0
  4. package/config/agent-memory-template.md +28 -0
  5. package/config/disc-profiles.json +108 -0
  6. package/config/disc-team-validator.sh +94 -0
  7. package/config/gotchas-fixes.json +148 -0
  8. package/config/profile-template.json +12 -0
  9. package/config/providers-registry.json +56 -0
  10. package/config/settings-template.json +42 -0
  11. package/config/standards/communication.md +64 -0
  12. package/config/standards/orchestration.md +91 -0
  13. package/config/statusline-v2.sh +101 -0
  14. package/config/statusline.sh +139 -0
  15. package/config/system-prompt.sh +190 -0
  16. package/dashboard/LICENSE +21 -0
  17. package/dashboard/README.md +64 -0
  18. package/dashboard/app/app.config.ts +8 -0
  19. package/dashboard/app/app.vue +42 -0
  20. package/dashboard/app/assets/css/main.css +18 -0
  21. package/dashboard/app/composables/useApi.ts +8 -0
  22. package/dashboard/app/composables/useDashboard.ts +19 -0
  23. package/dashboard/app/error.vue +24 -0
  24. package/dashboard/app/layouts/default.vue +114 -0
  25. package/dashboard/app/pages/agents/[id].vue +506 -0
  26. package/dashboard/app/pages/agents/index.vue +225 -0
  27. package/dashboard/app/pages/budget.vue +132 -0
  28. package/dashboard/app/pages/commands.vue +180 -0
  29. package/dashboard/app/pages/health.vue +98 -0
  30. package/dashboard/app/pages/index.vue +126 -0
  31. package/dashboard/app/pages/knowledge.vue +729 -0
  32. package/dashboard/app/pages/personas.vue +597 -0
  33. package/dashboard/app/pages/settings.vue +146 -0
  34. package/dashboard/app/pages/tasks.vue +203 -0
  35. package/dashboard/app/types/index.d.ts +181 -0
  36. package/dashboard/app/utils/index.ts +7 -0
  37. package/dashboard/nuxt.config.ts +39 -0
  38. package/dashboard/package.json +37 -0
  39. package/dashboard/pnpm-workspace.yaml +7 -0
  40. package/dashboard/tsconfig.json +10 -0
  41. package/knowledge/INDEX.md +34 -0
  42. package/knowledge/agents-registry.json +254 -0
  43. package/knowledge/channels-config.json +6 -0
  44. package/knowledge/commands-keywords.json +466 -0
  45. package/knowledge/commands-registry.json +2791 -0
  46. package/knowledge/commands-registry.json.bak +2791 -0
  47. package/knowledge/ecosystems.json +7 -0
  48. package/knowledge/obsidian-config.json +112 -0
  49. package/package.json +10 -6
  50. package/pyproject.toml +1 -1
  51. package/scripts/check-version.js +13 -0
  52. package/scripts/dashboard-api.py +636 -0
  53. package/scripts/knowledge-index.py +113 -0
  54. package/scripts/skill_validator.py +217 -0
  55. package/scripts/start-dashboard.sh +103 -0
  56. package/scripts/synapse-bridge.py +199 -0
  57. package/scripts/tools/brand_voice_analyzer.py +192 -0
  58. package/scripts/tools/dcf_calculator.py +168 -0
  59. package/scripts/tools/headline_scorer.py +215 -0
  60. package/scripts/tools/okr_cascade.py +207 -0
  61. package/scripts/tools/rice_prioritizer.py +230 -0
  62. package/scripts/tools/saas_metrics.py +234 -0
  63. package/scripts/tools/seo_checker.py +197 -0
  64. package/scripts/tools/tech_debt_analyzer.py +206 -0
@@ -0,0 +1,148 @@
1
+ {
2
+ "fixes": [
3
+ {
4
+ "pattern_match": "SQLSTATE.*relation.*does not exist",
5
+ "category": "database",
6
+ "suggestion": "Table missing. Run: php artisan migrate",
7
+ "confidence": "high"
8
+ },
9
+ {
10
+ "pattern_match": "SQLSTATE.*no such table",
11
+ "category": "database",
12
+ "suggestion": "SQLite table missing. Run: php artisan migrate",
13
+ "confidence": "high"
14
+ },
15
+ {
16
+ "pattern_match": "Connection refused.*5432",
17
+ "category": "database",
18
+ "suggestion": "PostgreSQL not running. Start with: brew services start postgresql",
19
+ "confidence": "high"
20
+ },
21
+ {
22
+ "pattern_match": "Connection refused.*3306",
23
+ "category": "database",
24
+ "suggestion": "MySQL not running. Start with: brew services start mysql",
25
+ "confidence": "high"
26
+ },
27
+ {
28
+ "pattern_match": "SQLSTATE.*Access denied",
29
+ "category": "database",
30
+ "suggestion": "Database credentials wrong. Check DB_USERNAME and DB_PASSWORD in .env",
31
+ "confidence": "high"
32
+ },
33
+ {
34
+ "pattern_match": "npm ERR.*ERESOLVE",
35
+ "category": "frontend",
36
+ "suggestion": "Dependency conflict. Try: npm install --legacy-peer-deps",
37
+ "confidence": "high"
38
+ },
39
+ {
40
+ "pattern_match": "Cannot find module.*vue",
41
+ "category": "frontend",
42
+ "suggestion": "Vue dependency missing. Run: npm install",
43
+ "confidence": "high"
44
+ },
45
+ {
46
+ "pattern_match": "Vite manifest not found",
47
+ "category": "frontend",
48
+ "suggestion": "Frontend not built. Run: npm run build (or npm run dev for local)",
49
+ "confidence": "high"
50
+ },
51
+ {
52
+ "pattern_match": "Module not found",
53
+ "category": "frontend",
54
+ "suggestion": "Missing dependency. Run: npm install (or composer install for PHP)",
55
+ "confidence": "medium"
56
+ },
57
+ {
58
+ "pattern_match": "Out of memory|JavaScript heap",
59
+ "category": "frontend",
60
+ "suggestion": "Node ran out of memory. Increase limit: NODE_OPTIONS=--max-old-space-size=4096",
61
+ "confidence": "high"
62
+ },
63
+ {
64
+ "pattern_match": "Class.*not found",
65
+ "category": "laravel",
66
+ "suggestion": "Autoload stale. Run: composer dump-autoload",
67
+ "confidence": "high"
68
+ },
69
+ {
70
+ "pattern_match": "CSRF token mismatch",
71
+ "category": "laravel",
72
+ "suggestion": "Session expired or cache stale. Run: php artisan cache:clear && php artisan config:clear",
73
+ "confidence": "high"
74
+ },
75
+ {
76
+ "pattern_match": "Route \\[.*\\] not defined",
77
+ "category": "laravel",
78
+ "suggestion": "Route cache stale. Run: php artisan route:clear",
79
+ "confidence": "high"
80
+ },
81
+ {
82
+ "pattern_match": "View \\[.*\\] not found",
83
+ "category": "laravel",
84
+ "suggestion": "View path wrong or cache stale. Check path and run: php artisan view:clear",
85
+ "confidence": "medium"
86
+ },
87
+ {
88
+ "pattern_match": "Permission denied",
89
+ "category": "permissions",
90
+ "suggestion": "Insufficient file permissions. Check with: ls -la <path>. Fix with: chmod or chown",
91
+ "confidence": "medium"
92
+ },
93
+ {
94
+ "pattern_match": "EACCES",
95
+ "category": "permissions",
96
+ "suggestion": "Permission denied (Node/npm). Avoid sudo. Fix ownership: sudo chown -R $(whoami) ~/.npm",
97
+ "confidence": "medium"
98
+ },
99
+ {
100
+ "pattern_match": "ENOSPC",
101
+ "category": "general",
102
+ "suggestion": "Disk full or inotify limit reached. Free disk space or increase watchers: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf",
103
+ "confidence": "high"
104
+ },
105
+ {
106
+ "pattern_match": "ENOENT",
107
+ "category": "general",
108
+ "suggestion": "File or directory not found. Verify the path exists and is spelled correctly",
109
+ "confidence": "medium"
110
+ },
111
+ {
112
+ "pattern_match": "port.*already in use|Address already in use|EADDRINUSE",
113
+ "category": "general",
114
+ "suggestion": "Port occupied. Kill the process: lsof -ti:<port> | xargs kill -9",
115
+ "confidence": "high"
116
+ },
117
+ {
118
+ "pattern_match": "Merge conflict|CONFLICT.*Merge",
119
+ "category": "git",
120
+ "suggestion": "Merge conflict detected. Open conflicting files, resolve markers (<<<< ==== >>>>), then git add and commit",
121
+ "confidence": "high"
122
+ },
123
+ {
124
+ "pattern_match": "failed to push|rejected.*non-fast-forward",
125
+ "category": "git",
126
+ "suggestion": "Remote has changes. Pull first: git pull --rebase origin <branch>",
127
+ "confidence": "high"
128
+ },
129
+ {
130
+ "pattern_match": "fatal: not a git repository",
131
+ "category": "git",
132
+ "suggestion": "Not inside a git repo. Run: git init, or cd into the correct directory",
133
+ "confidence": "high"
134
+ },
135
+ {
136
+ "pattern_match": "PHPUnit.*Failed|Tests:.*failures",
137
+ "category": "testing",
138
+ "suggestion": "Test failures. Check assertions, fixtures, and database state. Run: php artisan migrate:fresh --seed --env=testing",
139
+ "confidence": "medium"
140
+ },
141
+ {
142
+ "pattern_match": "FAIL.*\\.test\\.|jest.*failed",
143
+ "category": "testing",
144
+ "suggestion": "Jest test failures. Check test expectations and mocks. Run: npx jest --clearCache if stale",
145
+ "confidence": "medium"
146
+ }
147
+ ]
148
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "user_name": "",
3
+ "company_name": "",
4
+ "role": "",
5
+ "industry": "",
6
+ "projects_dir": "",
7
+ "documents_dir": "",
8
+ "objectives": [],
9
+ "preferred_departments": [],
10
+ "onboarded_at": "",
11
+ "onboarding_version": "1"
12
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "_meta": {
3
+ "version": "1.0.0",
4
+ "description": "External AI providers and models — extensible via 'arka providers add'"
5
+ },
6
+ "providers": {
7
+ "openai": {
8
+ "name": "OpenAI",
9
+ "base_url": "https://api.openai.com/v1",
10
+ "auth_env": "OPENAI_API_KEY",
11
+ "auth_header": "Authorization: Bearer",
12
+ "models": {
13
+ "gpt-image-1": { "type": "image", "description": "GPT Image 1 — latest" },
14
+ "dall-e-3": { "type": "image", "description": "DALL-E 3" }
15
+ }
16
+ },
17
+ "replicate": {
18
+ "name": "Replicate",
19
+ "base_url": "https://api.replicate.com/v1",
20
+ "auth_env": "REPLICATE_API_TOKEN",
21
+ "auth_header": "Authorization: Bearer",
22
+ "models": {
23
+ "black-forest-labs/flux-1.1-pro": { "type": "image", "description": "Flux 1.1 Pro" },
24
+ "stability-ai/sdxl": { "type": "image", "description": "Stable Diffusion XL" },
25
+ "minimax/video-01": { "type": "video", "description": "MiniMax Video" }
26
+ }
27
+ },
28
+ "fal": {
29
+ "name": "FAL",
30
+ "base_url": "https://fal.run",
31
+ "auth_env": "FAL_KEY",
32
+ "auth_header": "Authorization: Key",
33
+ "models": {
34
+ "fal-ai/flux-pro/v1.1": { "type": "image", "description": "Flux Pro via FAL" },
35
+ "fal-ai/kling-video/v2/master": { "type": "video", "description": "Kling Video v2" },
36
+ "fal-ai/runway-gen3/turbo/image-to-video": { "type": "video", "description": "Runway Gen3 Turbo" }
37
+ }
38
+ },
39
+ "openrouter": {
40
+ "name": "OpenRouter",
41
+ "base_url": "https://openrouter.ai/api/v1",
42
+ "auth_env": "OPENROUTER_API_KEY",
43
+ "auth_header": "Authorization: Bearer",
44
+ "models": {
45
+ "google/gemini-2.5-pro": { "type": "text", "description": "Gemini 2.5 Pro" },
46
+ "deepseek/deepseek-r1": { "type": "text", "description": "DeepSeek R1" },
47
+ "meta-llama/llama-4-maverick": { "type": "text", "description": "Llama 4 Maverick" }
48
+ }
49
+ }
50
+ },
51
+ "routing": {
52
+ "image-generation": ["openai/gpt-image-1", "openai/dall-e-3", "fal/fal-ai/flux-pro/v1.1", "replicate/black-forest-labs/flux-1.1-pro"],
53
+ "video-generation": ["fal/fal-ai/kling-video/v2/master", "fal/fal-ai/runway-gen3/turbo/image-to-video", "replicate/minimax/video-01"],
54
+ "text-completion": ["openrouter/google/gemini-2.5-pro", "openrouter/deepseek/deepseek-r1"]
55
+ }
56
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "statusLine": {
3
+ "type": "command",
4
+ "command": "{{STATUSLINE_PATH}}",
5
+ "padding": 2
6
+ },
7
+ "hooks": {
8
+ "UserPromptSubmit": [
9
+ {
10
+ "hooks": [
11
+ {
12
+ "type": "command",
13
+ "command": "{{HOOKS_DIR}}/user-prompt-submit.sh",
14
+ "timeout": 10
15
+ }
16
+ ]
17
+ }
18
+ ],
19
+ "PreCompact": [
20
+ {
21
+ "hooks": [
22
+ {
23
+ "type": "command",
24
+ "command": "{{HOOKS_DIR}}/pre-compact.sh",
25
+ "timeout": 30
26
+ }
27
+ ]
28
+ }
29
+ ],
30
+ "PostToolUse": [
31
+ {
32
+ "hooks": [
33
+ {
34
+ "type": "command",
35
+ "command": "{{HOOKS_DIR}}/post-tool-use.sh",
36
+ "timeout": 5
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,64 @@
1
+ # ArkaOS Communication Standard
2
+
3
+ Every agent output follows this standard. No exceptions.
4
+
5
+ ## The Rule: Bottom-Line First
6
+
7
+ Lead with the answer, recommendation, or verdict. Then explain why. Then show how.
8
+
9
+ ```
10
+ ❌ "After analyzing the market landscape and considering various factors..."
11
+ ✅ "Enter the B2B segment. Here's why and how."
12
+ ```
13
+
14
+ ## Output Structure
15
+
16
+ ### 1. Bottom Line (mandatory)
17
+ One sentence: what you recommend, what you found, what the verdict is.
18
+
19
+ ### 2. Why (mandatory)
20
+ 2-3 bullet points explaining the reasoning. Data-backed when possible.
21
+
22
+ ### 3. How (when actionable)
23
+ Concrete next steps, numbered. Who does what, by when.
24
+
25
+ ### 4. Confidence Tag (mandatory on assessments)
26
+
27
+ | Tag | Meaning | When to Use |
28
+ |-----|---------|-------------|
29
+ | HIGH | Strong evidence, high certainty | Data-backed, proven pattern |
30
+ | MEDIUM | Reasonable evidence, some uncertainty | Partial data, informed judgment |
31
+ | LOW | Limited evidence, significant uncertainty | Assumptions, early-stage |
32
+
33
+ ## Anti-Patterns
34
+
35
+ | Don't | Do Instead |
36
+ |-------|-----------|
37
+ | Walls of text before the point | Lead with the answer |
38
+ | "It depends" without guidance | Pick a recommendation, caveat after |
39
+ | Generic disclaimers | Specific risks with mitigation |
40
+ | Restating the question | Answer immediately |
41
+ | Academic tone | Practitioner voice |
42
+ | Hedge everything | Commit to a position with confidence tag |
43
+
44
+ ## Format Rules
45
+
46
+ - **Bullet points over paragraphs** for findings and recommendations
47
+ - **Tables over lists** when comparing options
48
+ - **Code blocks** for any technical output
49
+ - **Bold** for key terms, not for emphasis
50
+ - **Numbers** over vague qualifiers ("3 issues" not "several issues")
51
+ - **Active voice** ("Deploy to staging" not "It should be deployed to staging")
52
+
53
+ ## Per-Department Adaptations
54
+
55
+ | Department | Tone | Example Lead |
56
+ |-----------|------|-------------|
57
+ | Dev | Technical, precise | "Memory leak in UserService:45. Fix: pool connections." |
58
+ | Strategy | Analytical, decisive | "Blue Ocean opportunity. TAM: $2.4B. Entry cost: low." |
59
+ | Finance | Quantitative, direct | "Burn rate: 18 months. Cut infra 30% to extend to 24." |
60
+ | Marketing | Action-oriented | "Email sequence converts 12%. Add urgency to subject lines." |
61
+ | Sales | Confident, outcome-focused | "Deal qualifies. BANT score: 85. Push for close this week." |
62
+ | Brand | Visual, conceptual | "Archetype: Creator. Color: deep blue. Name: Lumino." |
63
+ | Ops | Process-oriented | "SOP gap in onboarding. 3 steps missing. Template attached." |
64
+ | Quality | Binary, authoritative | "REJECTED. 2 critical issues. Fix and resubmit." |
@@ -0,0 +1,91 @@
1
+ # ArkaOS Orchestration Protocol
2
+
3
+ How to coordinate agents across departments for complex, multi-domain work.
4
+
5
+ ## Core Concept
6
+
7
+ ArkaOS has three layers of execution:
8
+
9
+ | Layer | What | ArkaOS Equivalent |
10
+ |-------|------|-------------------|
11
+ | **Agent** | Who is thinking (identity, judgment) | 62 agents with behavioral DNA |
12
+ | **Skill** | How to execute (steps, templates) | 250+ department skills |
13
+ | **Workflow** | What phases to follow | 24 YAML workflows |
14
+
15
+ Orchestration connects them for work that crosses department boundaries.
16
+
17
+ ## Four Patterns
18
+
19
+ ### 1. Solo Sprint
20
+ One department lead drives a multi-phase sprint.
21
+
22
+ ```
23
+ Lead: Ines (Landing)
24
+ Phase 1: /landing copy-framework + /landing funnel-design
25
+ Phase 2: /landing page-build + /landing seo-optimize
26
+ Phase 3: Quality Gate → Ship
27
+ ```
28
+
29
+ **Use when:** Single domain, time-constrained, clear scope.
30
+
31
+ ### 2. Domain Deep-Dive
32
+ One agent, multiple stacked skills for thorough analysis.
33
+
34
+ ```
35
+ Agent: Bruno (Security Engineer)
36
+ Stack: /dev security-audit → /dev dependency-audit → /dev red-team → /dev ai-security
37
+ Output: Consolidated security report
38
+ ```
39
+
40
+ **Use when:** Deep expertise needed, audit/review, compliance assessment.
41
+
42
+ ### 3. Multi-Agent Handoff
43
+ Work flows between departments with structured context passing.
44
+
45
+ ```
46
+ Phase 1: Tomas (Strategy) → BMC + Five Forces → Handoff
47
+ Phase 2: Paulo (Dev) → Spec + Feature → Handoff
48
+ Phase 3: Luna (Marketing) → Growth Plan + Email → Handoff
49
+ Phase 4: Quality Gate → Launch
50
+ ```
51
+
52
+ **Use when:** Cross-department project, sequential expertise needed.
53
+
54
+ ### 4. Skill Chain
55
+ Pure procedural execution, no specific agent identity.
56
+
57
+ ```
58
+ /content hook-write → headline_scorer.py → /content viral-design → /mkt social-strategy
59
+ ```
60
+
61
+ **Use when:** Automated pipeline, well-defined inputs/outputs, no judgment needed.
62
+
63
+ ## Phase Handoff Template
64
+
65
+ Between phases, pass structured context:
66
+
67
+ ```
68
+ Phase [N] complete.
69
+ Decisions: [list of decisions made]
70
+ Artifacts: [list of files/documents created]
71
+ Open questions: [what the next phase needs to resolve]
72
+ Next: [department]/[agent] + [skills]
73
+ ```
74
+
75
+ ## Pattern Selection
76
+
77
+ | Departments | Needs Judgment? | Sequential? | Pattern |
78
+ |------------|----------------|-------------|---------|
79
+ | 1 | Yes | — | Solo Sprint |
80
+ | 1 | No | — | Skill Chain |
81
+ | 1 | Deep analysis | — | Domain Deep-Dive |
82
+ | 2+ | Yes | Yes | Multi-Agent Handoff |
83
+ | 2+ | No | Yes | Skill Chain |
84
+
85
+ ## Rules
86
+
87
+ 1. **One agent at a time** — don't blend two agents in the same execution
88
+ 2. **Skills stack freely** — load as many as the task needs
89
+ 3. **Context carries forward** — always pass handoff between phases
90
+ 4. **Quality Gate is mandatory** — no pattern skips the final review
91
+ 5. **User decides** — orchestration is a recommendation, user can override
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================================
3
+ # ArkaOS v2 — Status Line for Claude Code
4
+ # Two-line color-coded display showing session context and metrics
5
+ # ============================================================================
6
+
7
+ input=$(cat)
8
+
9
+ # ─── Extract fields ──���───────────────────────────────────────────────────
10
+ if ! command -v jq &>/dev/null; then
11
+ echo "▲ARKAOS v2 | jq not found"
12
+ exit 0
13
+ fi
14
+
15
+ eval "$(echo "$input" | jq -r '
16
+ @sh "model=\(.session.model // "unknown")",
17
+ @sh "total_in=\(.context_window.total_input_tokens // 0)",
18
+ @sh "total_out=\(.context_window.total_output_tokens // 0)",
19
+ @sh "max_ctx=\(.context_window.context_window_size // 200000)",
20
+ @sh "cost=\(.cost_usd // 0)",
21
+ @sh "duration=\(.session.duration_seconds // 0)"
22
+ ' 2>/dev/null)" 2>/dev/null
23
+
24
+ # ─── Format tokens (K/M) ────────────────────────────────────────────────
25
+ format_tokens() {
26
+ local n=$1
27
+ if [ "$n" -ge 1000000 ] 2>/dev/null; then
28
+ printf "%.1fM" "$(echo "scale=1; $n/1000000" | bc 2>/dev/null || echo "?")"
29
+ elif [ "$n" -ge 1000 ] 2>/dev/null; then
30
+ printf "%.1fK" "$(echo "scale=1; $n/1000" | bc 2>/dev/null || echo "?")"
31
+ else
32
+ echo "${n:-0}"
33
+ fi
34
+ }
35
+
36
+ # ─── Context percentage ─────────────────────────────────────────────────
37
+ pct=0
38
+ if [ "${max_ctx:-0}" -gt 0 ] 2>/dev/null; then
39
+ pct=$(( (${total_in:-0} * 100) / ${max_ctx} ))
40
+ fi
41
+
42
+ # ─── Color based on context usage ────────────────────────────────────────
43
+ if [ "$pct" -ge 90 ]; then
44
+ color="\033[5;31m" # Blinking red
45
+ elif [ "$pct" -ge 80 ]; then
46
+ color="\033[31m" # Red
47
+ elif [ "$pct" -ge 60 ]; then
48
+ color="\033[33m" # Yellow
49
+ else
50
+ color="\033[32m" # Green
51
+ fi
52
+ reset="\033[0m"
53
+
54
+ # ─── Progress bar ───────��────────────────────────────────────────────────
55
+ filled=$(( pct / 10 ))
56
+ empty=$(( 10 - filled ))
57
+ bar=""
58
+ for ((i=0; i<filled; i++)); do bar+="█"; done
59
+ for ((i=0; i<empty; i++)); do bar+="░"; done
60
+
61
+ # ─── Git info (cached) ──────────────────────────────────────────────────
62
+ branch=""
63
+ if git rev-parse --is-inside-work-tree &>/dev/null; then
64
+ branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
65
+ if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then
66
+ branch=""
67
+ fi
68
+ fi
69
+
70
+ # ─── Project name ────────────────────────────────────────────────────────
71
+ project=$(basename "$(pwd)")
72
+
73
+ # ─── Duration ─────���──────────────────────────────────────────────────────
74
+ dur=""
75
+ if [ "${duration:-0}" -gt 0 ] 2>/dev/null; then
76
+ mins=$(( duration / 60 ))
77
+ secs=$(( duration % 60 ))
78
+ if [ "$mins" -gt 0 ]; then
79
+ dur="${mins}m${secs}s"
80
+ else
81
+ dur="${secs}s"
82
+ fi
83
+ fi
84
+
85
+ # ─── Line 1: Context ────────────────────────────────────────────────────
86
+ line1="▲ARKAOS"
87
+ [ -n "$project" ] && line1+=" ${project}"
88
+ [ -n "$branch" ] && line1+=" on ${branch}"
89
+ line1+=" | ${model:-Opus}"
90
+
91
+ # ─── Line 2: Metrics ────────────────────────────────────────────────────
92
+ in_fmt=$(format_tokens "${total_in:-0}")
93
+ out_fmt=$(format_tokens "${total_out:-0}")
94
+
95
+ line2="${bar} ${pct}% | ${in_fmt} in ${out_fmt} out"
96
+ [ -n "$dur" ] && line2+=" | ${dur}"
97
+ [ "${cost:-0}" != "0" ] && line2+=" | \$${cost}"
98
+
99
+ # ─── Output ────────────────────────────────────��─────────────────────────
100
+ echo -e "${line1}"
101
+ echo -e "${color}${line2}${reset}"
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================================
3
+ # ARKA OS — Two-Line Color-Coded Status Line for Claude Code
4
+ # Receives JSON via stdin, outputs formatted two-line status bar
5
+ # ============================================================================
6
+
7
+ input=$(cat)
8
+
9
+ # ─── Extract fields (single jq call for performance) ──────────────────────
10
+ eval "$(echo "$input" | jq -r '
11
+ @sh "MODEL=\(.model.display_name // "unknown")",
12
+ @sh "CWD=\(.cwd // "")",
13
+ @sh "PROJECT_DIR=\(.workspace.project_dir // "")",
14
+ @sh "PCT=\(.context_window.used_percentage // 0 | floor)",
15
+ @sh "INPUT_TOKENS=\(.context_window.total_input_tokens // 0)",
16
+ @sh "OUTPUT_TOKENS=\(.context_window.total_output_tokens // 0)",
17
+ @sh "COST=\(.cost.total_cost_usd // 0)",
18
+ @sh "DURATION_MS=\(.cost.total_duration_ms // 0)",
19
+ @sh "ADDED=\(.cost.total_lines_added // 0)",
20
+ @sh "REMOVED=\(.cost.total_lines_removed // 0)"
21
+ ' 2>/dev/null)" 2>/dev/null || {
22
+ # Fallback: individual extractions if single-call fails
23
+ MODEL=$(echo "$input" | jq -r '.model.display_name // "unknown"' 2>/dev/null)
24
+ CWD=$(echo "$input" | jq -r '.cwd // ""' 2>/dev/null)
25
+ PROJECT_DIR=$(echo "$input" | jq -r '.workspace.project_dir // ""' 2>/dev/null)
26
+ PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' 2>/dev/null | cut -d. -f1)
27
+ INPUT_TOKENS=$(echo "$input" | jq -r '.context_window.total_input_tokens // 0' 2>/dev/null)
28
+ OUTPUT_TOKENS=$(echo "$input" | jq -r '.context_window.total_output_tokens // 0' 2>/dev/null)
29
+ COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0' 2>/dev/null)
30
+ DURATION_MS=$(echo "$input" | jq -r '.cost.total_duration_ms // 0' 2>/dev/null)
31
+ ADDED=$(echo "$input" | jq -r '.cost.total_lines_added // 0' 2>/dev/null)
32
+ REMOVED=$(echo "$input" | jq -r '.cost.total_lines_removed // 0' 2>/dev/null)
33
+ }
34
+
35
+ # ─── Project name ─────────────────────────────────────────────────────────
36
+ WORK_DIR="${CWD:-$PROJECT_DIR}"
37
+ DIR_NAME=$(basename "${WORK_DIR:-arka}")
38
+
39
+ # ─── Git info (cached for 5s) ─────────────────────────────────────────────
40
+ GIT_CACHE="/tmp/arka-statusline-git-cache"
41
+ CACHE_MAX_AGE=5
42
+ BRANCH=""
43
+
44
+ if [ -n "$WORK_DIR" ] && [ -d "$WORK_DIR" ]; then
45
+ CACHE_KEY=$(echo "$WORK_DIR" | md5 2>/dev/null || echo "$WORK_DIR" | md5sum 2>/dev/null | cut -d' ' -f1)
46
+ CACHE_FILE="${GIT_CACHE}-${CACHE_KEY}"
47
+
48
+ if [ -f "$CACHE_FILE" ] && [ $(($(date +%s) - $(stat -f%m "$CACHE_FILE" 2>/dev/null || stat -c%Y "$CACHE_FILE" 2>/dev/null || echo 0))) -lt $CACHE_MAX_AGE ]; then
49
+ # Read from cache
50
+ BRANCH=$(cat "$CACHE_FILE" 2>/dev/null)
51
+ else
52
+ # Fresh git query
53
+ BRANCH=$(git -C "$WORK_DIR" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
54
+ # Write cache
55
+ echo "${BRANCH}" > "$CACHE_FILE" 2>/dev/null
56
+ fi
57
+ fi
58
+
59
+ # ─── Colors ───────────────────────────────────────────────────────────────
60
+ C_RESET='\033[0m'
61
+ C_CYAN='\033[0;36m'
62
+ C_DIM='\033[2m'
63
+ C_WHITE='\033[1;37m'
64
+ C_GREEN='\033[0;32m'
65
+ C_YELLOW='\033[1;33m'
66
+ C_RED='\033[0;31m'
67
+ C_BLINK_RED='\033[5;31m'
68
+
69
+ # Context color based on percentage
70
+ PCT=${PCT:-0}
71
+ if [ "$PCT" -ge 90 ]; then
72
+ C_BAR="$C_BLINK_RED"
73
+ elif [ "$PCT" -ge 80 ]; then
74
+ C_BAR="$C_RED"
75
+ elif [ "$PCT" -ge 60 ]; then
76
+ C_BAR="$C_YELLOW"
77
+ else
78
+ C_BAR="$C_GREEN"
79
+ fi
80
+
81
+ # ─── Format tokens (K/M) ─────────────────────────────────────────────────
82
+ format_tokens() {
83
+ local n="${1:-0}"
84
+ if [ "$n" -ge 1000000 ]; then
85
+ printf "%.1fM" "$(echo "scale=1; $n / 1000000" | bc 2>/dev/null || echo "0")"
86
+ elif [ "$n" -ge 1000 ]; then
87
+ printf "%.1fK" "$(echo "scale=1; $n / 1000" | bc 2>/dev/null || echo "0")"
88
+ else
89
+ echo "${n}"
90
+ fi
91
+ }
92
+
93
+ IN_FMT=$(format_tokens "$INPUT_TOKENS")
94
+ OUT_FMT=$(format_tokens "$OUTPUT_TOKENS")
95
+
96
+ # ─── Progress bar (10 chars) ──────────────────────────────────────────────
97
+ FILLED=$((PCT / 10))
98
+ EMPTY=$((10 - FILLED))
99
+ BAR=""
100
+ for ((i=0; i<FILLED; i++)); do BAR+="█"; done
101
+ for ((i=0; i<EMPTY; i++)); do BAR+="░"; done
102
+
103
+ # ─── Format duration ──────────────────────────────────────────────────────
104
+ SECS=$((${DURATION_MS:-0} / 1000))
105
+ if [ "$SECS" -ge 3600 ]; then
106
+ HOURS=$((SECS / 3600))
107
+ MINS=$(((SECS % 3600) / 60))
108
+ TIME_FMT="${HOURS}h${MINS}m"
109
+ elif [ "$SECS" -ge 60 ]; then
110
+ MINS=$((SECS / 60))
111
+ REM_SECS=$((SECS % 60))
112
+ TIME_FMT="${MINS}m${REM_SECS}s"
113
+ else
114
+ TIME_FMT="${SECS}s"
115
+ fi
116
+
117
+ # ─── Format cost ──────────────────────────────────────────────────────────
118
+ COST_FMT=$(printf '$%.2f' "${COST:-0}")
119
+
120
+ # ─── Build Line 1: Context bar ───────────────────────────────────────────
121
+ LINE1="${C_CYAN}▲ARKA${C_RESET} ${C_WHITE}${DIR_NAME}${C_RESET}"
122
+
123
+ # Git branch (hidden on main/master to reduce noise)
124
+ if [ -n "$BRANCH" ] && [ "$BRANCH" != "main" ] && [ "$BRANCH" != "master" ]; then
125
+ LINE1+=" ${C_DIM}on${C_RESET} ${C_GREEN}${BRANCH}${C_RESET}"
126
+ fi
127
+
128
+ LINE1+=" ${C_DIM}|${C_RESET} ${MODEL}"
129
+
130
+ # ─── Build Line 2: Metrics bar ───────────────────────────────────────────
131
+ LINE2="${C_BAR}${BAR} ${PCT}%${C_RESET}"
132
+ LINE2+=" ${C_DIM}|${C_RESET} ${IN_FMT} in ${OUT_FMT} out"
133
+ LINE2+=" ${C_DIM}|${C_RESET} ${C_GREEN}+${ADDED}${C_RESET} ${C_RED}-${REMOVED}${C_RESET}"
134
+ LINE2+=" ${C_DIM}|${C_RESET} ${TIME_FMT}"
135
+ LINE2+=" ${C_DIM}|${C_RESET} ${COST_FMT}"
136
+
137
+ # ─── Output ───────────────────────────────────────────────────────────────
138
+ echo -e "$LINE1"
139
+ echo -e "$LINE2"