Skip to content

Add StreamData usage rules - #230

Closed
icostan wants to merge 2 commits into
whatyouhide:mainfrom
icostan:docs/add-usage-rules
Closed

icostan wants to merge 2 commits into
whatyouhide:mainfrom
icostan:docs/add-usage-rules

Conversation

@icostan

@icostan icostan commented Sep 7, 2026 •

Copy link
Copy Markdown

Adds StreamData-specific usage rules covering setup, generator composition, shrinking behavior, common
pitfalls, configuration, and property-testing patterns. These rules help AI coding agents use and test
StreamData correctly.

@whatyouhide

Copy link
Copy Markdown
Owner

@icostan I’m sorry—I have zero context on this. Help please? 🙃

@icostan
icostan force-pushed the docs/add-usage-rules branch from 9fc619b to a35a667 Compare October 3, 2026 06:11
@icostan

icostan commented Oct 3, 2026 •

Copy link
Copy Markdown
Author

@whatyouhide This PR adds agent-focused guidance for using StreamData. The usage_rules library discovers these files
in project dependencies and syncs them into AGENTS.md or agent skills, giving AI agents fast, version-
local guidance on the correct APIs, testing patterns, and common mistakes—without making them search
broadly or guess.

Include usage-rules.md in the Hex package files so usage_rules can
discover it. Remove content duplicated from the README and moduledocs,
and point agents to `mix usage_rules.search_docs -p stream_data`
instead, since `usage_rules.docs` can't load a test-only dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@icostan

icostan commented Oct 6, 2026

Copy link
Copy Markdown
Author

Pushed an update (f42d683):

  • Packaged: usage-rules.md is now in the Hex package via package[:files]. Before this it wasn't shipped, so usage_rules had nothing to find. I compared mix hex.build --unpack before and after: this file is the only addition.
  • Trimmed: the file went from 89 lines to about 40. I removed everything that repeated the README or the moduledocs (setup, config, the list of options for each generator). What's left are the pitfalls agents tend to hit, like losing shrinking via Stream/Enum, filter vs map, and putting simpler choices first in one_of.
  • Docs lookup: for everything else, it points agents to mix usage_rules.search_docs "…" -p stream_data. mix usage_rules.docs doesn't work here: StreamData is usually a test-only dependency, so it can't be loaded in the dev env, and MIX_ENV=test doesn't help either. I ran every command in the file before adding it.

@whatyouhide

Copy link
Copy Markdown
Owner

Right, but how do agents discover these? Isn't this covered decently by ex_doc generating llms.txt? Aren't today's agents smart enough to look at that first?

@icostan

icostan commented Oct 9, 2026

Copy link
Copy Markdown
Author

A few key differences:

  1. Pull: Agents rarely fetch remote docs proactively—they generate from training weights
    unless prompted. Running mix usage_rules.sync in a project pulls usage-rules.md from deps/ directly
    into AGENTS.md or local skills, so the rules are in context upfront.
  2. Local & version-locked: llms.txt lives on HexDocs and requires network access. usage-rules.md is
    local and locked to the exact version in mix.lock.
  3. Pitfalls vs. full API: llms.txt indexes entire reference docs. usage-rules.md is just ~35 lines
    of StreamData-specific pitfalls models repeatedly hit (losing shrinking via Stream/Enum, narrow
    filters, etc.) that fit permanently in context.

@whatyouhide

Copy link
Copy Markdown
Owner

With today's models this feels heavy handed and I don't necessarily want to keep this in sync, so I'll skip this for now. I’m sure the usage_rules package has a way to generate these for deps without having to commit them upstream. Thanks!

@whatyouhide whatyouhide closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants