
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(1+x)+a\cos x$.  
$(1)$ The equation of the tangent line to the curve $y=f(x)$ at the point $(0,f(0))$ is $y=x+2$. Find the value of the real number $a$.  
$(2)$ Under the condition of $(1)$, if $g(x)=f(x)-\frac{1}{1+x}$, investigate the number of zeros of $g(x)$ on $(-1,\frac{\pi}{2})$.

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