
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given the function $f(x)=\ln x+\frac{1}{ax}-\frac{1}{a}$, where $a\in \mathbb{R}$ and $a\neq 0$.

$(1)$ Discuss the monotonicity of the function $f(x)$;

$(2)$ When $x\in \left[\frac{1}{e},e\right]$, determine the number of zeros of the function $g(x)=(\ln x-1)e^{x}+x-m$.

Present the answer in LaTex format: \boxed{Your answer}
user