claude-think 0.4.2 → 0.5.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.
- package/CHANGELOG.md +30 -0
- package/README.md +76 -66
- package/package.json +3 -2
- package/src/cli/commands/context.ts +69 -0
- package/src/cli/commands/learn.ts +24 -23
- package/src/cli/commands/setup.ts +828 -611
- package/src/cli/commands/status.ts +57 -57
- package/src/cli/commands/switch.ts +32 -0
- package/src/cli/index.ts +61 -134
- package/src/core/banner.ts +4 -21
- package/src/core/budget.ts +96 -0
- package/src/core/config.ts +34 -13
- package/src/core/context.ts +498 -0
- package/src/core/extractor.ts +373 -0
- package/src/core/file-tree.ts +104 -25
- package/src/core/generator.ts +145 -23
- package/src/core/names.ts +1 -1
- package/src/core/project-config.ts +143 -0
- package/src/core/project-detect.ts +12 -10
- package/src/core/schemas.ts +53 -0
- package/src/core/security.ts +24 -0
- package/src/tui/App.tsx +140 -143
- package/src/tui/components/Agents.tsx +153 -111
- package/src/tui/components/Automation.tsx +81 -47
- package/src/tui/components/FullScreen.tsx +0 -10
- package/src/tui/components/Help.tsx +54 -53
- package/src/tui/components/Memory.tsx +120 -145
- package/src/tui/components/Navigation.tsx +82 -47
- package/src/tui/components/Preferences.tsx +70 -52
- package/src/tui/components/Preview.tsx +30 -16
- package/src/tui/components/Profile.tsx +122 -43
- package/src/tui/components/ProfileSwitcher.tsx +44 -52
- package/src/tui/components/Search.tsx +18 -18
- package/src/tui/components/Skills.tsx +152 -110
- package/src/tui/components/StatusBar.tsx +49 -85
- package/src/tui/index.tsx +19 -3
- package/.claude/settings.local.json +0 -39
- package/.think.yaml +0 -30
- package/bun.lock +0 -156
- package/src/cli/commands/allow.ts +0 -46
- package/src/cli/commands/edit.ts +0 -64
- package/src/cli/commands/help.ts +0 -63
- package/src/cli/commands/init.ts +0 -83
- package/src/cli/commands/profile-commands.ts +0 -142
- package/src/cli/commands/profile.ts +0 -30
- package/src/cli/commands/project-learn.ts +0 -113
- package/src/cli/commands/review.ts +0 -130
- package/src/cli/commands/sync.ts +0 -43
- package/src/cli/commands/tree.ts +0 -30
- package/src/templates/allowed-commands.md +0 -19
- package/src/templates/corrections.md +0 -4
- package/src/templates/pending.md +0 -5
- package/src/templates/settings.md +0 -6
- package/src/tui/components/Permissions.tsx +0 -92
- package/src/tui/components/QuickActions.tsx +0 -155
- package/tsconfig.json +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.5.0] - 2025-02-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`think context`** — Project-level context generation
|
|
12
|
+
- Regex-based signature extraction (functions, types, classes, enums)
|
|
13
|
+
- Token-aware adaptive file tree (collapses large directories, adjusts depth)
|
|
14
|
+
- Budget allocation across sections (overview, structure, key files, code map, knowledge)
|
|
15
|
+
- `.think.yaml` project config (optional — works with zero config)
|
|
16
|
+
- Output to `~/.claude/projects/<path>/CLAUDE.md` (zero project pollution)
|
|
17
|
+
- `--budget`, `--force`, `--dry-run` flags
|
|
18
|
+
- **`think switch <profile>`** — Switch profile with auto-sync
|
|
19
|
+
- **First-run detection** — Running `think` with no config auto-launches setup wizard
|
|
20
|
+
- **Automation section in TUI** — Workflows and subagent rules management
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- **CLI reduced to 5 commands**: `setup`, `switch`, `context`, `learn`, `status`
|
|
24
|
+
- **TUI redesign** — Clean heading hierarchy, compact header, horizontal tab navigation
|
|
25
|
+
- **Memory simplified** — Learnings only (removed corrections and pending tabs)
|
|
26
|
+
- **Generator** — Proper markdown nesting (strips redundant headings, bumps heading levels)
|
|
27
|
+
- Auto-sync on profile switch, learn, and TUI exit
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
- `think init` (merged into first-run detection)
|
|
31
|
+
- `think sync` (auto-triggered by switch, learn, setup, TUI exit)
|
|
32
|
+
- `think profile` subcommands (moved to TUI, replaced by `think switch`)
|
|
33
|
+
- `think review`, `think edit`, `think allow`, `think tree`, `think project`, `think help`
|
|
34
|
+
- Permissions section from TUI and config
|
|
35
|
+
- Corrections and pending memory tabs
|
|
36
|
+
- ASCII art banner (replaced with compact header)
|
|
37
|
+
|
|
8
38
|
## [0.4.2] - 2025-02-06
|
|
9
39
|
|
|
10
40
|
### Added
|
package/README.md
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
# think
|
|
2
2
|
|
|
3
|
-
Personal context manager for Claude. Stop repeating yourself.
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
╭────────────────────────────────────────────╮
|
|
7
|
-
│ │
|
|
8
|
-
│ ████████╗██╗ ██╗██╗███╗ ██╗██╗ ██╗ │
|
|
9
|
-
│ ╚══██╔══╝██║ ██║██║████╗ ██║██║ ██╔╝ │
|
|
10
|
-
│ ██║ ███████║██║██╔██╗ ██║█████╔╝ │
|
|
11
|
-
│ ██║ ██╔══██║██║██║╚██╗██║██╔═██╗ │
|
|
12
|
-
│ ██║ ██║ ██║██║██║ ╚████║██║ ██╗ │
|
|
13
|
-
│ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ │
|
|
14
|
-
│ │
|
|
15
|
-
│ Personal Context for Claude │
|
|
16
|
-
│ │
|
|
17
|
-
╰────────────────────────────────────────────╯
|
|
18
|
-
```
|
|
3
|
+
Personal context manager for Claude Code. Stop repeating yourself.
|
|
19
4
|
|
|
20
5
|
## What is this?
|
|
21
6
|
|
|
22
7
|
`think` manages your personal preferences, patterns, and memory for Claude Code. Instead of repeating "use bun not npm" or "be direct, skip the fluff" every session, configure it once and Claude remembers.
|
|
23
8
|
|
|
9
|
+
It also generates project-level context — file trees, code signatures, and knowledge base docs — so Claude deeply understands your codebase without you explaining it.
|
|
10
|
+
|
|
24
11
|
## Install
|
|
25
12
|
|
|
26
13
|
```bash
|
|
@@ -34,12 +21,15 @@ npm install -g claude-think
|
|
|
34
21
|
## Quick Start
|
|
35
22
|
|
|
36
23
|
```bash
|
|
37
|
-
#
|
|
38
|
-
think
|
|
24
|
+
# First run launches setup wizard automatically
|
|
25
|
+
think
|
|
39
26
|
|
|
40
|
-
#
|
|
27
|
+
# Or run setup directly
|
|
41
28
|
think setup
|
|
42
29
|
|
|
30
|
+
# Generate project context (run from your project directory)
|
|
31
|
+
think context
|
|
32
|
+
|
|
43
33
|
# Start using Claude - your context is automatically loaded
|
|
44
34
|
claude
|
|
45
35
|
```
|
|
@@ -47,44 +37,49 @@ claude
|
|
|
47
37
|
## How it works
|
|
48
38
|
|
|
49
39
|
1. Your preferences live in `~/.think/profiles/<name>/` (markdown files)
|
|
50
|
-
2. `think
|
|
51
|
-
3.
|
|
40
|
+
2. `think` auto-syncs to `~/.claude/CLAUDE.md` which Claude reads at session start
|
|
41
|
+
3. `think context` scans your project and writes to `~/.claude/projects/<path>/CLAUDE.md`
|
|
42
|
+
4. Zero project pollution — everything lives in `~/.think` and `~/.claude`
|
|
52
43
|
|
|
53
|
-
##
|
|
44
|
+
## Commands
|
|
54
45
|
|
|
55
|
-
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| `think` | Launch interactive TUI |
|
|
49
|
+
| `think setup` | Interactive profile wizard (re-runnable) |
|
|
50
|
+
| `think switch <profile>` | Switch profile + auto-sync |
|
|
51
|
+
| `think context` | Generate project context for current directory |
|
|
52
|
+
| `think learn "..."` | Add a learning + auto-sync |
|
|
53
|
+
| `think status` | Show profile, tokens, project context status |
|
|
54
|
+
|
|
55
|
+
### think context
|
|
56
|
+
|
|
57
|
+
Scans your project and generates a context file Claude reads automatically:
|
|
56
58
|
|
|
57
59
|
```bash
|
|
58
|
-
think
|
|
59
|
-
think
|
|
60
|
-
think
|
|
61
|
-
think profile use work # Switch (auto-syncs)
|
|
62
|
-
think profile delete old # Remove a profile
|
|
60
|
+
think context # Default 12k token budget
|
|
61
|
+
think context --budget 20000 # Larger budget
|
|
62
|
+
think context --dry-run # Preview without writing
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Output includes:
|
|
66
|
+
- Project overview (runtime, frameworks, tooling)
|
|
67
|
+
- Token-aware adaptive file tree
|
|
68
|
+
- Code map (function/type signatures)
|
|
69
|
+
- Key files (full source for important files)
|
|
70
|
+
- Knowledge base (from `.think/knowledge/*.md`)
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
Configure with `.think.yaml` in your project root (optional — works with zero config).
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
| `think profile list` | List all profiles |
|
|
79
|
-
| `think profile use <name>` | Switch to a profile |
|
|
80
|
-
| `think profile create <name>` | Create new profile |
|
|
81
|
-
| `think profile delete <name>` | Delete a profile |
|
|
82
|
-
| `think profile edit` | Edit profile.md |
|
|
83
|
-
| `think edit <file>` | Edit any config file |
|
|
84
|
-
| `think allow "cmd"` | Pre-approve a command |
|
|
85
|
-
| `think tree` | Preview project file tree |
|
|
86
|
-
| `think project` | Generate CLAUDE.md for current project |
|
|
87
|
-
| `think help` | Show all commands |
|
|
74
|
+
## Profiles
|
|
75
|
+
|
|
76
|
+
Switch between different configurations for work, personal projects, or clients:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
think switch work # Switch profile (auto-syncs)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Press `P` in the TUI to manage profiles interactively (create, delete, switch).
|
|
88
83
|
|
|
89
84
|
## TUI
|
|
90
85
|
|
|
@@ -93,12 +88,15 @@ Run `think` to launch the fullscreen TUI:
|
|
|
93
88
|
| Key | Action |
|
|
94
89
|
|-----|--------|
|
|
95
90
|
| `Tab` | Switch sections |
|
|
91
|
+
| `1-6` | Jump to section |
|
|
96
92
|
| `↑↓` / `jk` | Navigate / scroll |
|
|
97
|
-
|
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
93
|
+
| `←→` | Switch sub-tabs |
|
|
94
|
+
| `e` | Edit in $EDITOR |
|
|
95
|
+
| `n` | New item |
|
|
100
96
|
| `d` | Delete item |
|
|
101
|
-
| `
|
|
97
|
+
| `c` | Duplicate |
|
|
98
|
+
| `r` | Rename |
|
|
99
|
+
| `s` | Sync CLAUDE.md |
|
|
102
100
|
| `p` | Preview CLAUDE.md |
|
|
103
101
|
| `P` | Switch profile |
|
|
104
102
|
| `/` | Search all files |
|
|
@@ -107,25 +105,37 @@ Run `think` to launch the fullscreen TUI:
|
|
|
107
105
|
|
|
108
106
|
## What you can configure
|
|
109
107
|
|
|
110
|
-
- **Profile**
|
|
111
|
-
- **
|
|
112
|
-
- **
|
|
113
|
-
- **
|
|
114
|
-
- **
|
|
115
|
-
- **
|
|
116
|
-
- **Skills & Agents** - Custom workflows for Claude
|
|
108
|
+
- **Profile** — Identity, communication style, personality
|
|
109
|
+
- **Preferences** — Tools, patterns, anti-patterns
|
|
110
|
+
- **Memory** — Learnings that persist across sessions
|
|
111
|
+
- **Skills** — Custom skill definitions for Claude
|
|
112
|
+
- **Agents** — Subagent configurations with tools and triggers
|
|
113
|
+
- **Automation** — Workflows and subagent rules
|
|
117
114
|
|
|
118
115
|
## Example
|
|
119
116
|
|
|
120
117
|
After setup, Claude automatically knows:
|
|
121
118
|
|
|
122
119
|
```markdown
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
|
|
120
|
+
## About the User
|
|
121
|
+
|
|
122
|
+
Name: Amit
|
|
123
|
+
|
|
124
|
+
Senior developer - experienced and autonomous
|
|
125
|
+
|
|
126
|
+
## How Claude Should Behave
|
|
127
|
+
|
|
128
|
+
- Be direct and minimal - no fluff, just answers and code
|
|
129
|
+
- Skip lengthy reasoning unless asked
|
|
130
|
+
|
|
131
|
+
## Tool Preferences
|
|
132
|
+
|
|
133
|
+
### Runtime & Package Manager
|
|
134
|
+
- Use Bun (not npm, pnpm, yarn)
|
|
135
|
+
|
|
136
|
+
### Languages
|
|
137
|
+
- TypeScript
|
|
138
|
+
- Rust
|
|
129
139
|
```
|
|
130
140
|
|
|
131
141
|
No more repeating yourself.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-think",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Personal context manager for Claude - manage your preferences, patterns, and memory",
|
|
5
5
|
"author": "Amit Feldman",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"ink": "^6.6.0",
|
|
35
35
|
"ink-text-input": "^6.0.0",
|
|
36
36
|
"react": "^19.2.4",
|
|
37
|
-
"string-similarity": "^4.0.4"
|
|
37
|
+
"string-similarity": "^4.0.4",
|
|
38
|
+
"zod": "^4.3.6"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { getProjectClaudeMdPath } from "../../core/config.ts";
|
|
3
|
+
import { generateProjectContext } from "../../core/context.ts";
|
|
4
|
+
import type { ContextResult } from "../../core/context.ts";
|
|
5
|
+
|
|
6
|
+
export async function contextCommand(options: {
|
|
7
|
+
budget?: string;
|
|
8
|
+
force?: boolean;
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
}): Promise<void> {
|
|
11
|
+
const projectDir = process.cwd();
|
|
12
|
+
|
|
13
|
+
console.log(` ${chalk.dim("Scanning project...")}`);
|
|
14
|
+
|
|
15
|
+
let result: ContextResult;
|
|
16
|
+
try {
|
|
17
|
+
result = await generateProjectContext(projectDir, {
|
|
18
|
+
budget: options.budget ? parseInt(options.budget, 10) : undefined,
|
|
19
|
+
force: options.force,
|
|
20
|
+
dryRun: options.dryRun,
|
|
21
|
+
});
|
|
22
|
+
} catch (err) {
|
|
23
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
24
|
+
console.log(` ${chalk.red("\u25C6")} ${message}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Section summary
|
|
29
|
+
const sectionCount = result.sections.length;
|
|
30
|
+
const truncatedCount = result.truncated.length;
|
|
31
|
+
|
|
32
|
+
console.log(
|
|
33
|
+
` ${chalk.cyan("\u25C6")} ${sectionCount} section${sectionCount !== 1 ? "s" : ""} generated` +
|
|
34
|
+
(truncatedCount > 0
|
|
35
|
+
? chalk.dim(` · ${truncatedCount} truncated`)
|
|
36
|
+
: "")
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Token budget
|
|
40
|
+
const budgetValue = options.budget ? parseInt(options.budget, 10) : 8000;
|
|
41
|
+
const usedK = (result.totalTokens / 1000).toFixed(1);
|
|
42
|
+
const budgetK = (budgetValue / 1000).toFixed(0);
|
|
43
|
+
console.log(
|
|
44
|
+
` ${chalk.cyan("\u25C6")} Project context: ${chalk.bold(usedK + "k")} of ${budgetK}k token budget`
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (options.dryRun) {
|
|
48
|
+
// Show section breakdown
|
|
49
|
+
console.log();
|
|
50
|
+
console.log(chalk.dim(" Section breakdown:"));
|
|
51
|
+
for (const section of result.sections) {
|
|
52
|
+
const sTokens = (section.tokens / 1000).toFixed(1);
|
|
53
|
+
console.log(
|
|
54
|
+
` ${chalk.dim(String(section.priority).padStart(2))} ${section.title.padEnd(30)} ${chalk.dim(sTokens + "k tokens")}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
console.log();
|
|
58
|
+
console.log(chalk.dim(" Dry run — nothing written."));
|
|
59
|
+
} else {
|
|
60
|
+
const outputPath = getProjectClaudeMdPath(projectDir);
|
|
61
|
+
const shortPath = outputPath.replace(
|
|
62
|
+
process.env.HOME || "~",
|
|
63
|
+
"~"
|
|
64
|
+
);
|
|
65
|
+
console.log(
|
|
66
|
+
` ${chalk.cyan("\u25C6")} Written to ${chalk.dim(shortPath)}`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { existsSync } from "fs";
|
|
2
2
|
import { readFile, writeFile } from "fs/promises";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import { CONFIG, thinkPath } from "../../core/config";
|
|
5
|
-
import { addLearning } from "../../core/dedup";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Add a new learning with deduplication
|
|
10
|
-
*/
|
|
11
|
-
export async function learnCommand(
|
|
12
|
-
learning: string,
|
|
13
|
-
options: { noSync?: boolean }
|
|
14
|
-
): Promise<void> {
|
|
4
|
+
import { CONFIG, thinkPath } from "../../core/config.ts";
|
|
5
|
+
import { addLearning, extractLearnings } from "../../core/dedup.ts";
|
|
6
|
+
import { generatePlugin } from "../../core/generator.ts";
|
|
7
|
+
|
|
8
|
+
export async function learnCommand(learning: string): Promise<void> {
|
|
15
9
|
if (!existsSync(CONFIG.thinkDir)) {
|
|
16
|
-
console.log(
|
|
10
|
+
console.log(
|
|
11
|
+
chalk.red(` ~/.think not found. Run ${chalk.bold("think setup")} first.`)
|
|
12
|
+
);
|
|
17
13
|
process.exit(1);
|
|
18
14
|
}
|
|
19
15
|
|
|
@@ -29,22 +25,27 @@ export async function learnCommand(
|
|
|
29
25
|
const result = addLearning(content, learning);
|
|
30
26
|
|
|
31
27
|
if (!result.added) {
|
|
32
|
-
console.log(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.log("
|
|
28
|
+
console.log(
|
|
29
|
+
` ${chalk.yellow("\u25C6")} Similar learning already exists:`
|
|
30
|
+
);
|
|
31
|
+
console.log(chalk.dim(` "${result.similar}"`));
|
|
36
32
|
return;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
// Write updated content
|
|
40
36
|
await writeFile(learningsPath, result.newContent);
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
// Count total learnings
|
|
39
|
+
const total = extractLearnings(result.newContent).length;
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
console.log(
|
|
42
|
+
` ${chalk.cyan("\u25C6")} Added learning (${chalk.bold(String(total))} total)`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Auto-sync
|
|
46
|
+
await generatePlugin();
|
|
47
|
+
|
|
48
|
+
console.log(
|
|
49
|
+
` ${chalk.cyan("\u25C6")} Synced ~/.claude/CLAUDE.md`
|
|
50
|
+
);
|
|
50
51
|
}
|