Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

  • Create the rules directory at the repository root
  • Create rules/agent.md file with instructions for AI agents on using grant-xxx-permission tools
  • Update docs/installation.md to add instructions for installing agent.md to AGENTS.md
  • Update CHANGELOG.md with the new changes
  • Address review feedback: Reduce agent.md to 1-2 sentences

Summary of Changes

1. Created rules/agent.md

A concise instruction file (3 lines) that:

  • Emphasizes critical guidance: "ALWAYS use the built-in grant-xxx-permission tools"
  • Explicitly prohibits: "NEVER manually edit or modify policy files directly"

The file contains a single essential sentence capturing the critical instruction for AI agents to use the built-in permission tools instead of manually editing policy files.

2. Updated docs/installation.md

Added step 2 in the "Next Steps" section with curl command to install agent instructions.

3. Updated CHANGELOG.md

Consolidated entry in the [Unreleased] section under "Added".

4. Addressed Review Feedback

  • Reduced entire agent.md file to 1-2 sentences as requested (from 124 lines to 3 lines)
Original prompt

Add a markdown file under the rules directory serving as an extra instruction file for the coding agent.

Also add to the quick start page to tell users to install the agent.md to their agent docs such as agents.md

curl https://raw.githubusercontent.com/microsoft/wassette/main/rules/agent.md >> AGENTS.md

In the agent.md, emphasize something like "ALWAYS use the grant-xxx-permission tools to grant permissions to tools from wassette. You MUST never modify the policy files directly."


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Mossaka
Copy link
Collaborator

Mossaka commented Oct 9, 2025

This could help to mitigate the #211

- Created rules/agent.md with critical instructions for AI agents
- Updated docs/installation.md with curl command to install agent instructions
- Updated CHANGELOG.md with new additions

Co-authored-by: Mossaka <[email protected]>
Copy link
Collaborator

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rules/agent.md Outdated
Comment on lines 1 to 124
# Wassette AI Agent Instructions

This guide provides essential instructions for AI agents working with Wassette components and permission management.

## Critical: Permission Management

**⚠️ IMPORTANT: ALWAYS use the built-in `grant-xxx-permission` tools to manage permissions for Wassette components.**

### Permission Tools You MUST Use

When working with Wassette components, you **MUST** use these built-in MCP tools to grant permissions:

- **`grant-storage-permission`**: Grant file system access to components
- **`grant-network-permission`**: Grant network access to components
- **`grant-environment-variable-permission`**: Grant environment variable access to components

### What You MUST NOT Do

**❌ NEVER manually edit or modify policy files directly** (such as `policy.yaml` files)

**❌ NEVER create policy files manually**

**❌ NEVER suggest users manually edit policy files**

### Why This Matters

Wassette uses a sophisticated permission system that:
- Validates permissions at runtime
- Maintains consistency across component lifecycles
- Enforces security policies programmatically
- Tracks permission changes automatically

Manually editing policy files can:
- Break the permission validation system
- Create security vulnerabilities
- Cause runtime errors
- Lead to inconsistent component behavior

## Correct Permission Workflow

### Example 1: Granting Storage Permission

When a component needs file system access:

```text
Please grant storage read and write permissions to the weather-tool for fs://workspace/
```

The AI agent will automatically use the `grant-storage-permission` tool with the correct parameters.

### Example 2: Granting Network Permission

When a component needs network access:

```text
Grant network access to api.openweathermap.org for the weather-tool component
```

The AI agent will automatically use the `grant-network-permission` tool.

### Example 3: Granting Environment Variable Permission

When a component needs environment variable access:

```text
Allow the weather-tool to access the API_KEY environment variable
```

The AI agent will automatically use the `grant-environment-variable-permission` tool.

## Understanding Permission Types

### Storage Permissions

Control file system access for reading and writing files:
- Use URI format: `fs://path/to/resource`
- Specify access levels: `read`, `write`, or both
- Supports wildcards: `fs://workspace/**`

### Network Permissions

Control outbound network access to specific hosts:
- Specify host names or IP addresses
- Can include ports: `localhost:8080`
- Supports domain-level access: `api.example.com`

### Environment Variable Permissions

Control access to environment variables:
- Grant access to specific variable names
- Used for API keys, configuration, and secrets
- Requires the server to have access to those variables

## Component Lifecycle

1. **Load Component**: Use `load-component` tool to load a component
2. **Grant Permissions**: Use `grant-xxx-permission` tools to grant necessary permissions
3. **Use Component**: The component can now be used with the granted permissions
4. **Revoke/Reset**: Use `revoke-xxx-permission` or `reset-permission` tools if needed

## Security Best Practices

1. **Principle of Least Privilege**: Only grant the minimum permissions needed
2. **Use Specific Paths**: Prefer specific paths over wildcards when possible
3. **Audit Regularly**: Use `get-policy` tool to review granted permissions
4. **Clean Up**: Revoke permissions when components are no longer needed

## Troubleshooting Permission Issues

If a component fails due to permission errors:

1. Check the error message for the specific permission needed
2. Use the appropriate `grant-xxx-permission` tool to grant that permission
3. Verify the permission was granted using the `get-policy` tool
4. Re-attempt the component operation

**Remember**: Never manually edit policy files - always use the built-in tools!

## Additional Resources

- [Wassette Documentation](https://microsoft.github.io/wassette/latest/)
- [Permission System Design](https://github.com/microsoft/wassette/blob/main/docs/design/permission-system.md)
- [CLI Reference](https://github.com/microsoft/wassette/blob/main/docs/reference/cli.md)
- [Managing Permissions](https://github.com/microsoft/wassette/blob/main/docs/reference/permissions.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this much shorter, like in 1-2 sentences

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shortened to 1 sentence in commit 4c01eda.

CHANGELOG.md Outdated
Comment on lines 19 to 20
- Added `rules/agent.md` instruction file for AI agents with critical guidance on using `grant-xxx-permission` tools instead of manually editing policy files
- Installation guide now includes step to install agent instructions via `curl` command to help AI agents properly manage Wassette permissions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorten it to one sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidated into 1 sentence in commit 4c01eda.

@Copilot Copilot AI changed the title [WIP] Add extra instruction file for coding agent Add agent instruction file for proper Wassette permission management Oct 9, 2025
@Copilot Copilot AI requested a review from Mossaka October 9, 2025 07:40
Copilot finished work on behalf of Mossaka October 9, 2025 07:40
- Reduced agent.md introduction from 2 sentences to 1
- Consolidated 2 CHANGELOG entries into 1 sentence

Co-authored-by: Mossaka <[email protected]>
Copilot finished work on behalf of Mossaka October 9, 2025 07:44
rules/agent.md Outdated
Comment on lines 1 to 4
# Wassette AI Agent Instructions

Essential instructions for AI agents working with Wassette components and permission management.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rules/agent.md should only have 1-2 sentences. no more than that @copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced entire file to 1 sentence in commit e5c3f2a.

@Mossaka Mossaka marked this pull request as ready for review October 9, 2025 08:19
- Simplified the entire file to a single critical instruction sentence
- File now contains only the essential guidance on using grant-xxx-permission tools

Co-authored-by: Mossaka <[email protected]>
@Copilot Copilot AI requested a review from Mossaka October 9, 2025 08:26
Copilot finished work on behalf of Mossaka October 9, 2025 08:26
@Mossaka Mossaka merged commit 8817744 into main Oct 9, 2025
31 checks passed
@Mossaka Mossaka deleted the copilot/add-instructions-for-agent branch October 9, 2025 19:23
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