agent-context 0.0.1 → 0.0.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/agent/context.rb +1 -0
- data/context/{adding-context.mdc → adding-context.md} +22 -26
- data/context/{examples.mdc → examples.md} +4 -9
- data/context/{getting-started.mdc → getting-started.md} +3 -8
- data/design.md +8 -8
- data/lib/agent/context/helper.rb +2 -1
- data/lib/agent/context/version.rb +2 -1
- data/license.md +1 -0
- data/readme.md +4 -4
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
- data/context/markdown-context.mdc +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c1839c403ab5a9b54f0ea7604d792fd284eb19c789a5f9d2afe356e6c7d992
|
4
|
+
data.tar.gz: 1f20c9f320200d4f2e70b838ba1a478ff69831924df81ce891115e3abfc6896f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d942db85db0f5a98a0feaf136cd43ca270f3ce29db40f1f63a4df899c9394194fba691b588caf6191d2b653b064cc16d18362abbf66786d9e6f3b42f6f30503f
|
7
|
+
data.tar.gz: feb0ba1a782cb034dcabfb8fe50767f4ff490b7ede56fada3b34a7124a659b8ce76aa6e14efca0a2ebf6ec456ebaa8fd2fb2b64ad2d73fe65b5c115a3c95507f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/agent/context.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
---
|
2
|
-
description: When creating or updating a gem's public interface.
|
3
|
-
alwaysApply: false
|
4
|
-
---
|
5
1
|
# Adding Context to Your Gem
|
6
2
|
|
7
3
|
## How to provide context in your gem
|
@@ -13,9 +9,9 @@ In your gem's root directory, create a `context/` folder:
|
|
13
9
|
```
|
14
10
|
your-gem/
|
15
11
|
├── context/
|
16
|
-
│ ├── getting-started.
|
17
|
-
│ ├── configuration.
|
18
|
-
│ └── troubleshooting.
|
12
|
+
│ ├── getting-started.md
|
13
|
+
│ ├── configuration.md
|
14
|
+
│ └── troubleshooting.md
|
19
15
|
├── lib/
|
20
16
|
└── your-gem.gemspec
|
21
17
|
```
|
@@ -24,12 +20,12 @@ your-gem/
|
|
24
20
|
|
25
21
|
Create files with helpful information. Common types include:
|
26
22
|
|
27
|
-
- **getting-started.
|
28
|
-
- **configuration.
|
29
|
-
- **troubleshooting.
|
30
|
-
- **migration.
|
31
|
-
- **performance.
|
32
|
-
- **security.
|
23
|
+
- **getting-started.md** - Quick start guide
|
24
|
+
- **configuration.md** - Configuration options and examples
|
25
|
+
- **troubleshooting.md** - Common issues and solutions
|
26
|
+
- **migration.md** - Migration guides between versions
|
27
|
+
- **performance.md** - Performance tips and best practices
|
28
|
+
- **security.md** - Security considerations
|
33
29
|
|
34
30
|
### 3. Document your context
|
35
31
|
|
@@ -45,13 +41,13 @@ bake agent:context:install --gem your-gem-name
|
|
45
41
|
```
|
46
42
|
|
47
43
|
Available context files:
|
48
|
-
- `getting-started.
|
49
|
-
- `configuration.
|
44
|
+
- `getting-started.md` - Quick start guide
|
45
|
+
- `configuration.md` - Configuration options
|
50
46
|
```
|
51
47
|
|
52
48
|
### 4. File format
|
53
49
|
|
54
|
-
Context files can be in any format, but `.
|
50
|
+
Context files can be in any format, but `.md` and `.md` are commonly used for documentation. The content should be:
|
55
51
|
|
56
52
|
- **Practical** - Include real examples
|
57
53
|
- **Focused** - One topic per file
|
@@ -98,9 +94,9 @@ In your gem's root directory, create a `context/` folder:
|
|
98
94
|
```
|
99
95
|
your-gem/
|
100
96
|
├── context/
|
101
|
-
│ ├── getting-started.
|
102
|
-
│ ├── configuration.
|
103
|
-
│ └── troubleshooting.
|
97
|
+
│ ├── getting-started.md
|
98
|
+
│ ├── configuration.md
|
99
|
+
│ └── troubleshooting.md
|
104
100
|
├── lib/
|
105
101
|
└── your-gem.gemspec
|
106
102
|
```
|
@@ -109,12 +105,12 @@ your-gem/
|
|
109
105
|
|
110
106
|
Create files with helpful information. Common types include:
|
111
107
|
|
112
|
-
- **getting-started.
|
113
|
-
- **configuration.
|
114
|
-
- **troubleshooting.
|
115
|
-
- **migration.
|
116
|
-
- **performance.
|
117
|
-
- **security.
|
108
|
+
- **getting-started.md** - Quick start guide
|
109
|
+
- **configuration.md** - Configuration options and examples
|
110
|
+
- **troubleshooting.md** - Common issues and solutions
|
111
|
+
- **migration.md** - Migration guides between versions
|
112
|
+
- **performance.md** - Performance tips and best practices
|
113
|
+
- **security.md** - Security considerations
|
118
114
|
|
119
115
|
### 3. Document your context
|
120
116
|
|
@@ -128,7 +124,7 @@ This gem provides additional context files that can be installed using `bake age
|
|
128
124
|
|
129
125
|
### 4. File format
|
130
126
|
|
131
|
-
Context files can be in any format, but `.
|
127
|
+
Context files can be in any format, but `.md` and `.md` are commonly used for documentation. The content should be:
|
132
128
|
|
133
129
|
- **Practical** - Include real examples
|
134
130
|
- **Focused** - One topic per file
|
@@ -1,8 +1,3 @@
|
|
1
|
-
---
|
2
|
-
description: Practical examples of using agent-context.
|
3
|
-
alwaysApply: false
|
4
|
-
---
|
5
|
-
|
6
1
|
# Practical Examples
|
7
2
|
|
8
3
|
## Example 1: Installing context from a web framework
|
@@ -64,10 +59,10 @@ ls .context/
|
|
64
59
|
bake agent:context:install --gem the-gem-you're-using
|
65
60
|
|
66
61
|
# Read the getting started guide
|
67
|
-
cat .context/the-gem-you're-using/getting-started.
|
62
|
+
cat .context/the-gem-you're-using/getting-started.md
|
68
63
|
|
69
64
|
# Check performance tips
|
70
|
-
cat .context/the-gem-you're-using/performance.
|
65
|
+
cat .context/the-gem-you're-using/performance.md
|
71
66
|
```
|
72
67
|
|
73
68
|
## Real-world scenario
|
@@ -79,10 +74,10 @@ You're building a Rails API and want to understand how to properly configure Pum
|
|
79
74
|
bake agent:context:install --gem puma
|
80
75
|
|
81
76
|
# Read the configuration guide
|
82
|
-
cat .context/puma/configuration.
|
77
|
+
cat .context/puma/configuration.md
|
83
78
|
|
84
79
|
# Check performance recommendations
|
85
|
-
cat .context/puma/performance.
|
80
|
+
cat .context/puma/performance.md
|
86
81
|
```
|
87
82
|
|
88
83
|
This gives you practical, gem-specific guidance that might not be in the main documentation.
|
@@ -1,8 +1,3 @@
|
|
1
|
-
---
|
2
|
-
description: Getting started with agent-context.
|
3
|
-
alwaysApply: false
|
4
|
-
---
|
5
|
-
|
6
1
|
# Getting Started
|
7
2
|
|
8
3
|
## What is this?
|
@@ -41,10 +36,10 @@ For example:
|
|
41
36
|
your-project/
|
42
37
|
├── .context/
|
43
38
|
│ ├── async/
|
44
|
-
│ │ ├── thread-safety.
|
45
|
-
│ │ └── performance.
|
39
|
+
│ │ ├── thread-safety.md
|
40
|
+
│ │ └── performance.md
|
46
41
|
│ └── rack/
|
47
|
-
│ └── middleware.
|
42
|
+
│ └── middleware.md
|
48
43
|
```
|
49
44
|
|
50
45
|
## Why use this?
|
data/design.md
CHANGED
@@ -16,7 +16,7 @@ Context files are treated as a first-class part of a gem's public interface, alo
|
|
16
16
|
|
17
17
|
### 2. Machine-Readable, Human-Friendly
|
18
18
|
|
19
|
-
Context files use `.
|
19
|
+
Context files use `.md` (Markdown Context) format, which combines:
|
20
20
|
- **Human readability**: Standard Markdown for easy authoring and reading.
|
21
21
|
- **Machine structure**: YAML frontmatter for metadata and organization.
|
22
22
|
- **Extensibility**: Can include code examples, diagrams, and structured data.
|
@@ -80,8 +80,8 @@ alwaysApply: false # Whether to always apply this context
|
|
80
80
|
|
81
81
|
### File Naming Conventions
|
82
82
|
|
83
|
-
- **`.
|
84
|
-
- **Descriptive names**: `thread-safety.
|
83
|
+
- **`.md` extension**: Indicates Markdown Context files.
|
84
|
+
- **Descriptive names**: `thread-safety.md`, `performance.md`, `migration-guide.md`.
|
85
85
|
- **Fallback support**: Commands can find files with or without extensions.
|
86
86
|
|
87
87
|
## Installation Strategy
|
@@ -102,10 +102,10 @@ alwaysApply: false # Whether to always apply this context
|
|
102
102
|
project/
|
103
103
|
├── .context/ # Private working directory
|
104
104
|
│ ├── async/ # Context from async gem
|
105
|
-
│ │ ├── thread-safety.
|
106
|
-
│ │ └── performance.
|
105
|
+
│ │ ├── thread-safety.md
|
106
|
+
│ │ └── performance.md
|
107
107
|
│ └── rails/ # Context from rails gem
|
108
|
-
│ └── configuration.
|
108
|
+
│ └── configuration.md
|
109
109
|
```
|
110
110
|
|
111
111
|
## Use Cases and Workflows
|
@@ -113,7 +113,7 @@ project/
|
|
113
113
|
### For Gem Authors
|
114
114
|
|
115
115
|
1. **Create Context Directory**: Add `context/` to gem root.
|
116
|
-
2. **Write Context Files**: Create `.
|
116
|
+
2. **Write Context Files**: Create `.md` files with documentation, examples, guides.
|
117
117
|
3. **Version and Distribute**: Context files are included in gem releases.
|
118
118
|
|
119
119
|
### For Developers
|
@@ -132,7 +132,7 @@ project/
|
|
132
132
|
|
133
133
|
### Potential Enhancements
|
134
134
|
|
135
|
-
- **Context Validation**: Validate `.
|
135
|
+
- **Context Validation**: Validate `.md` file structure and content.
|
136
136
|
- **Context Indexing**: Create searchable index of installed context.
|
137
137
|
- **Context Updates**: Mechanism to update context when gems are updated.
|
138
138
|
- **Context Dependencies**: Allow context files to reference other context files.
|
data/lib/agent/context/helper.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2025, by Shopify Inc.
|
5
|
+
# Copyright, 2025, by Samuel Williams.
|
5
6
|
|
6
7
|
require "rubygems"
|
7
8
|
require "fileutils"
|
@@ -71,7 +72,7 @@ module Agent
|
|
71
72
|
# Try to find the file with or without extension
|
72
73
|
possible_paths = [
|
73
74
|
File.join(gem[:path], file_name),
|
74
|
-
File.join(gem[:path], "#{file_name}.
|
75
|
+
File.join(gem[:path], "#{file_name}.md"),
|
75
76
|
File.join(gem[:path], "#{file_name}.md")
|
76
77
|
]
|
77
78
|
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -68,13 +68,13 @@ To provide context files in your gem, create a `context/` directory in your gem'
|
|
68
68
|
|
69
69
|
your-gem/
|
70
70
|
├── context/
|
71
|
-
│ ├── thread-safety.
|
72
|
-
│ ├── performance.
|
73
|
-
│ └── migration-guide.
|
71
|
+
│ ├── thread-safety.md
|
72
|
+
│ ├── performance.md
|
73
|
+
│ └── migration-guide.md
|
74
74
|
├── lib/
|
75
75
|
└── your-gem.gemspec
|
76
76
|
|
77
|
-
Context files can be in any format, but `.
|
77
|
+
Context files can be in any format, but `.md` and `.md` files are commonly used for documentation.
|
78
78
|
|
79
79
|
## See Also
|
80
80
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agent-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Samuel Williams
|
7
8
|
- Shopify Inc.
|
8
9
|
bindir: bin
|
9
10
|
cert_chain:
|
@@ -57,10 +58,9 @@ extensions: []
|
|
57
58
|
extra_rdoc_files: []
|
58
59
|
files:
|
59
60
|
- bake/agent/context.rb
|
60
|
-
- context/adding-context.
|
61
|
-
- context/examples.
|
62
|
-
- context/getting-started.
|
63
|
-
- context/markdown-context.mdc
|
61
|
+
- context/adding-context.md
|
62
|
+
- context/examples.md
|
63
|
+
- context/getting-started.md
|
64
64
|
- design.md
|
65
65
|
- lib/agent/context.rb
|
66
66
|
- lib/agent/context/helper.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,91 +0,0 @@
|
|
1
|
-
---
|
2
|
-
globs: *.mdc
|
3
|
-
alwaysApply: false
|
4
|
-
---
|
5
|
-
# Creating `.mdc` (Markdown Context) Files
|
6
|
-
|
7
|
-
## What is an `.mdc` file?
|
8
|
-
|
9
|
-
An `.mdc` file is a Markdown file with optional YAML frontmatter, used to provide context, documentation, or metadata for Ruby gems. These files are intended to be machine- and human-readable, and are used by tools like `agent-context` to expose useful information to users and agents.
|
10
|
-
|
11
|
-
## Structure
|
12
|
-
|
13
|
-
### 1. YAML Frontmatter (Optional but Recommended)
|
14
|
-
|
15
|
-
Start your `.mdc` file with a YAML frontmatter block:
|
16
|
-
|
17
|
-
```yaml
|
18
|
-
---
|
19
|
-
description: Short summary of the file's purpose
|
20
|
-
globs: "test/**/*.rb,lib/**/*.rb" # Optional: comma-separated file patterns
|
21
|
-
alwaysApply: false # Optional: should this context always be applied?
|
22
|
-
---
|
23
|
-
```
|
24
|
-
|
25
|
-
**Fields:**
|
26
|
-
- `description` (required): Short, human-readable summary.
|
27
|
-
- `globs` (optional): Comma-separated string of file patterns this context applies to.
|
28
|
-
- `alwaysApply` (optional): Whether to always apply this context (default: false).
|
29
|
-
|
30
|
-
### 2. Markdown Content
|
31
|
-
|
32
|
-
After the frontmatter, write your documentation in standard Markdown:
|
33
|
-
|
34
|
-
~~~markdown
|
35
|
-
# Title
|
36
|
-
|
37
|
-
## Section
|
38
|
-
|
39
|
-
- Bullet points
|
40
|
-
- More details
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
# Code examples
|
44
|
-
```
|
45
|
-
~~~
|
46
|
-
|
47
|
-
## Best Practices
|
48
|
-
|
49
|
-
- **Start with a clear description** in the YAML frontmatter.
|
50
|
-
- **Use headings** (`#`, `##`) to organize content.
|
51
|
-
- **Keep each file focused** on a single topic.
|
52
|
-
- **Include code examples** where relevant.
|
53
|
-
- **Use lists** for options, steps, or best practices.
|
54
|
-
- **Be concise and actionable.**
|
55
|
-
- **Use tags and globs** to help agents and tools categorize and apply context.
|
56
|
-
|
57
|
-
## Example `.mdc` File
|
58
|
-
|
59
|
-
~~~markdown
|
60
|
-
---
|
61
|
-
description: How to configure the gem for production use.
|
62
|
-
globs: config/my_gem.rb
|
63
|
-
alwaysApply: false
|
64
|
-
---
|
65
|
-
|
66
|
-
# Production Configuration
|
67
|
-
|
68
|
-
To configure my_gem for production:
|
69
|
-
|
70
|
-
1. Set the environment variable:
|
71
|
-
```sh
|
72
|
-
export GEM_ENV=production
|
73
|
-
```
|
74
|
-
2. Update your config file:
|
75
|
-
```ruby
|
76
|
-
MyGem.configure do |config|
|
77
|
-
config.mode = :production
|
78
|
-
end
|
79
|
-
```
|
80
|
-
3. Restart your application.
|
81
|
-
~~~
|
82
|
-
|
83
|
-
## When to Use `.mdc` Files
|
84
|
-
|
85
|
-
- To provide documentation, guides, or metadata for your gem.
|
86
|
-
- To expose best practices, migration guides, or troubleshooting tips.
|
87
|
-
- To help AI agents and tools discover and apply context automatically.
|
88
|
-
|
89
|
-
## Further Reading
|
90
|
-
- [YAML Frontmatter Spec](https://jekyllrb.com/docs/front-matter/)
|
91
|
-
- [Markdown Guide](https://www.markdownguide.org/)
|