appydave-tools 0.81.0 → 0.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09f48a7490c924291dff958e3df8ba53c28c2dae599cae0ab8581ac3e4ad3ee2'
4
- data.tar.gz: f1e55198dd31bb3b2b61b61d4f929fc3bda799ecd4cedb96e5f810c994edae4a
3
+ metadata.gz: 419c5fa10d36a3e37b4a1f56cfbb62b539ff233426cb0d0a6ab2d4b1b725f34b
4
+ data.tar.gz: 40217e9bfa092ace0d3c08371c1a6b76d96cbc7463c06b7cf6ce37d8c83500e8
5
5
  SHA512:
6
- metadata.gz: 9d4f2bc474af95d2ff538d5360d9ec659b559f155b611c9b7c13f9c475118311a1fc99a40b1f3fc6655b20bee568a3c5fcb4466f709eef948cd400d4efee6709
7
- data.tar.gz: 84af7abbcc284e85742f1db64737622e8c929b57815988908a2aba716d970adcfd0f52e29f7a432fb2d544fd8be950fd27254d7ec61fdf705802c126b34e6d84
6
+ metadata.gz: ab4fdec93c279ec51b4603e5afb160f11da6b2c85ef0ce9758db9ae52509374b086015da0eaba427d919533b3b2896995aec2865bba3c37f7435b8d89f5118ed
7
+ data.tar.gz: 6988c04590bc5937327b1ca6f55db35b52fd37840ca78e82275af2b36fa7b35b5af921841cd20599fda262380c595836b250266b509ca9bff9fb82f41f294476
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [0.81.0](https://github.com/appydave/appydave-tools/compare/v0.80.0...v0.81.0) (2026-04-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 'cops' ([7378a1e](https://github.com/appydave/appydave-tools/commit/7378a1e86e7658eb31924254390abfd967f915ae))
7
+
8
+
9
+ ### Features
10
+
11
+ * add --meta flag to query_brain and query_omi returning rich JSON metadata instead of file paths ([3320c5d](https://github.com/appydave/appydave-tools/commit/3320c5dac93ad60591a82e255b5d45ff53396d1d))
12
+ * simplify query_brain and query_omi APIs with unified --find, --active, --days, --limit flags ([12c80e6](https://github.com/appydave/appydave-tools/commit/12c80e6dcee4bb6bbe801985bf75aaeb897f57b9))
13
+
1
14
  # [0.80.0](https://github.com/appydave/appydave-tools/compare/v0.79.0...v0.80.0) (2026-04-03)
2
15
 
3
16
 
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+ require 'appydave/tools'
6
+ require 'optparse'
7
+
8
+ options = { meta: false, config: nil }
9
+
10
+ OptionParser.new do |opts|
11
+ opts.banner = 'Usage: random_context [options]'
12
+
13
+ opts.on('--meta', 'Return metadata as JSON instead of file paths') do
14
+ options[:meta] = true
15
+ end
16
+
17
+ opts.on('--config PATH', 'Path to custom random-queries.yml config') do |path|
18
+ options[:config] = path
19
+ end
20
+
21
+ opts.on('-v', '--version', 'Show version') do
22
+ puts "random_context v#{Appydave::Tools::VERSION}"
23
+ exit 0
24
+ end
25
+
26
+ opts.on('-h', '--help', 'Show this message') do
27
+ puts opts
28
+ exit 0
29
+ end
30
+ end.parse!
31
+
32
+ randomizer_opts = { meta: options[:meta] }
33
+ randomizer_opts[:config_path] = options[:config] if options[:config]
34
+
35
+ Appydave::Tools::RandomContext::Randomizer.new(**randomizer_opts).run
36
+
37
+ exit 0
@@ -0,0 +1,104 @@
1
+ # Random context discovery queries
2
+ # Each entry runs a query tool command and checks result count.
3
+ # Entries with result counts in [min_results, max_results] are eligible for random selection.
4
+ #
5
+ # Format:
6
+ # label: Natural language question shown to the user
7
+ # command: Shell command to run (query_brain or query_omi)
8
+ # min_results: Minimum results to be considered a "good" match (default: 1)
9
+ # max_results: Maximum results to be considered a "good" match (default: 15)
10
+ #
11
+ # The OMI skill can extend this file by appending new entries under queries:.
12
+
13
+ queries:
14
+ # --- Brain queries ---
15
+ - label: "What do I know about paperclip?"
16
+ command: "query_brain --find paperclip"
17
+ min_results: 1
18
+ max_results: 20
19
+
20
+ - label: "What do I know about OMI?"
21
+ command: "query_brain --find omi"
22
+ min_results: 1
23
+ max_results: 20
24
+
25
+ - label: "What do I know about BMAD method?"
26
+ command: "query_brain --find bmad"
27
+ min_results: 1
28
+ max_results: 20
29
+
30
+ - label: "What do I know about agentic engineering?"
31
+ command: "query_brain --find agentic-engineering"
32
+ min_results: 1
33
+ max_results: 30
34
+
35
+ - label: "What are my active high-priority brains?"
36
+ command: "query_brain --active"
37
+ min_results: 5
38
+ max_results: 50
39
+
40
+ - label: "What do I know about Claude / Anthropic?"
41
+ command: "query_brain --find anthropic"
42
+ min_results: 1
43
+ max_results: 20
44
+
45
+ - label: "Browse my agent systems knowledge"
46
+ command: "query_brain --category agent-systems"
47
+ min_results: 1
48
+ max_results: 30
49
+
50
+ - label: "Browse my agent frameworks knowledge"
51
+ command: "query_brain --category agent-frameworks"
52
+ min_results: 1
53
+ max_results: 30
54
+
55
+ - label: "What do I know about context engineering?"
56
+ command: "query_brain --find context-engineering"
57
+ min_results: 1
58
+ max_results: 20
59
+
60
+ - label: "What do I know about FliVideo?"
61
+ command: "query_brain --find flivideo"
62
+ min_results: 1
63
+ max_results: 20
64
+
65
+ # --- OMI queries ---
66
+ - label: "Recent things I learned (TIL)"
67
+ command: "query_omi --routing til --limit 5"
68
+ min_results: 1
69
+ max_results: 5
70
+
71
+ - label: "One brain-update session to process"
72
+ command: "query_omi --routing brain-update --limit 1"
73
+ min_results: 1
74
+ max_results: 1
75
+
76
+ - label: "Recent brain-update sessions"
77
+ command: "query_omi --routing brain-update --limit 5"
78
+ min_results: 1
79
+ max_results: 5
80
+
81
+ - label: "What todo items came up recently?"
82
+ command: "query_omi --routing todo-item --days 14"
83
+ min_results: 1
84
+ max_results: 10
85
+
86
+ - label: "Recent OMI conversations about paperclip"
87
+ command: "query_omi --brain paperclip --limit 3"
88
+ min_results: 1
89
+ max_results: 3
90
+
91
+ - label: "Recent OMI conversations about BMAD"
92
+ command: "query_omi --brain bmad --limit 3"
93
+ min_results: 1
94
+ max_results: 3
95
+
96
+ - label: "What was I planning recently?"
97
+ command: "query_omi --activity planning --days 14 --limit 5"
98
+ min_results: 1
99
+ max_results: 5
100
+
101
+ - label: "What was I learning recently?"
102
+ command: "query_omi --activity learning --days 14 --limit 5"
103
+ min_results: 1
104
+ max_results: 5
@@ -25,12 +25,12 @@ The tools are **composable**: query tools select files, `llm_context` loads them
25
25
  ## What Is Being Queried
26
26
 
27
27
  ### query_brain
28
- Reads `~/dev/ad/brains/audit/brains-index.json` — a pre-built index of all brain folders. Does **not** scan brain files at query time. The index contains per-brain metadata: name, category, activity_level, tags, status, file_count.
28
+ Reads `/Users/davidcruwys/dev/ad/brains/audit/brains-index.json` — a pre-built index of all brain folders. Does **not** scan brain files at query time. The index contains per-brain metadata: name, category, activity_level, tags, status, file_count.
29
29
 
30
- Brain folders live at `~/dev/ad/brains/<brain-name>/`. Each has an `INDEX.md` and optional content files.
30
+ Brain folders live at `/Users/davidcruwys/dev/ad/brains/<brain-name>/`. Each has an `INDEX.md` and optional content files.
31
31
 
32
32
  ### query_omi
33
- Scans `~/dev/raw-intake/omi/*.md` and reads YAML frontmatter from each file. Enriched files (processed by Gemini extraction) have rich frontmatter. Raw files (unprocessed transcripts) have minimal frontmatter. Default behaviour: **enriched files only**.
33
+ Scans `/Users/davidcruwys/dev/raw-intake/omi/*.md` and reads YAML frontmatter from each file. Enriched files (processed by Gemini extraction) have rich frontmatter. Raw files (unprocessed transcripts) have minimal frontmatter. Default behaviour: **enriched files only**.
34
34
 
35
35
  ### llm_context
36
36
  Takes file paths (from stdin or arguments) and assembles content for LLM consumption. Two formats: `tree` (file listing) and `content` (file listing + full file content).
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appydave
4
+ module Tools
5
+ module RandomContext
6
+ # Represents one entry in the random-queries.yml config file
7
+ class QueryEntry
8
+ attr_reader :label, :command, :min_results, :max_results
9
+
10
+ def initialize(data)
11
+ @label = data['label']
12
+ @command = data['command']
13
+ @min_results = data.fetch('min_results', 1)
14
+ @max_results = data.fetch('max_results', 15)
15
+ end
16
+
17
+ def good_count?(count)
18
+ count.between?(min_results, max_results)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'open3'
5
+ require 'fileutils'
6
+
7
+ module Appydave
8
+ module Tools
9
+ module RandomContext
10
+ # Loads query library, runs each query to check result count,
11
+ # filters to entries with "good" result counts, and picks one randomly.
12
+ class Randomizer
13
+ BUNDLED_CONFIG_PATH = File.expand_path('../../../../config/random-queries.yml', __dir__)
14
+ USER_CONFIG_PATH = File.expand_path('~/.config/appydave/random-queries.yml')
15
+
16
+ def initialize(config_path: USER_CONFIG_PATH, meta: false, executor: nil,
17
+ bundled_config_path: BUNDLED_CONFIG_PATH,
18
+ bootstrap: config_path == USER_CONFIG_PATH)
19
+ @config_path = config_path
20
+ @meta = meta
21
+ @executor = executor || method(:shell_execute)
22
+ @bundled_config_path = bundled_config_path
23
+ @bootstrap = bootstrap
24
+ end
25
+
26
+ # Returns [QueryEntry, results_array] for the picked entry, or nil if no candidates.
27
+ def pick
28
+ candidates = []
29
+
30
+ load_entries.each do |entry|
31
+ results = @executor.call(entry.command)
32
+ candidates << [entry, results] if entry.good_count?(results.size)
33
+ end
34
+
35
+ candidates.sample
36
+ end
37
+
38
+ # Picks a random candidate and prints label + results to stdout.
39
+ def run
40
+ picked = pick
41
+ unless picked
42
+ puts 'No matching queries found'
43
+ return
44
+ end
45
+
46
+ entry, results = picked
47
+ puts "Question: \"#{entry.label}\""
48
+
49
+ if @meta
50
+ meta_results = @executor.call("#{entry.command} --meta")
51
+ meta_results.each { |line| puts line }
52
+ else
53
+ results.each { |line| puts line }
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def load_entries
60
+ resolved = resolve_config!
61
+ data = YAML.safe_load(File.read(resolved))
62
+ (data['queries'] || []).map { |q| QueryEntry.new(q) }
63
+ end
64
+
65
+ def resolve_config!
66
+ return @config_path if File.exist?(@config_path)
67
+ raise "Config not found: #{@config_path}" unless @bootstrap
68
+
69
+ FileUtils.mkdir_p(File.dirname(@config_path))
70
+ FileUtils.cp(@bundled_config_path, @config_path)
71
+ @config_path
72
+ end
73
+
74
+ def shell_execute(command)
75
+ stdout, _stderr, _status = Open3.capture2(command)
76
+ stdout.strip.split("\n").reject(&:empty?)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.81.0'
5
+ VERSION = '0.82.0'
6
6
  end
7
7
  end
@@ -41,6 +41,9 @@ require 'appydave/tools/brain_context/options'
41
41
  require 'appydave/tools/brain_context/brain_finder'
42
42
  require 'appydave/tools/brain_context/omi_finder'
43
43
 
44
+ require 'appydave/tools/random_context/query_entry'
45
+ require 'appydave/tools/random_context/randomizer'
46
+
44
47
  require 'appydave/tools/configuration/openai'
45
48
  require 'appydave/tools/configuration/configurable'
46
49
  require 'appydave/tools/configuration/config'
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.81.0",
3
+ "version": "0.82.0",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appydave-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.81.0
4
+ version: 0.82.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -233,6 +233,7 @@ files:
233
233
  - bin/prompt_tools.rb
234
234
  - bin/query_brain.rb
235
235
  - bin/query_omi.rb
236
+ - bin/random_context.rb
236
237
  - bin/setup
237
238
  - bin/subtitle_manager-old.rb
238
239
  - bin/subtitle_manager.rb
@@ -241,6 +242,7 @@ files:
241
242
  - bin/youtube_automation.rb
242
243
  - bin/youtube_manager.rb
243
244
  - bin/zsh_history.rb
245
+ - config/random-queries.yml
244
246
  - docs/README.md
245
247
  - docs/ai-instructions/behavioral-regression-audit.md
246
248
  - docs/ai-instructions/code-quality-retrospective.md
@@ -424,6 +426,8 @@ files:
424
426
  - lib/appydave/tools/name_manager/project_name.rb
425
427
  - lib/appydave/tools/prompt_tools/_doc.md
426
428
  - lib/appydave/tools/prompt_tools/prompt_completion.rb
429
+ - lib/appydave/tools/random_context/query_entry.rb
430
+ - lib/appydave/tools/random_context/randomizer.rb
427
431
  - lib/appydave/tools/subtitle_processor/_doc-clean.md
428
432
  - lib/appydave/tools/subtitle_processor/_doc-join.md
429
433
  - lib/appydave/tools/subtitle_processor/_doc-todo.md