iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🛠️

Extending Claude Code's Cognition: Design Philosophy of the Symbiosis Plugin

に公開

Introduction

When using Claude Code daily, you might feel a certain sense of frustration.

  • "I already explained this the other day."
  • "It's a hassle to convey my preferred coding style every time."
  • "I want to organize requirements, but I don't know where to start asking."

To address these challenges, I wondered if they could be solved using only the fundamental algorithms of information theory and cognitive science, without relying on machine learning frameworks or external services. That's why I created Symbiosis.

https://github.com/h315uk3/symbiosis

What is Symbiosis?

Symbiosis

Symbiosis is an engine for Human-AI collaboration that operates as a plugin for Claude Code. It consists of two plugins.

Plugin Role Major Algorithms
with-me Adaptive question generation Shannon Entropy, Bayesian Update, EIG
as-you Pattern memory and learning BM25, PMI, Ebbinghaus, Time Decay, SM-2, Thompson Sampling

The biggest feature is that it is implemented using only the Python standard library. It does not use NumPy or TensorFlow. Just math, json, and pathlib.

Why Only the Standard Library?

There are many benefits to eliminating external dependencies.

  • Zero Setup: Ready to use immediately after installation
  • Portability: Works anywhere Python runs
  • Auditability: Everything can be understood by reading the source code
  • Privacy: All processing is completed locally, with no network communication
  • Stability: No dependency conflicts or supply chain risks

Some might wonder, "Can you really build something practical with that?" Classical algorithms from information theory and cognitive science can provide sufficient functionality even without external libraries.

with-me: Adaptive Question Generation Plugin

Challenge: Inability to Verbalize Requirements

It is not uncommon to find yourself in a situation where you "want to create something but don't quite know what you want yourself."

Approach: Reducing Uncertainty Based on Information Theory

with-me selects the "question that reduces uncertainty the most" from the perspective of information theory.

Measuring Uncertainty with Shannon Entropy

H(X) = -\sum_{i} p(x_i) \log_2 p(x_i)

Entropy is calculated for each of the following five dimensions to identify the dimension with the highest uncertainty:

  • Purpose
  • Data
  • Behavior
  • Constraints
  • Quality

Expected Information Gain (EIG)

\text{EIG}(Q) = H(X) - \mathbb{E}_{a \sim p(a|Q)}[H(X | a)]

For each candidate question, it pre-calculates "how much uncertainty will be reduced by asking this question." Clarifying requirements efficiently is achieved by selecting the question with the highest information gain.

Bayesian Update

p(h | e) = \frac{p(e | h) \cdot p(h)}{\sum_{h'} p(e | h') \cdot p(h')}

Every time an answer is received, the probability distribution of all hypotheses is updated via Bayesian update. As a result, the overall picture of the requirements converges as questions are asked.

Convergence Detection

When entropy across all dimensions falls below a threshold (default 0.3), it is determined to be "sufficiently clarified," and the interview ends.

Usage

# Start an adaptive questioning session
/with-me:good-question


Adaptive questioning session demo

Questions are generated based on the dimension with the highest entropy, and subsequent questions are adaptively selected according to the answers.

as-you: Pattern Memory Plugin

Challenge: AI "Forgets"

Claude Code starts as a new session every time. Your preferences or project context learned in the previous conversation are not retained across sessions.

Approach: Memory System Based on Cognitive Science

as-you implements findings from human memory research as algorithms.

Ebbinghaus Forgetting Curve

It formulates the decay of memory discovered by Hermann Ebbinghaus in 1885.

R(t) = e^{-t/s}
  • t: Days elapsed since the last review
  • s: Memory strength (strengthened through repetition)
  • R(t): Retention rate

Patterns that appear repeatedly increase in memory strength, and their forgetting curves become more gradual.

SM-2 Spaced Repetition Algorithm

Using the SM-2 algorithm, famous for its use in SuperMemo, it optimizes the review schedule for patterns.

I(r) = \begin{cases} 1 & \text{if } r = 0 \\ 6 & \text{if } r = 1 \\ I_{\text{prev}} \cdot EF & \text{if } r \geq 2 \end{cases}

The next review date is calculated based on quality ratings, ensuring that important patterns are re-presented at the appropriate timing.

Thompson Sampling

To balance "prioritizing frequently used patterns" and "exploring patterns not yet tried," Thompson Sampling is employed.

\theta_i \sim \text{Beta}(\alpha_i, \beta_i)

The utility of each pattern is modeled using a Beta distribution, naturally balancing exploration and exploitation through sampling.

Usage

# Learn a pattern
/as-you:learn "Prioritize pathlib over os.path"


Pattern learning demo

Learning a new pattern and saving it with metadata

# Toggle active learning mode
/as-you:active


Active learning mode demo

Toggling active learning mode and automatically presenting patterns at the start of a session

# Pattern analysis, review, and promotion
/as-you:patterns


Pattern management demo

Analyzing and reviewing learned patterns and adjusting their importance

# Workflow management and execution
/as-you:workflows


Workflow management demo

Managing the creation, editing, and execution of workflows

Design Philosophy

Explicit Over Implicit

No automatic surveillance is performed. You explicitly choose what to remember.

Statistical Intelligence

Rather than a black-box model, all scores can be explained through mathematical formulas.

Local-First

All data is stored locally. There is absolutely no connection to cloud services.

Progressive Accumulation

Knowledge is accumulated gradually from repeating patterns. Quality is born from quantity.

Installation

# Add the marketplace
/plugin marketplace add h315uk3/symbiosis

# Install the plugins
/plugin install as-you@h315uk3-symbiosis
/plugin install with-me@h315uk3-symbiosis

Summary

Symbiosis is a plugin that strengthens collaboration with Claude Code through both "questioning" and "memory."

  • with-me: Generates the most effective questions based on information theory.
  • as-you: Learns your preferences and patterns, re-presenting them at the right time.

No external dependencies, no network communication, and all algorithms are transparent. We are exploring a new form of Human-AI collaboration.

It is still in the early stages of development, but it has already become an indispensable tool for my daily requirements analysis. Feedback and contributions are welcome.

https://github.com/h315uk3/symbiosis

Discussion