MonkeysPaw——一个由提示驱动的Ruby网络框架
MonkeysPaw – A prompt-driven web framework in Ruby

原始链接: https://worksonmymachine.substack.com/p/introducing-monkeyspaw-a-prompt-driven

MonkeysPaw是一个全新的Ruby Web框架,它颠覆了传统的开发模式。你无需编写代码,只需用自然语言编写描述目标网页的提示。框架随后会利用大型语言模型 (LLM) 生成HTML、CSS和JavaScript。 受Postel定律启发,MonkeysPaw欣然接受LLM的输出,甚至包括其“幻觉”,将其视为特性。它优先考虑内容优先的开发,允许用户直接表达他们的意图,降低了思想与实现之间的障碍。 虽然它并非针对性能或控制进行了优化,但MonkeysPaw的设计目标是表达,它就像一个“yes, and…”即兴表演搭档。该框架缓存生成的页面,从而减轻性能方面的顾虑。 MonkeysPaw作为Ruby gem提供,鼓励实验和贡献。需要注意的是:就像猴子爪一样,愿望可能会以意想不到的后果实现,功能也可能难以预测。未来的开发计划包括缓存单个组件、图像生成和动态ERB局部生成。

Hacker News 正在讨论 MonkeysPaw,一个由提示驱动的 Ruby 网络框架。用户推测其作为未来基于意图的网页范式的潜力,认为 A/B 测试可能会演变成“适者生存”的方式。评论者们一致认为,虽然很有前景,但一个关键要素的缺失阻碍了更广泛的采用。人们对该框架的名字表示担忧,因为它指的是不可靠的“猴子爪”愿望。作者正在积极参与讨论,回答问题并详细阐述其背后的思想。整体情绪对提示驱动开发的潜力持谨慎乐观的态度,承认其仍处于早期阶段,需要进一步完善。
相关文章

原文

Meet MonkeysPaw: a web framework where all the pages are prompts and what you see is whatever the LLM thinks you meant. Welcome to the first installment of “Works on Your Machine” where I’m sharing things that have graduated beyond just working on my machine.

The idea for Monkeys Paw grew out of some conversations I had after my RubyConf 2024 talk, Going Postel, where I explored an idea inspired by Postel’s law - building systems that accept whatever an LLM gives you, rather than focusing on trying to get an LLM to give you exactly the right code. The talk was a direct extension of an opinion I’ve held for a while now: Hallucinations are a Feature not a Bug.

MonkeysPaw is a web framework that generates entire pages from prompt files. Instead of writing HTML, CSS, and Javascript, you write down descriptions (wishes) of what you want, and the framework:

  • Conjures full web pages based on your wishes

  • Handles routing based on file structure

  • Manages layouts and styling through natural language descriptions

  • Turns vague gestures at functionality into working Javascript

You structure your wishes in markdown docs however you like. For example, here’s an excerpt from the sample app’s index.md page on Github that has things broken down into Title, Page Content, Hero Section, Key Features, How it Works, etc like so:

...

### Hero Section
- Large, dramatic headline: "MonkeysPaw 🐒✋"
- Tagline: "Wish-Driven Development for Ruby"
- Dramatic subtitle: "Be careful what you wish for..."
- Brief 2-3 sentence explanation: "A prompt-driven web framework that grants your web development wishes through AI. Like the legendary monkey's paw, it will fulfill your requests exactly as stated—for better or worse."
- Call-to-action button: "Make Your First Wish" (links to Getting Started)

...

and an example of the page that’s generated:

MonkeysPaw isn’t just a silly experiment (though is absolutely is that). It represents a fundamental shift in how we can think about building things in an AI-first world and what we should think about building:

  1. Content-first development: Start with what you want to express, not how to structure it

  2. Natural language as source code: Your intention becomes the program

  3. Lower barriers between thought and implementation: Sketch ideas in language, not syntax

While most web frameworks are either optimized for developer speed or control, MonkeysPaw is optimized for expression. It’s the web framework equivalent of “yes, and…” improv — whatever you suggest, it tries to make work.

MonkeysPaw is now available as a Ruby gem, and the installation and usage instructions are available on Github at sublayerapp/monkeyspaw. PRs welcome!

Like the classic horror story (and Simpson’s episode) teaches us, wishes do often come with unexpected consequences:

  • Pages may be eerily close to what you wanted but slightly… off

  • Performance is sacrificed at the altar of creativity, but the output is cached, so you wont regenerate pages unless you mean to

  • Complex interactions might require specific wording and take a few tries to get right, and may not even work every time even after you get it right once.

MonkeysPaw is the first in what I expect will be may more “Works on Your Machine” posts, where I’m releasing a things that are a bit more put together, whether it’s open source frameworks like this or actually launching AI products here. We’ll see.

As far as what’s next for MonkeysPaw, I’m going to start sharing it more publicly and have some fun ideas for places to go with it like caching individual components, image generation, preloading of pages, and getting it to dynamically generate erb partials by relying on rescuing from NameError.

If you get a chance to play with it, please share! I’d love to see what it comes up with.

联系我们 contact @ memedata.com