Skip to content

Commit ba6ce2f

Browse files
committed
refactor: move module to repo root and complete kafclaw rename
1 parent 738bdf2 commit ba6ce2f

188 files changed

Lines changed: 370 additions & 370 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

.github/workflows/release.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@ jobs:
3535
uses: actions/setup-go@v5
3636
with:
3737
go-version: "1.24.13"
38-
cache-dependency-path: gomikrobot/go.sum
38+
cache-dependency-path: go.sum
3939

4040
- name: Extract version from tag
4141
id: version
4242
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
4343

4444
- name: Build
45-
working-directory: gomikrobot
45+
working-directory: .
4646
env:
4747
GOOS: ${{ matrix.goos }}
4848
GOARCH: ${{ matrix.goarch }}
4949
CGO_ENABLED: "0"
5050
run: |
51-
BIN_NAME="gomikrobot-${{ matrix.goos }}-${{ matrix.goarch }}"
52-
go build -ldflags "-X github.com/KafClaw/KafClaw/gomikrobot/cmd/gomikrobot/cmd.version=${{ steps.version.outputs.tag }}" \
53-
-o "dist/${BIN_NAME}" ./cmd/gomikrobot
51+
BIN_NAME="kafclaw-${{ matrix.goos }}-${{ matrix.goarch }}"
52+
go build -ldflags "-X github.com/KafClaw/KafClaw/cmd/kafclaw/cmd.version=${{ steps.version.outputs.tag }}" \
53+
-o "dist/${BIN_NAME}" ./cmd/kafclaw
5454
chmod +x "dist/${BIN_NAME}"
5555
5656
- name: Upload artifact
5757
uses: actions/upload-artifact@v4
5858
with:
59-
name: gomikrobot-${{ matrix.goos }}-${{ matrix.goarch }}
60-
path: gomikrobot/dist/*
59+
name: kafclaw-${{ matrix.goos }}-${{ matrix.goarch }}
60+
path: dist/*
6161

6262
# -------------------------------------------------------------------
6363
# Job 2: Package Electron desktop app (needs native runners)
@@ -84,42 +84,42 @@ jobs:
8484
uses: actions/setup-go@v5
8585
with:
8686
go-version: "1.24.13"
87-
cache-dependency-path: gomikrobot/go.sum
87+
cache-dependency-path: go.sum
8888

8989
- name: Setup Node.js
9090
uses: actions/setup-node@v4
9191
with:
9292
node-version: "20"
9393

9494
- name: Build Go binary for target platform
95-
working-directory: gomikrobot
95+
working-directory: .
9696
env:
9797
GOOS: ${{ matrix.go_goos }}
9898
GOARCH: ${{ matrix.go_goarch }}
9999
CGO_ENABLED: "0"
100100
run: |
101-
go build -o gomikrobot ./cmd/gomikrobot
102-
chmod +x gomikrobot
101+
go build -o kafclaw ./cmd/kafclaw
102+
chmod +x kafclaw
103103
104104
- name: Install Electron dependencies
105-
working-directory: gomikrobot/electron
105+
working-directory: electron
106106
run: npm ci
107107

108108
- name: Build Electron app
109-
working-directory: gomikrobot/electron
109+
working-directory: electron
110110
run: npm run build
111111

112112
- name: Package Electron app
113-
working-directory: gomikrobot/electron
113+
working-directory: electron
114114
run: npx electron-builder --${{ matrix.platform }} --publish never
115115

116116
- name: Upload Electron artifacts
117117
uses: actions/upload-artifact@v4
118118
with:
119119
name: electron-${{ matrix.platform }}
120120
path: |
121-
gomikrobot/electron/release/*.dmg
122-
gomikrobot/electron/release/*.AppImage
121+
electron/release/*.dmg
122+
electron/release/*.AppImage
123123
124124
# -------------------------------------------------------------------
125125
# Job 3: Publish GitHub Release with all artifacts
@@ -138,7 +138,7 @@ jobs:
138138
run: |
139139
mkdir -p release_files
140140
# Flatten Go binaries
141-
find artifacts -name "gomikrobot-*" -type f -exec cp {} release_files/ \;
141+
find artifacts -name "kafclaw-*" -type f -exec cp {} release_files/ \;
142142
# Flatten Electron packages
143143
find artifacts -name "*.dmg" -type f -exec cp {} release_files/ \;
144144
find artifacts -name "*.AppImage" -type f -exec cp {} release_files/ \;

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ go.work.sum
3131
# .idea/
3232
# .vscode/
3333
private/
34-
gomikrobot/gomikrobot
35-
gomikrobot/dist/
36-
gomikrobot/electron/node_modules/
37-
gomikrobot/electron/dist/
34+
/kafclaw
35+
dist/
36+
electron/node_modules/
37+
electron/dist/
3838
.DS_Store
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Scheduler ┘ │ │ └── Memory (remember
3636
- **Graceful degradation**: Memory, group, orchestrator, ER1 are all optional
3737
- **Behavior parity first**: Migration from Python preserves behavior before optimizing
3838
- **Secure defaults**: Binds 127.0.0.1, tier-restricted tool execution, deny-pattern filtering
39-
- **Single SQLite database**: All persistent state in `~/.gomikrobot/timeline.db`
39+
- **Single SQLite database**: All persistent state in `~/.kafclaw/timeline.db`
4040

4141
### Three Repositories Model
4242

@@ -46,7 +46,7 @@ KafClaw organizes state across three logical repositories:
4646
|-----------|---------|-----------------|----------|
4747
| **Identity (Workspace)** | Soul files defining personality, behavior, tools, and user profile | `~/KafClaw-Workspace/` | Yes — user-customizable |
4848
| **Work Repo** | Agent sandbox for files, memory, tasks, docs | `~/KafClaw-Workspace/` (same as workspace by default) | Yes — agent writes here |
49-
| **System Repo** | Bot source code, skills, operational guidance | `gomikrobot/` (this repo) | Read-only at runtime |
49+
| **System Repo** | Bot source code, skills, operational guidance | `kafclaw/` (this repo) | Read-only at runtime |
5050

5151
**Identity Repository** — Contains the soul files loaded at startup into the LLM system prompt:
5252

@@ -58,7 +58,7 @@ KafClaw organizes state across three logical repositories:
5858
| `TOOLS.md` | Tool reference with signatures and safety notes |
5959
| `USER.md` | User profile (name, timezone, preferences, work context) |
6060

61-
Soul files are scaffolded by `gomikrobot onboard` from embedded templates (`internal/identity/templates/`). Users can then customize them freely. The canonical file list is defined once in `identity.TemplateNames`.
61+
Soul files are scaffolded by `kafclaw onboard` from embedded templates (`internal/identity/templates/`). Users can then customize them freely. The canonical file list is defined once in `identity.TemplateNames`.
6262

6363
**Work Repository** — Git-initialized sandbox with standard directories: `requirements/`, `tasks/`, `docs/`, `memory/`. The agent's `write_file` tool targets this repo by default.
6464

@@ -69,8 +69,8 @@ Soul files are scaffolded by `gomikrobot onboard` from embedded templates (`inte
6969
## 2. Directory Structure
7070

7171
```
72-
gomikrobot/
73-
├── cmd/gomikrobot/cmd/ # CLI commands (Cobra)
72+
kafclaw/
73+
├── cmd/kafclaw/cmd/ # CLI commands (Cobra)
7474
│ ├── root.go # Root command, version (v2.5.3)
7575
│ ├── gateway.go # Main daemon (~2800 lines, all API endpoints)
7676
│ ├── agent.go # Single-message CLI mode
@@ -124,8 +124,8 @@ gomikrobot/
124124
The gateway command (`runGateway`) initializes all subsystems in a specific dependency order:
125125

126126
```
127-
1. Load Config (env > ~/.gomikrobot/config.json > defaults)
128-
2. Open Timeline DB (~/.gomikrobot/timeline.db, schema migration)
127+
1. Load Config (env > ~/.kafclaw/config.json > defaults)
128+
2. Open Timeline DB (~/.kafclaw/timeline.db, schema migration)
129129
3. Seed Settings (bot_repo_path, work_repo_path, lfs_proxy_url)
130130
4. Create Message Bus (100-msg inbound/outbound buffers)
131131
5. Initialize Provider (OpenAI + optional LocalWhisper wrapper)
@@ -323,15 +323,15 @@ type Channel interface {
323323
```
324324

325325
**WhatsApp** (via whatsmeow — native protocol, no Node bridge):
326-
- Session stored in `~/.gomikrobot/whatsapp.db`
326+
- Session stored in `~/.kafclaw/whatsapp.db`
327327
- Config: enabled, allowFrom list, dropUnauthorized, ignoreReactions
328328
- JID normalization (phone numbers to WhatsApp format)
329329
- Audio transcription via provider (Whisper)
330330
- Image handling (receives, stores to temp, references in content)
331331

332332
### 5.4 internal/config — Configuration
333333

334-
Loading precedence: Environment vars (`MIKROBOT_*`) > `~/.gomikrobot/config.json` > defaults.
334+
Loading precedence: Environment vars (`MIKROBOT_*`) > `~/.kafclaw/config.json` > defaults.
335335

336336
```
337337
Config
@@ -887,7 +887,7 @@ make docker-build && make docker-up
887887

888888
| Target | Action |
889889
|--------|--------|
890-
| `make build` | `go build ./cmd/gomikrobot` |
890+
| `make build` | `go build ./cmd/kafclaw` |
891891
| `make test` | `go test ./...` |
892892
| `make install` | Copy binary to `/usr/local/bin` |
893893
| `make run` / `run-full` / `run-headless` | Build + run in specific mode |
@@ -1004,7 +1004,7 @@ ContextBuilder.BuildSystemPrompt()
10041004

10051005
### Adding a New CLI Command
10061006

1007-
1. Create file in `cmd/gomikrobot/cmd/`
1007+
1. Create file in `cmd/kafclaw/cmd/`
10081008
2. Define cobra command
10091009
3. Register in `root.go` `init()`
10101010

CLAUDE.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
KafClaw (formerly GoMikroBot) is a personal AI assistant written in Go. The Go source lives in `gomikrobot/`. Sensitive specs, tasks, research, and governance docs live in the `private/` directory (gitignored — tracked separately).
7+
KafClaw (formerly KafClaw) is a personal AI assistant written in Go. The Go source lives in `kafclaw/`. Sensitive specs, tasks, research, and governance docs live in the `private/` directory (gitignored — tracked separately).
88

99
## Build & Run
1010

11-
All Go commands run from the `gomikrobot/` directory:
11+
All Go commands run from the `kafclaw/` directory:
1212

1313
```bash
14-
cd gomikrobot
14+
cd KafClaw
1515

1616
# Build
17-
make build # or: go build ./cmd/gomikrobot
17+
make build # or: go build ./cmd/kafclaw
1818

1919
# Run gateway (multi-channel daemon)
2020
make run # build + run
2121
make rerun # kill existing ports 18790/18791, rebuild, run
2222

2323
# Run single message
24-
./gomikrobot agent -m "hello"
24+
./kafclaw agent -m "hello"
2525

2626
# Run tests
2727
go test ./... # all tests
@@ -42,8 +42,8 @@ make release-patch # or release-minor, release-major
4242
KafClaw/
4343
├── CLAUDE.md ← this file
4444
├── .github/workflows/ ← CI/CD (release.yml)
45-
├── gomikrobot/ ← Go source code
46-
│ ├── cmd/gomikrobot/ ← CLI entry point (cobra commands)
45+
├── kafclaw/ ← Go source code
46+
│ ├── cmd/kafclaw/ ← CLI entry point (cobra commands)
4747
│ ├── internal/ ← Core packages
4848
│ │ ├── agent/ ← Agent loop + context/soul-file loader
4949
│ │ ├── bus/ ← Async message bus (pub-sub)
@@ -52,7 +52,7 @@ KafClaw/
5252
│ │ ├── identity/ ← Embedded soul-file templates + workspace scaffolding
5353
│ │ ├── provider/ ← LLM provider abstraction (OpenAI/OpenRouter)
5454
│ │ ├── session/ ← Per-session conversation history (JSONL)
55-
│ │ ├── timeline/ ← SQLite event log (~/.gomikrobot/timeline.db)
55+
│ │ ├── timeline/ ← SQLite event log (~/.kafclaw/timeline.db)
5656
│ │ └── tools/ ← Registry-based tool system
5757
│ ├── web/ ← Web UI (HTML dashboard)
5858
│ ├── electron/ ← Electron desktop app wrapper
@@ -75,15 +75,15 @@ KafClaw/
7575

7676
KafClaw organizes state across three logical repositories:
7777

78-
- **Identity (Workspace)** — Soul files (IDENTITY.md, SOUL.md, AGENTS.md, TOOLS.md, USER.md) loaded at startup into the LLM system prompt. Scaffolded by `gomikrobot onboard`, user-customizable.
78+
- **Identity (Workspace)** — Soul files (IDENTITY.md, SOUL.md, AGENTS.md, TOOLS.md, USER.md) loaded at startup into the LLM system prompt. Scaffolded by `kafclaw onboard`, user-customizable.
7979
- **Work Repo** — Agent sandbox for files, memory, tasks, docs. Git-initialized. Default: `~/KafClaw-Workspace/`.
8080
- **System Repo** — Bot source code (this repo). Read-only at runtime. Contains skills and operational guidance.
8181

8282
The canonical soul file list is `identity.TemplateNames` in `internal/identity/embed.go` — single source of truth used by both `agent/context.go` and `memory/indexer.go`.
8383

8484
## Workspace Scaffolding
8585

86-
Running `gomikrobot onboard` creates `~/.gomikrobot/config.json` **and** scaffolds soul files into the workspace:
86+
Running `kafclaw onboard` creates `~/.kafclaw/config.json` **and** scaffolds soul files into the workspace:
8787

8888
```
8989
~/KafClaw-Workspace/
@@ -108,20 +108,20 @@ CLI/WhatsApp → Message Bus → Agent Loop → LLM Provider (OpenAI/OpenRouter)
108108
Context Builder (loads soul files from workspace/)
109109
```
110110

111-
### Key packages (`gomikrobot/internal/`)
111+
### Key packages (`internal/`)
112112

113113
- **agent/** — Core agent loop (`loop.go`) and context/soul-file loader (`context.go`).
114114
- **bus/** — Async message bus decoupling channels from the agent loop (pub-sub).
115115
- **channels/** — External integrations. WhatsApp uses `whatsmeow` (native, no Node bridge).
116-
- **config/** — Config struct with env/file/default loading. Config file: `~/.gomikrobot/config.json`. Env prefix: `MIKROBOT_`.
116+
- **config/** — Config struct with env/file/default loading. Config file: `~/.kafclaw/config.json`. Env prefix: `MIKROBOT_`.
117117
- **provider/** — LLM provider abstraction. OpenAI/OpenRouter implementations, Whisper transcription, TTS.
118118
- **session/** — Per-session conversation history, JSONL persistence, thread-safe.
119-
- **timeline/** — SQLite event log at `~/.gomikrobot/timeline.db`.
119+
- **timeline/** — SQLite event log at `~/.kafclaw/timeline.db`.
120120
- **tools/** — Registry-based tool system. Filesystem ops have path safety; shell exec has deny-pattern filtering and timeout (default 60s).
121121

122122
## Configuration
123123

124-
Loaded in order: env vars > `~/.gomikrobot/config.json` > defaults.
124+
Loaded in order: env vars > `~/.kafclaw/config.json` > defaults.
125125

126126
Default model: `anthropic/claude-sonnet-4-5`. Default workspace: `~/KafClaw-Workspace`. Gateway ports: 18790 (API), 18791 (dashboard).
127127

@@ -135,7 +135,7 @@ Shell execution (`internal/tools/shell.go`) uses deny-pattern filtering (blocks
135135

136136
**New channel:** Implement `Channel` interface in `internal/channels/`, subscribe to the message bus, add config fields to `internal/config/config.go`.
137137

138-
**New CLI command:** Create file in `cmd/gomikrobot/cmd/`, define cobra command, register in `root.go` init().
138+
**New CLI command:** Create file in `cmd/kafclaw/cmd/`, define cobra command, register in `root.go` init().
139139

140140
## Task Workflow
141141

@@ -160,4 +160,4 @@ Bug reports and task logs are **public** — they go in the code repo under `doc
160160

161161
## Go Module
162162

163-
The Go module path is `github.com/KafClaw/KafClaw/gomikrobot`.
163+
The Go module path is `github.com/KafClaw/KafClaw`.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ WORKDIR /src
1010
COPY go.mod go.sum ./
1111
RUN go mod download
1212
COPY . .
13-
RUN CGO_ENABLED=1 go build -o /gomikrobot ./cmd/gomikrobot
13+
RUN CGO_ENABLED=1 go build -o /kafclaw ./cmd/kafclaw
1414

1515
# ---- Runtime ----
1616
FROM alpine:3.20
1717

1818
RUN apk add --no-cache ca-certificates git
1919

20-
COPY --from=builder /gomikrobot /usr/local/bin/gomikrobot
20+
COPY --from=builder /kafclaw /usr/local/bin/kafclaw
2121
COPY web /app/web
2222
COPY scripts/docker-entrypoint.sh /app/docker-entrypoint.sh
2323
RUN chmod +x /app/docker-entrypoint.sh
File renamed without changes.
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,29 @@ test-classification: ## Run internal/external message classification E2E test (v
106106
test-orchestrator: ## Run orchestrator tests (verbose)
107107
go test -v ./internal/orchestrator/
108108

109-
build: check ## Build the gomikrobot binary
110-
go build ./cmd/gomikrobot
109+
build: check ## Build the kafclaw binary
110+
go build ./cmd/kafclaw
111111

112-
install: build ## Install gomikrobot to /usr/local/bin
113-
cp gomikrobot /usr/local/bin/gomikrobot
114-
@echo "Installed to /usr/local/bin/gomikrobot"
112+
install: build ## Install kafclaw to /usr/local/bin
113+
cp kafclaw /usr/local/bin/kafclaw
114+
@echo "Installed to /usr/local/bin/kafclaw"
115115

116116
# ---------------------------------------------------------------------------
117117
# Three operation modes (Go gateway)
118118
# ---------------------------------------------------------------------------
119119

120120
run: build ## Build and run gateway (default, standalone mode)
121-
$(SOURCE_ENV) ./gomikrobot gateway
121+
$(SOURCE_ENV) ./kafclaw gateway
122122

123123
run-standalone: build ## Mode 2: Standalone desktop — no Kafka, no orchestrator
124124
$(SOURCE_ENV) MIKROBOT_GROUP_ENABLED=false \
125-
./gomikrobot gateway
125+
./kafclaw gateway
126126

127127
run-full: build ## Mode 1: Full desktop — group + orchestrator enabled
128128
$(SOURCE_ENV) MIKROBOT_GROUP_ENABLED=true \
129129
MIKROBOT_ORCHESTRATOR_ENABLED=true \
130130
MIKROBOT_ORCHESTRATOR_ROLE=orchestrator \
131-
./gomikrobot gateway
131+
./kafclaw gateway
132132

133133
run-headless: build ## Mode 3: Headless — binds 0.0.0.0, auth token required
134134
@if [ -z "$$MIKROBOT_GATEWAY_AUTH_TOKEN" ]; then \
@@ -144,7 +144,7 @@ run-headless: build ## Mode 3: Headless — binds 0.0.0.0, auth token required
144144
MIKROBOT_GROUP_ENABLED=true \
145145
MIKROBOT_ORCHESTRATOR_ENABLED=true \
146146
MIKROBOT_ORCHESTRATOR_ROLE=orchestrator \
147-
./gomikrobot gateway
147+
./kafclaw gateway
148148

149149
kill-gateway: ## Kill any running gateway on ports 18790/18791
150150
@set -euo pipefail; \
@@ -222,18 +222,18 @@ release-patch: ## Bump patch version, commit, tag, push → triggers CI release
222222

223223
dist-go: ## Cross-compile Go binaries locally (all platforms)
224224
@mkdir -p dist
225-
GOOS=darwin GOARCH=arm64 go build -o dist/gomikrobot-darwin-arm64 ./cmd/gomikrobot
226-
GOOS=darwin GOARCH=amd64 go build -o dist/gomikrobot-darwin-amd64 ./cmd/gomikrobot
227-
GOOS=linux GOARCH=amd64 go build -o dist/gomikrobot-linux-amd64 ./cmd/gomikrobot
228-
GOOS=linux GOARCH=arm64 go build -o dist/gomikrobot-linux-arm64 ./cmd/gomikrobot
225+
GOOS=darwin GOARCH=arm64 go build -o dist/kafclaw-darwin-arm64 ./cmd/kafclaw
226+
GOOS=darwin GOARCH=amd64 go build -o dist/kafclaw-darwin-amd64 ./cmd/kafclaw
227+
GOOS=linux GOARCH=amd64 go build -o dist/kafclaw-linux-amd64 ./cmd/kafclaw
228+
GOOS=linux GOARCH=arm64 go build -o dist/kafclaw-linux-arm64 ./cmd/kafclaw
229229
@echo "Built 4 binaries in dist/"
230-
@ls -lh dist/gomikrobot-*
230+
@ls -lh dist/kafclaw-*
231231

232232
# ---------------------------------------------------------------------------
233233
# Docker
234234
# ---------------------------------------------------------------------------
235235

236-
docker-build: ## Build local Docker image (gomikrobot:local) — multi-stage, no host binary needed
236+
docker-build: ## Build local Docker image (kafclaw:local) — multi-stage, no host binary needed
237237
docker build -t kafclaw:local -f Dockerfile .
238238

239239
docker-up: docker-build ## Start docker-compose using local image only

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KafClaw (GoMikroBot)
1+
KafClaw (KafClaw)
22
Copyright 2025-2026 KafClaw contributors
33

44
This product includes software developed at

0 commit comments

Comments
 (0)