fungus

Fungus is an AI agent that evolves through experience, mimicking the growth of real fungi.

<div align="center"> <img src="assets/banner.png" alt="Fungus" width="800">

๐Ÿ„ Fungus

An AI agent that grows from experience โ€” like fungi.

License: MIT Python 3.12 GitHub stars Last commit

Hyphae sense the soil. Mycelium digests the nutrients. Fruiting bodies emerge.

What is Fungus? ยท Quickstart ยท How It Works ยท Structure

</div>

๐ŸŒฑ What is Fungus?

Fungus is an AI agent built on Kiro CLI.

Like a real fungus, it starts invisible. Hyphae โ€” the finest tips of the network โ€” extend into every interaction, sensing corrections, failed commands, and patterns you might not notice yourself. These raw signals are spores, scattered and unprocessed.

Beneath the surface, the mycelial network quietly digests these spores into nutrients โ€” structured knowledge that strengthens the network with every session. The more it absorbs, the sharper its hyphae become.

When enough nutrients accumulate around a recurring pattern, a fruiting body emerges โ€” a new skill, ready to use. The mushroom you see above ground is just the visible tip; the real intelligence lives in the network below.

And like any fruiting body, it releases spores back into the soil โ€” every skill in use generates new interactions, new signals, new raw material for the hyphae to sense. The cycle continues.

     spores          nutrients        fruiting
Soil โ”€โ”€โ”€โ†’ Hypha โ”€โ”€โ”€โ†’ Mycelium โ”€โ”€โ”€โ†’ Fruit
  โ†‘                                   โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ spores โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Quickstart

git clone https://github.com/nsqk11/fungus.git
cd fungus
bash install.sh

Prerequisites: Kiro CLI ยท Python 3.12+ ยท Bash โ‰ฅ 4.0

๐Ÿ”ฌ How It Works

Fungus hooks into the Kiro CLI lifecycle. Each hook is a patch of soil โ€” hyphae extend into it, sense what's there, and feed the network.

ModuleRoleWhen
HyphaSense signals, filter noiseEvery interaction
MyceliumDigest spores into structured nutrientsSession start
FruitDetect mature patterns, produce new skillsSession start

Hyphae sense silently in the background. Mycelium and Fruit prompt the agent at session start โ€” the user decides when to digest or review.

Sensing and Filtering

Hyphae don't capture blindly โ€” structural filters discard noise at the source:

HookWhat PassesWhat Gets Dropped
userPromptSubmitPrompts > 5 charsTrivial acks ("ok", "ๅ—ฏ")
preToolUseNon-self-referential, non-read/write callsmemory.py calls; fs_read, fs_write, grep, glob, code, todo_list
postToolUseTool failures onlySuccessful tool results
stopAll assistant responsesNothing

At the end of each turn, Hypha aggregates the tool sequence into a single toolChain spore and removes the individual preToolUse spores. This gives Mycelium a clean signal: what the user asked, what tools were used, whether anything failed, and what the agent concluded.

Data Flow

Nutrients flow in one direction โ€” from raw spores to mature memory:

spore โ†’ nutrient โ†’ network    (permanent memory)
spore โ†’ nutrient โ†’ fruiting   (skill candidate)
spore โ†’ skipped               (no value)
  โ†‘        โ†‘          โ†‘           โ†‘
Hypha    Mycelium    Fruit     substrate
writes   writes      writes    cleans

Each module writes to its own partition in memory.db. Memory is shared โ€” a single data/memory.db serves all agents. Substrate runs clean on agentSpawn before any module โ€” removing skipped and consumed fruiting entries. Boundaries are declared in each script's annotations โ€” no central config:

# @hook postToolUse
# @priority 10
# @module hypha
# @reads spore
# @writes spore
# @description Sense tool errors from environment

The substrate scans these annotations at runtime to route hooks to the correct scripts.

๐Ÿ„ Grown Skills

Skills are the mushrooms โ€” visible outputs of the underground network.

SkillDescription
atlassian-apiUnified REST API client for Confluence and Jira
office-toolkitScrape and patch Office documents (docx, pptx, xlsx) via XML

๐Ÿ“ Structure

fungus/
โ”œโ”€โ”€ assets/                      Images
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ memory.db              Shared memory (gitignored)
โ”œโ”€โ”€ hooks/
โ”‚   โ”œโ”€โ”€ substrate.sh             Signal conductor โ€” reads hook from stdin, routes to modules
โ”‚   โ”œโ”€โ”€ substrate.py             Scan annotations, match hook, sort by priority
โ”‚   โ”œโ”€โ”€ memory.py                CRUD operations for memory.db
โ”‚   โ””โ”€โ”€ README.md                Hook payload reference
โ”œโ”€โ”€ modules/
โ”‚   โ”œโ”€โ”€ hypha/                   Sense โ€” explore and detect signals
โ”‚   โ”‚   โ”œโ”€โ”€ SKILL.md
โ”‚   โ”‚   โ””โ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ mycelium/                Digest โ€” break down and store knowledge
โ”‚   โ”‚   โ”œโ”€โ”€ SKILL.md
โ”‚   โ”‚   โ””โ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ fruit/                   Grow โ€” detect patterns, produce skills
โ”‚       โ”œโ”€โ”€ SKILL.md
โ”‚       โ””โ”€โ”€ scripts/
โ”œโ”€โ”€ skills/                      Mushrooms โ€” grown by the network
โ”‚   โ”œโ”€โ”€ atlassian-api/
โ”‚   โ””โ”€โ”€ office-toolkit/
โ”œโ”€โ”€ prompts/                     Shared prompt frameworks
โ”œโ”€โ”€ install.sh
โ””โ”€โ”€ LICENSE

๐Ÿ“„ License

MIT