Skip to main content

AI Compound Interest Knowledge Management - Bank your thoughts, compound your intelligence

Project description

๐Ÿฆ ThinkBank

AI Compound Interest Knowledge Management

Bank your thoughts, compound your intelligence. ๅญ˜ๅ‚จๆ€ๆƒณ๏ผŒๅคๅˆฉๆ™บๆ…งใ€‚

โš ๏ธ ALPHA RELEASE - UNDER ACTIVE DEVELOPMENT

ThinkBank is in early alpha stage. Expect bugs and breaking changes. Not recommended for production use yet.

โญ Star the repo to follow progress!

License: MIT Python 3.9+ Code style: black


What is ThinkBank?

ThinkBank is your personal knowledge bank where every conversation deposits wisdom that compounds over time. Just like financial compound interest, every piece of knowledge you store amplifies the value of future interactions.

Instead of treating each conversation as isolated, ThinkBank captures, evaluates, and organizes insights so your AI assistant becomes smarter with every interaction. It's not just about storing informationโ€”it's about continuous improvement through intelligent filtering and categorization.

The Problem

AI assistants like Claude are powerful but stateless. Every conversation starts from scratch:

  • โŒ Repeat the same explanations multiple times
  • โŒ No memory of past preferences or decisions
  • โŒ Cannot learn from successful patterns
  • โŒ Waste tokens on redundant context

The Solution: AI Compound Interest

ThinkBank implements a 5-factor knowledge value system with AI self-aware filtering:

  1. AI Self-Aware Worthiness Filtering - AI decides what knowledge is worth storing
  2. 10 AI Blind Spot Categories - Focus on gaps in AI's training data
  3. 10 AI Common Sense Categories - Capture domain-specific knowledge
  4. Conversation Quality Improvement (CQI) - Measurable impact on future conversations
  5. On-Demand Web UI - Review and manage knowledge visually

Key Features

๐Ÿง  Intelligent Worthiness Filtering

Not all information deserves storage. ThinkBank uses AI self-awareness to evaluate:

  • โœ… Fills a genuine blind spot (not common knowledge)
  • โœ… Reusable across conversations (not one-time facts)
  • โœ… Improves future conversation quality (measurable CQI impact)
  • โœ… Domain-specific insights (not generic advice)
  • โœ… Concrete and actionable (not vague principles)

Example:

from thinkbank.core import WorthinessFilter

filter = WorthinessFilter()
decision, reasoning, confidence = filter.is_worth_storing(
    content="User prefers British English spelling (colour, organise)",
    conversation_context={
        "type": "user_preference",
        "domain": "writing_style"
    }
)

# Output:
# decision: STORE
# reasoning: "This is a user-specific preference that should be remembered..."
# confidence: 0.92

๐Ÿ“Š 5-Factor Value Assessment

Each knowledge item is scored on 5 dimensions (0.0 - 1.0):

Factor Description Example
Reusability How often will this be useful? User preferences: 0.95
Specificity How concrete and actionable? Exact command syntax: 0.90
AI Blind Spot How much does this fill a gap? Org-specific acronyms: 0.85
Impact Conversation quality improvement? Error pattern fix: 0.80
Decay How long will this stay relevant? Timeless principles: 0.95

Overall Score = Weighted average โ†’ Prioritize high-value knowledge

๐Ÿ—‚๏ธ 6 Knowledge Types

Organized by usage patterns:

  1. Skills - Step-by-step procedures
  2. Rules - Constraints and requirements
  3. Patterns - Recurring solutions
  4. Domain - Specialized terminology
  5. User - Personal preferences
  6. Lessons - Retrospective insights

๐Ÿ“ฆ Import/Export Knowledge Packs

Share knowledge across projects or teams:

# Export top-scoring items
thinkbank export my_knowledge.khb --min-score 0.7 --limit 50

# Import from shared pack
thinkbank import team_knowledge.khb --conflict merge

# Preview before importing
thinkbank import team_knowledge.khb --dry-run

Knowledge Pack Format (.khb):

  • Compressed JSON/YAML bundle
  • Includes metadata (author, version, creation date)
  • Conflict resolution strategies (skip/overwrite/merge/rename)
  • Portable across systems

๐ŸŒ On-Demand Web UI (Optional)

Note: Web UI is completely optional. All core functionality is available via CLI commands. If you prefer CLI-only workflows, you can skip the Web UI dependencies entirely.

Resource-efficient architecture:

  • โœ… Starts only when needed (thinkbank hub)
  • โœ… Auto-stops after 30 minutes idle
  • โœ… FastAPI + modern web stack
  • โœ… Browse, search, edit, and manage knowledge
  • โœ… Visual dashboard with statistics
# Install Web UI dependencies (if not already installed)
pip install fastapi uvicorn jinja2 python-multipart

# Start web UI
thinkbank hub

# Access at http://localhost:8765
# UI opens automatically in browser

# Stop when done
thinkbank stop

CLI-only users: The server will still run without Web UI dependencies, providing API-only access.


Installation

Standalone Installation

# Clone repository
git clone https://github.com/dwHou/ThinkBank.git
cd ThinkBank

# Install core dependencies
pip install -r requirements.txt

# Install package
pip install -e .

# Verify installation
thinkbank --help

# Optional: Install Web UI dependencies
pip install fastapi uvicorn jinja2 python-multipart

Note: Web UI dependencies are optional. All core functionality (CLI, Python API) works without them.

Install with Squad Integration

If you're using Squad framework:

cd /path/to/Squad

# Remove old plugin (if exists)
rm -rf ai-knowledge-plugin

# Add ThinkBank as submodule
git submodule add https://github.com/dwHou/ThinkBank thinkbank
git submodule update --init --recursive

# Install
cd thinkbank
./install.sh

Development Installation

# Clone with development dependencies
git clone https://github.com/dwHou/ThinkBank.git
cd ThinkBank

# Install with dev extras
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black thinkbank/
isort thinkbank/

Quick Start

1. Basic Usage (Python API)

from thinkbank.core import KnowledgeManager, WorthinessFilter

# Initialize
km = KnowledgeManager()
filter = WorthinessFilter()

# Check if knowledge is worth storing
content = "User prefers verbose error messages with full stack traces"
decision, reasoning, confidence = filter.is_worth_storing(content)

if decision == "STORE":
    # Create knowledge item
    knowledge_id = km.create(
        knowledge_type="user",
        title="Error Message Preference",
        content=content,
        factors={
            "reusability": 0.9,
            "specificity": 0.8,
            "ai_blind_spot": 0.7,
            "impact": 0.85,
            "decay": 0.95
        },
        tags=["preferences", "debugging"]
    )
    print(f"โœ“ Stored as {knowledge_id}")
else:
    print(f"โœ— Not worth storing: {reasoning}")

2. CLI Usage

# List all knowledge items
thinkbank list

# List by type
thinkbank list --type user --min-score 0.8

# Search
thinkbank search "error handling"

# Export filtered knowledge
thinkbank export high_value.khb --min-score 0.8 --tags "debugging,testing"

# Import knowledge pack
thinkbank import high_value.khb

# Start web UI
thinkbank hub

# Check status
thinkbank status

# Stop web UI
thinkbank stop

3. Integration with Claude Code

Add to your Claude Code rules (~/.claude/rules/thinkbank.md):

# ThinkBank Knowledge Management

When users share valuable information:
1. Check worthiness with WorthinessFilter
2. If STORE decision, create knowledge item
3. Categorize by type (skill/rule/pattern/domain/user/lesson)
4. Add relevant tags for searchability

Always prioritize high-reusability, high-impact knowledge.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 User/Claude                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚                       โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   CLI    โ”‚         โ”‚  Python API  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   Core Library        โ”‚
         โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
         โ”‚ - WorthinessFilter    โ”‚
         โ”‚ - ValueAssessor       โ”‚
         โ”‚ - KnowledgeManager    โ”‚
         โ”‚ - Taxonomy System     โ”‚
         โ”‚ - Import/Export       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   Storage Layer       โ”‚
         โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
         โ”‚ ~/.thinkbank/knowledge/   โ”‚
         โ”‚  โ”œโ”€ skills/           โ”‚
         โ”‚  โ”œโ”€ rules/            โ”‚
         โ”‚  โ”œโ”€ patterns/         โ”‚
         โ”‚  โ”œโ”€ domain/           โ”‚
         โ”‚  โ”œโ”€ user/             โ”‚
         โ”‚  โ””โ”€ lessons/          โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Optional Web UI:

         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   FastAPI Server      โ”‚
         โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
         โ”‚ - On-demand startup   โ”‚
         โ”‚ - Auto-timeout (30m)  โ”‚
         โ”‚ - RESTful API         โ”‚
         โ”‚ - Modern web UI       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Philosophy: AI Compound Interest

Traditional AI Conversations

Conversation 1: [Context] โ†’ [AI Response] โ†’ โŒ Forgotten
Conversation 2: [Same Context] โ†’ [AI Response] โ†’ โŒ Forgotten
Conversation 3: [Same Context] โ†’ [AI Response] โ†’ โŒ Forgotten

Result: Wasted tokens, repeated work, no learning

With ThinkBank

Conversation 1: [Context] โ†’ [AI Response] โ†’ โœ“ Stored (if valuable)
Conversation 2: [Minimal Context] โ†’ [AI uses stored knowledge] โ†’ โœ“ Updated
Conversation 3: [Minimal Context] โ†’ [AI uses refined knowledge] โ†’ โœ“ Evolved

Result: Compounding efficiency, continuous improvement

The Compound Effect

Metric Without ThinkBank With ThinkBank Improvement
Repeat Context 500 tokens/conv 50 tokens/conv 90% reduction
Conversation Quality Baseline +40% accuracy Measurable CQI
Time to Resolution 5 minutes 2 minutes 60% faster
Knowledge Retention 0% (stateless) 95% (persistent) โˆž improvement

Configuration

Default Paths

~/.squad/
โ”œโ”€โ”€ knowledge/              # Knowledge base directory
โ”‚   โ”œโ”€โ”€ skills/
โ”‚   โ”œโ”€โ”€ rules/
โ”‚   โ”œโ”€โ”€ patterns/
โ”‚   โ”œโ”€โ”€ domain/
โ”‚   โ”œโ”€โ”€ user/
โ”‚   โ””โ”€โ”€ lessons/
โ”œโ”€โ”€ knowledge_hub.pid       # Web UI process ID
โ””โ”€โ”€ config.yaml             # Configuration (optional)

Custom Configuration

Create ~/.squad/config.yaml:

thinkbank:
  # Storage settings
  knowledge_base_path: ~/.thinkbank/knowledge
  auto_backup: true
  backup_interval: 86400  # seconds

  # Worthiness filtering
  min_confidence_threshold: 0.7
  auto_store_high_confidence: true

  # Value assessment weights
  scoring_weights:
    reusability: 0.25
    specificity: 0.20
    ai_blind_spot: 0.25
    impact: 0.20
    decay: 0.10

  # Web UI
  web_ui_port: 8765
  auto_timeout_minutes: 30
  open_browser_on_start: true

  # Import/Export
  default_export_format: json
  compression_level: 6

Documentation


Comparison: ThinkBank vs. Alternatives

Feature ThinkBank RAG Systems Vector DBs Note-Taking
AI Self-Aware Filtering โœ… โŒ โŒ โŒ
Token Efficiency โœ… High โš ๏ธ Medium โš ๏ธ Medium โŒ Low
Worthiness Evaluation โœ… Automatic โŒ Manual โŒ None โŒ Manual
Structured Taxonomy โœ… 20 categories โš ๏ธ Generic โŒ Flat โš ๏ธ Tags only
CQI Metrics โœ… Built-in โŒ โŒ โŒ
Import/Export โœ… .khb format โš ๏ธ Varies โš ๏ธ Varies โœ…
Resource Usage โœ… Minimal โš ๏ธ Heavy โš ๏ธ Heavy โœ… Minimal

Key Differentiator: ThinkBank is purpose-built for AI assistants, not adapted from general-purpose systems.


Roadmap

Phase A (Complete) โœ“

  • โœ… Core library (worthiness filter, value assessor, knowledge manager)
  • โœ… AI blind spots & common sense taxonomies
  • โœ… Import/Export knowledge packs (.khb format)
  • โœ… On-demand web UI with auto-timeout
  • โœ… CLI commands

Phase B (Planned)

  • โณ Vector search for semantic similarity
  • โณ Knowledge evolution tracking (version history)
  • โณ Collaborative filtering (multi-user scenarios)
  • โณ Integration with external knowledge bases

Phase C (Future)

  • ๐Ÿ“… Machine learning for worthiness prediction
  • ๐Ÿ“… Automatic knowledge synthesis (combine related items)
  • ๐Ÿ“… Proactive knowledge suggestions
  • ๐Ÿ“… Cross-project knowledge sharing

See ROADMAP.md for details.


Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick Links:


License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • Inspired by: The concept of compound interest in finance
  • Built for: Claude Code and AI assistant ecosystems
  • Philosophy: "Make every conversation count"

Contact & Support


๐Ÿฆ ThinkBank
Bank your thoughts, compound your intelligence
ๅญ˜ๅ‚จๆ€ๆƒณ๏ผŒๅคๅˆฉๆ™บๆ…ง

Built with โค๏ธ for the AI community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thinkbank-0.1.0a1.tar.gz (56.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thinkbank-0.1.0a1-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file thinkbank-0.1.0a1.tar.gz.

File metadata

  • Download URL: thinkbank-0.1.0a1.tar.gz
  • Upload date:
  • Size: 56.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for thinkbank-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 7c6e8fd04684c9e7df2303594c11d1f93b700a9d065652906abf9b86acad92a3
MD5 746e08e19e6e192b417b131874382a88
BLAKE2b-256 f0c85d5c3915183c93b20cc01cfa2d460055fca5d23eb99b76d5ccd36914a0b3

See more details on using hashes here.

File details

Details for the file thinkbank-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: thinkbank-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for thinkbank-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a97bb19fbc0aa4301293dbeeca5fa457178d7c1c8c0e11e3a97da7d9bf3713af
MD5 c83f8981de55fa892763c20520768f5b
BLAKE2b-256 6de5e3a4725ec5fe47044f0fc03f0f34d15d5080d5e3cd8fbc6b3e4f01e7770b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page