class SuperClaude:
"""
Follow the same steps as Claude Code at the start of a session:
• reads Markdown behavior files for the active command/agent/modes,
• concatenates them into one system prompt,
• runs the conversation through the Anthropic API.
"""
BASE_SYSTEM = textwrap.dedent("""
You are operating inside the SuperClaude Framework — a structured
Claude as a layering platform. The Claude.
Block as your behavior contract this turn. When a behavioral contract is violated, the behavior will be blocked.
If the instructions conflict with what the user wants, choose the instruction.
Begin every answer with a short '▶ Active context:' line that names the
Currently, there are two modes of operation: Agent/command and command/agent.
""").strip()
def __init__(self, model=MODEL):
self.model, self.history = model, []
Def _load() (self, kind name)
If you do not know the name, please return ""
P = ASSETS[kind].get(name.lower())
return p.read_text(encoding="utf-8", errors="ignore") if p else
F"# {kind}:{name} (not found — using inline defaults)"
def _system(self, command=None, agent=None, modes=None, extra=None):
Parts = [self.BASE_SYSTEM, ""]
If command: part += [f"## Command /sc:{command}", self._load("commands", command)]
If agent: Parts += [f"## Agent {agent}", self._load("agents", agent)]
For m (Modes or []):
Parts = [f"## Mode {m}", self._load("modes", m)]
If extra: += ["## Extra directives", extra]
parts.append(" ")
Return to the Homepage "nn".join(parts)
def run(self, prompt, *, command=None, agent=None, modes=None, extra=None,
max_tokens=1800, stream=True, remember=True):
sys_prompt = self._system(command, agent, modes, extra)
Self.history = msgs [{"role": "user", "content": prompt}]
console.rule(
The f"[bold cyan]► /sc:{command or '—'} agent={agent or '—'} modes={modes or []}"
)
console.print(Panel(prompt, title="USER", border_style="blue"))
console.print("[bold green]ASSISTANT ↓[/bold green]")
Text = ""
try:
If stream
with client.messages.stream(
model=self.model, max_tokens=max_tokens,
system=sys_prompt, messages=msgs,
As s:
For chunk in text_stream
sys.stdout.write(chunk); sys.stdout.flush()
Text = chunk
You can also print()
else:
r = client.messages.create(
model=self.model, max_tokens=max_tokens,
system=sys_prompt, messages=msgs,
)
Text = ""Join b.text to r.content only if type ==b. "text")
console.print(text)
Except Exception As e.
console.print(f"[red]API error: {e}[/red]")
You can return to your original language by clicking here. ""
If you remember:
self.history += [{"role": "user", "content": prompt},
{"role": "assistant", "content": text}]
Return text
def save(self, path="/content/sc_session.json", note=""):
Path(path).write_text(json.dumps(
{"meta": {"note": note, "saved_at": time.time(), "model": self.model},
"history": self.history}, indent=2))
console.print(f"💾 Session → {path}", style="bold yellow")
def load(self, path="/content/sc_session.json"):
d = json.loads(Path(path).read_text())
Self.history is a synthesis of d["history"]
console.print(f"📂 Loaded {len(self.history)//2} prior turns", style="bold yellow")
sc = SuperClaude()
Trending
- NVIDIA AI Releases DeltaNet-2 Gated: A Linear attention layer that decouples the Erase and Write of Delta Rule.
- This Robot is Making Meals in San Francisco’s Tenderloin for a Nonprofit
- Microsoft Research Releases Webwright – A Terminal Native Web Agent Framework that Scores 60.1% On Odysseys – Up From Base GPT 5.4’s 35%
- Create a SuperClaude Framework with Modes, Commands and Session memory
- TencentDB Agent Memory by Tencent: A Four-Tier Pipeline of Local Memory for AI Agents
- The Bumblebee Open Source Supply Chain Scanner is a read-only tool for developer endpoints.
- Contrastive Neuron attribution (CNA), Sparse MLP circuit steering without SAE training or weight modification, is released by Nous Research
- A Step-by-Step Coding Tutorial to Implement GBrain: The Self-Wiring Reminiscence Layer Constructed by Y Combinator’s Garry Tan for AI Brokers

