# 21 — Prompt redesign **Status:** done Reconsider the prompt system. Some observations: ## Functional prompts via metatables Functional prompts can be achieved in pure Lua without special support: ```lua _PROMPT = setmetatable({}, { __tostring = function(self) local user = os.getenv("USER") or os.getenv("USERNAME") or "user" local cwd = os.getenv("PWD") or io.popen("pwd"):read("*l") or "?" return string.format("%s:%s$ ", user, cwd) end }) ``` This suggests our bespoke prompt implementation (issue #09) may be overengineered. A template-based approach or just documenting the metatable trick might suffice. ## Prompt2 depth Prompt2 is rigid — opening deeper and deeper blocks results in a prompt at the same level. Bash doesn't do depth indication either, so maybe this is fine. Options: - Pass depth into `_PROMPT2` somehow - Add indentation (spaces/tabs) after prompt2 on the C side - Accept it as-is (bash doesn't do this either)