Build a SuperClaude Framework Workflow with Commands, Agents, Modes, and Session Memory
In this tutorial, we construct a complicated workflow utilizing the SuperClaude Framework as a structured layer on prime of the Anthropic API. We clone the framework, uncover its instructions, brokers, and modes, and create a Python bridge that dynamically masses the related Markdown habits information into the system immediate earlier than every mannequin name. Through sensible examples, we discover brainstorming, frontend implementation, safety evaluation, enterprise technique, deep analysis planning, token-efficient responses, and a chained multi-step improvement workflow with session save and load help. We additionally learn the way these reusable framework belongings make our prompts extra constant, role-aware, and appropriate for complicated AI-assisted software program improvement duties.
import subprocess, sys, os, json, textwrap, getpass, time
from pathlib import Path
def _pip(pkg):
subprocess.run([sys.executable, "-m", "pip", "install", "-q", pkg], verify=True)
for mod, pkg in [("anthropic", "anthropic>=0.40.0"), ("rich", "rich")]:
strive:
__import__(mod)
besides ImportError:
print(f"
Installing {pkg} …")
_pip(pkg)
from anthropic import Anthropic
from wealthy.console import Console
from wealthy.panel import Panel
from wealthy.desk import Table
console = Console()
REPO_DIR = Path("/content material/TremendousClaude_Framework")
if not REPO_DIR.exists():
console.print("
Cloning TremendousClaude Framework …", model="cyan")
subprocess.run(
["git", "clone", "--depth", "1",
"https://github.com/SuperClaude-Org/SuperClaude_Framework.git",
str(REPO_DIR)],
verify=True, capture_output=True,
)
console.print(f"
Framework prepared at {REPO_DIR}", model="inexperienced")
We set up the required Python packages and import the core libraries wanted for the tutorial. We initialize the Rich console in order that our Colab output appears clear, structured, and readable. We then clone the TremendousClaude Framework repository and be certain the framework information can be found domestically.
def discover_assets(root: Path) -> dict:
"""Walk the repo and bucket each .md by folder key phrase."""
buckets = {"instructions": {}, "brokers": {}, "modes": {}}
for md in root.rglob("*.md"):
rel = str(md.relative_to(root)).decrease().exchange("", "/")
title = md.stem.decrease()
if "/instructions/" in f"/{rel}":
buckets["commands"].setdefault(title, md)
elif "/brokers/" in f"/{rel}":
buckets["agents"].setdefault(title, md)
elif "/modes/" in f"/{rel}" or "mode" in title:
buckets["modes"].setdefault(title, md)
return buckets
ASSETS = discover_assets(REPO_DIR)
console.print(
f"
Loaded {len(ASSETS['commands'])} instructions, "
f"{len(ASSETS['agents'])} brokers, {len(ASSETS['modes'])} modes",
model="daring magenta",
)
def show_inventory():
for type in ("instructions", "brokers", "modes"):
gadgets = sorted(ASSETS[kind])
if not gadgets: proceed
t = Table(title=f"{type.title()} ({len(gadgets)})")
t.add_column("Name", model="cyan")
for n in gadgets: t.add_row(n)
console.print(t)
show_inventory()
if "ANTHROPIC_API_KEY" not in os.environ:
strive:
from google.colab import userdata
os.environ["ANTHROPIC_API_KEY"] = userdata.get("ANTHROPIC_API_KEY")
console.print("
Loaded ANTHROPIC_API_KEY from Colab secrets and techniques.", model="inexperienced")
besides Exception:
os.environ["ANTHROPIC_API_KEY"] = getpass.getpass(
"
Paste your ANTHROPIC_API_KEY (hidden): "
)
consumer = Anthropic()
MODEL = "claude-sonnet-4-5"
We scan the cloned repository and uncover all Markdown-based instructions, brokers, and modes. We set up these belongings into separate buckets to allow them to be loaded dynamically throughout mannequin calls. We additionally configure the Anthropic API key and set the Claude mannequin that powers the TremendousClaude bridge.
class TremendousClaude:
"""
Mimics what Claude Code does at session begin:
• reads Markdown habits information for the lively command/agent/modes,
• concatenates them into one system immediate,
• runs the dialog by means of the Anthropic API.
"""
BASE_SYSTEM = textwrap.dedent("""
You are working contained in the TremendousClaude Framework — a structured
improvement platform layered on prime of Claude. Treat the <framework>
block as your behavioral contract for this flip. If a behavioral
instruction conflicts with the consumer request, desire the instruction.
Begin each reply with a brief '
Active context:' line that names the
command / agent / modes at the moment in impact.
""").strip()
def __init__(self, mannequin=MODEL):
self.mannequin, self.historical past = mannequin, []
def _load(self, type, title):
if not title: return ""
p = ASSETS[kind].get(title.decrease())
return p.read_text(encoding="utf-8", errors="ignore") if p else
f"# {type}:{title} (not discovered — utilizing inline defaults)"
def _system(self, command=None, agent=None, modes=None, additional=None):
elements = [self.BASE_SYSTEM, "<framework>"]
if command: elements += [f"## Command /sc:{command}", self._load("commands", command)]
if agent: elements += [f"## Agent {agent}", self._load("agents", agent)]
for m in (modes or []):
elements += [f"## Mode {m}", self._load("modes", m)]
if additional: elements += ["## Extra directives", extra]
elements.append("</framework>")
return "nn".be part of(elements)
def run(self, immediate, *, command=None, agent=None, modes=None, additional=None,
max_tokens=1800, stream=True, keep in mind=True):
sys_prompt = self._system(command, agent, modes, additional)
msgs = self.historical past + [{"role": "user", "content": prompt}]
console.rule(
f"[bold cyan]► /sc:{command or '—'} agent={agent or '—'} modes={modes or []}"
)
console.print(Panel(immediate, title="USER", border_style="blue"))
console.print("[bold green]ASSISTANT ↓[/bold green]")
textual content = ""
strive:
if stream:
with consumer.messages.stream(
mannequin=self.mannequin, max_tokens=max_tokens,
system=sys_prompt, messages=msgs,
) as s:
for chunk in s.text_stream:
sys.stdout.write(chunk); sys.stdout.flush()
textual content += chunk
print()
else:
r = consumer.messages.create(
mannequin=self.mannequin, max_tokens=max_tokens,
system=sys_prompt, messages=msgs,
)
textual content = "".be part of(b.textual content for b in r.content material if b.kind == "textual content")
console.print(textual content)
besides Exception as e:
console.print(f"[red]API error: {e}[/red]")
return ""
if keep in mind:
self.historical past += [{"role": "user", "content": prompt},
{"role": "assistant", "content": text}]
return textual content
def save(self, path="/content material/sc_session.json", be aware=""):
Path(path).write_text(json.dumps(
{"meta": {"be aware": be aware, "saved_at": time.time(), "mannequin": self.mannequin},
"historical past": self.historical past}, indent=2))
console.print(f"
Session → {path}", model="daring yellow")
def load(self, path="/content material/sc_session.json"):
d = json.masses(Path(path).read_text())
self.historical past = d["history"]
console.print(f"
Loaded {len(self.historical past)//2} prior turns", model="daring yellow")
sc = TremendousClaude()
We outline the TremendousClaude class that connects the framework belongings with the Anthropic API. We construct system prompts by combining the bottom instruction with chosen instructions, brokers, and modes. We additionally add run, save, and load strategies to execute guided workflows and protect session historical past.
sc.run(
"I need to construct an AI-assisted personal-finance app for faculty college students. "
"Drive a structured brainstorm: goal customers, must-have options, "
"differentiators, dangers, and an MVP reduce.",
command="brainstorm", modes=["brainstorming"], max_tokens=1200, keep in mind=False,
)
sc.run(
"Implement a React + TypeScript element `BudgetRing` that renders month-to-month "
"spend vs. finances as an animated SVG ring with a hover tooltip. Tailwind "
"for styling, no exterior chart libraries, full code + a utilization instance.",
command="implement", agent="frontend-architect", max_tokens=2000, keep in mind=False,
)
SNIPPET = """
@app.publish("/login")
def login(req):
consumer = db.question(f"SELECT * FROM customers WHERE title='{req.title}'")
if consumer and consumer.password == req.password:
token = jwt.encode({"u": consumer.id}, "secret123")
return {"token": token}
"""
sc.run(
"Security-review this Flask login handler. Rank points by severity "
"(Critical/High/Medium/Low), clarify the assault vector, and give a "
"concrete repair for every.nn```python" + SNIPPET + "```",
command="analyze", agent="security-engineer", max_tokens=1500, keep in mind=False,
)
sc.run(
"We are launching a B2B SaaS for compliance automation in healthcare. "
"Convene a enterprise panel: positioning, ICP, GTM plan, top-3 dangers, "
"6-month milestones, and a 'kill standards' checklist.",
command="business-panel", max_tokens=1800, keep in mind=False,
)
sc.run(
"Topic: 'state of vector databases in 2026'. Produce: (a) a Deep-Research "
"plan — hops, sources to question, high quality thresholds; (b) a synthesis of "
"what's more than likely true primarily based in your information; (c) open questions.",
command="analysis", modes=["deep-research"], max_tokens=2000, keep in mind=False,
)
sc.run(
"Compare OAuth 2.0, OIDC, and SAML throughout: objective, tokens, major "
"use-case, and one frequent pitfall every.",
modes=["token-efficiency"], max_tokens=600, keep in mind=False,
)
We take a look at the bridge by means of a number of sensible TremendousClaude workflows, together with brainstorming and implementation. We use completely different instructions, brokers, and modes to information Claude for frontend coding, safety evaluation, and enterprise evaluation. We additionally discover deep analysis planning and token-efficient comparability to indicate how modes change the response model.
console.rule("[bold magenta]
MULTI-STEP WORKFLOW")
sc.historical past = []
sc.run("Project: a CLI device that summarizes any GitHub repo from its URL. "
"Brainstorm scope and constraints.",
command="brainstorm", max_tokens=900)
sc.run("Design the structure: modules, knowledge circulation, key exterior dependencies, "
"and a small ASCII element diagram.",
command="design", max_tokens=1100)
sc.run("Implement the core `summarize_repo(url: str) -> dict` in Python. "
"Use solely the usual library + `requests`. Return a structured dict.",
command="implement", max_tokens=1500)
sc.run("Generate pytest checks for `summarize_repo`. Mock all community calls.",
command="take a look at", max_tokens=900)
sc.run("Write a concise README.md (set up, utilization, instance, limitations).",
command="doc", max_tokens=900)
sc.save(be aware="repo-summarizer-cli end-to-end construct")
console.rule("[bold green]
Tutorial full")
console.print(Panel.match(
"[bold]Try subsequent:[/bold]n"
f"• Inspect a command file: open {REPO_DIR}/<...>/Commands/<title>.mdn"
"• Add your personal command: drop a new .md into a Commands/ folder, thenn"
" rerun discover_assets() and ASSETS = …n"
"• Swap fashions: sc = TremendousClaude(mannequin='claude-opus-4-5')n"
"• Stack brokers + modes: sc.run(p, command='implement',n"
" agent='backend-architect',n"
" modes=['token-efficiency'])n"
"• Resume a saved session: sc.load(); sc.run('proceed from right here …')",
border_style="inexperienced",
))
We run a complete multi-step workflow to construct a CLI device for summarizing GitHub repositories. We transfer by means of brainstorming, structure design, implementation, testing, and documentation in a single shared session. We save the session on the finish and print extension concepts for customizing instructions, switching fashions, and resuming work later.
In conclusion, we had a working TremendousClaude-style execution surroundings that helps us apply instructions, brokers, and modes in a repeatable means. We noticed how structured prompts can information Claude towards extra specialised habits for coding, evaluation, analysis, planning, and documentation duties. This workflow provides us a versatile basis for experimenting with customized instructions, combining brokers with modes, switching fashions, and constructing longer AI-assisted improvement classes that protect context throughout a number of steps. We additionally understood how this setup may be prolonged into private improvement copilots, analysis assistants, safety reviewers, and end-to-end undertaking builders.
Check out the Full Codes with Notebook. Also, be at liberty to observe us on Twitter and don’t overlook to hitch our 150k+ ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to companion with us for selling your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar and so forth.? Connect with us
The publish Build a SuperClaude Framework Workflow with Commands, Agents, Modes, and Session Memory appeared first on MarkTechPost.
