Repository Home

Bear-Sword Maze Problem Revisited (with MemoryBanditWorkflow)

熊剣迷路問題 revisited

Note to English speakers: This repository now includes English documentation and notebook versions. Please see the English Section at the bottom of this page for details.

まず Gist で公開したものですが、AI が読みやすいよう HTML 化するため、このレポジトリを作りました。自動 HTML 化のワークフローは Gemini 2.5 Flash さん製です。

レポジトリは↓
https://github.com/JRF-2018/langchain_maze

HTML化したものは↓
https://jrf-2018.github.io/langchain_maze/

説明

それぞれの IPYNB に説明がありますが、基本的には↓をお読みください。

《熊剣迷路問題 revisited。2023年6月から7月に行った LLMにごく簡単な迷路ゲームを解かせる実験。2025年の今、進化したツール類を使って再挑戦。 - JRF のひとこと》
http://jrf.cocolog-nifty.com/statuses/2025/07/post-36be53.html

《LLM のメモリ機能の試験実装を行った。かなり本格的な実装(のモックアップ)になるようこころがけた。実装できたことはできたのだが、いまいち Gemini さんは積極的に使ってくれなかった。そこはアテが外れた。 - JRF のひとこと》
http://jrf.cocolog-nifty.com/statuses/2025/08/post-881b46.html

《「LLM のメモリ機能を強制的に使うバンディットマシンの試験実装」と「LLM のメモリ機能とバンディット機能の試験実装」を行った。後者がメインの成果物で、メモリ機能の使用増加をどう強制するかから拡張したフレームワーク。 - JRF のひとこと》
http://jrf.cocolog-nifty.com/statuses/2025/09/post-8225e2.html

《MemoryBanditWorkflow (参: [cocolog:95619779](2025年9月)) を Claude Code などの SKILL.md などを利用して実現するにはどうすればいいか。試みに Claude さん自身に聞いてみた。 - JRF のひとこと》
http://jrf.cocolog-nifty.com/statuses/2026/01/post-b86e58.html

ファイル集

熊剣迷路問題 revisited

0.0.3 から 0.0.6 までは、どれも「間違った方法」ではないというのが私の認識。それぞれに良さがあり、バージョンナンバーが上だからといって、発展形ではない。

一つだけ選べと言われたら 0.0.5 が今なら素直であると思う。しかし、0.0.3 や 0.0.4 や 0.0.6 のような方法で実装するほうがメモリの扱いなどにおいて適切な場合はあると思われる。

あと、追加の実験として↓を行った。

メモリ機能の試験実装

バンディット機能の試験実装

MemoryBanditWorkflow を使った RAG エージェントの試験実装

LangChain 1.x 系への対応とサブツールの導入

langchain_maze と experimental_rag を LangChain 1.x 系に対応させ、さらにはやりの skills やツールボックスなどの導入に相当する subtool_do の導入も行った。

英語への翻訳

英語版もいちおう作ってみた。

English Version Overview

This section provides an overview of the English-language assets added in the latest versions (v0.0.15.x - v0.0.16.x).

Core Concept: MemoryBanditWorkflow

MemoryBanditWorkflow is an agent framework designed to tackle the limitations of "stateless" LLM APIs. It incorporates:

RagAgent: Autonomous Thesis Writing

In the latest update, we demonstrate the versatility of the framework by implementing RagAgent. This agent performs autonomous RAG (Retrieval-Augmented Generation) to:

  1. Research a complex topic (e.g., "Japan's Lost Decades") via web search.

  2. Store findings in a simulated database (spoofed by the LLM).

  3. Write a structured, multi-chapter thesis in Markdown.

English Files

Author

JRF ( http://jrf.cocolog-nifty.com/statuses , Twitter (X): @jion_rockford )

License (in Japanese)

基本短いコードなので(私が作った部分は)パブリックドメインのつもりです。気になる方は MIT License として扱ってください。

かなり AI さん達(Gemini さんや Claude さんや ChatGPT さんや Grok さん)に教わって作っています。

License (in English)

Since the code is relatively short, I intended for my parts to be in the Public Domain. If you have concerns, please treat it under the MIT License.

This was developed with significant guidance from various AIs (Gemini, ChatGPT, Claude, and Grok).


(This document is mainly written in Japanese/UTF8.)