Project K began as a small Forth kernel implemented in JavaScript and Python. The original project is preserved as V1. It is frozen: its code remains available as a record of the original work, while development moves forward in a new V2 history.
I had long wanted to improve my Python implementation. With today’s AI tools—and especially the arrival of GPT-6.1—OpenAI encouraged me to experiment, so I asked AI to help reconstruct a specification from the existing work, then build a new implementation from that specification.
The result surprised me. The new implementation follows the same project purpose, yet the ideas, techniques, and realization produced from the specification are far beyond what I had achieved before. This repository is where I am exploring that result: first in Python, and now also in JavaScript.
V2 begins from a clean, orphaned Git history. It does not carry the V1 source into its working tree; V1 remains preserved separately.
docs/project-k-conceptual-spec.md — the language-independent conceptual specification.py/ — the Python V2 implementation and its guide. See the Python README.js/ — the JavaScript V2 implementation and its guide. See the JavaScript README.The conceptual specification describes Project K independently of its implementation language. Each language directory has its own implementation guide.
Project K adheres to the “AI Outside the Kernel” principle: the kernel (projectk.py) remains 100% pure and self-contained with zero AI dependencies.
In Project K 2.1.0, AI integration is officially provided as a minimal host extension:
docs/project-k-ai-conceptual-spec.md and py/docs/task-security-spec.md.python main.py in the py/ directory to enter the Forth REPL with ai: and (ai) support.trust-task resume).For a broader, application-rich environment built on Project K, see also peforth v2.
Project K 原本是一個以 JavaScript 和 Python 實作的 Forth kernel。原有成果保留為 V1,並凍結在原來的歷史中;後續開發從新的 V2 開始。
我一直對自己以前的 Python 功力不太滿意。現在有了強大的 AI,尤其 GPT-6.1 出現後,OpenAI 鼓勵我試著用 AI 做點不一樣的事。我請 AI 從既有成果倒推出一份 SPEC,再依照 SPEC 打造新的實作。
結果讓我非常驚喜:前後做的是同一個 Project K,但 AI 按照 SPEC 寫出的成果,在觀念、技巧和理想的實現上,都遠遠超過我以前的作品。V2 就是我探索這份新成果的地方:先完成了 Python,現在也加入了 JavaScript 的實作。
V2 從全新的 orphan branch 歷史開始,工作樹不帶入 V1 的原始程式;V1 則獨立保留。
docs/project-k-conceptual-spec.md:不限定實作語言的 conceptual SPEC。py/:Python V2 實作與使用說明,請見 Python README。js/:JavaScript V2 實作與使用說明,請見 JavaScript README。Conceptual SPEC 描述的是 Project K 本身,不綁定 Python 或 JavaScript;各語言目錄則各自說明該語言的實作。
Project K 堅守 「核心純粹 (AI Outside the Kernel)」 原則:核心(projectk.py)本身維持極簡、零 AI 依賴。
自 Project K 2.1.0 起,系統正式提供標準的宿主 AI 擴充層:
docs/project-k-ai-conceptual-spec.md 與 py/docs/task-security-spec.md。py/ 目錄下執行 python main.py,即可進入具備 ai: 與 (ai) 支援的 Forth REPL。trust-task resume)的安全防護。如需更全面、具備豐富應用工具的 AI Forth 系統,亦可參考 peforth v2。